Apple Pay SDK Setup

The setup and show functions create and initialize the Paysafe.js payment methods inside the selected HTML element containers (typically div elements) on your payment page. To initialize Paysafe JS with Apple Pay you should add applePay field. in the options.fields section.
Example of initializing Paysafe JS with ApplePay:


Or you can use async-await:

async setupPaysafeJS() {
    const options = {
        accountId: accountId,
        environment: 'TEST',
        fields: {
            applePay: {
                selector: '#apple-pay',
                type: 'buy',
                label: 'Demo JS',
                color: 'white-outline',
        currencyCode: currencyCode

    try {
        const instance = await paysafe.fields.setup(apikey, options)
        const paymentMethods =
        if (paymentMethods.applePay && !paymentMethods.applePay.error) {
               // Subscribe for click event on applePay button
    } catch(error) {
        /** Process any errors during the setup*/
Did you find this page useful?