Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface VoucherifyClientSideOptions

Hierarchy

  • VoucherifyClientSideOptions

Index

Properties

Optional apiUrl

apiUrl: string

Optionally, you can add apiUrl to the client options if you want to use Voucherify running in a specific region.

const client = VoucherifyClientSide({
        clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
        clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
        apiUrl: 'https://<region>.api.voucherify.io'
})

clientApplicationId

clientApplicationId: string

Log-in to Voucherify web interface and obtain your Client-side Keys from Configuration:

const client = VoucherifyClientSide({
        clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
        clientSecretKey: 'YOUR-CLIENT-SECRET-KEY'
})

clientSecretKey

clientSecretKey: string

Log-in to Voucherify web interface and obtain your Client-side Keys from Configuration:

const client = VoucherifyClientSide({
        clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
        clientSecretKey: 'YOUR-CLIENT-SECRET-KEY'
})

Optional customHeaders

customHeaders: Record<string, string>

You can pass additional headers to requests made by the API Client. It can prove to be useful when debugging various scenarios.

const voucherify = VoucherifyServerSide({
        clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
        clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
        customHeaders: {
            "DEBUG-HEADER": "my_value",
            "TEST-HEADER": "another_value"
        }
})

Optional exposeErrorCause

exposeErrorCause: boolean

If you wish to include original Axios error in VoucherifyError instance set this to true It can prove to be useful when debugging various scenarios. The original Axios error will be included in cause property of VoucherifyError

Optional origin

origin: string

(Required in Node.js) Set the origin from where the requests are made.

const client = VoucherifyClientSide({
        clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
        clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
        origin: 'your-domain.com'
})
note

in the browser, this option will be ignored. The origin header is a forbidden header name and it'll be automatically set by the browser for every request.

Optional timeoutMs

timeoutMs: number

Optionally, you can set timeout in miliseconds. After this time request will be aborted. By default Voucherify's API has timeout value of 3 minutes.

Optional trackingId

trackingId: string

Set customer identity when using React Widget. In other situations, use setIdentity method:

client.setIdentity('gustav@purpleson.com')