- REST APIs
- Welcome
- Card Payments
- 3D Secure 2
- Vault
- Getting Started
- Using the API
- Typical API Calls
- Verify That the Service Is Accessible
- Create a Profile for a Customer
- Add an Address to a Profile
- Add a Card to a Profile
- Add a Bank Account to a Profile
- Create an Apple Pay Single-Use Token
- Create a Google Pay Single-Use Token
- Create a Mobile Single-Use Token
- Create a Direct Debit Single-Use Token
- Process a Transaction Using a Payment Token
- API Reference
- Test and Go Live
- Direct Debit
- Apple Pay
- Google Pay
- Alternate Payments
- Reports API
- ISV Reports
- Platforms
- Overview
- Accounts API V1
- Getting Started
- Using the API
- Typical API Calls
- Verify That the Service Is Accessible
- Create a New Merchant
- Create a New Merchant Account
- Create a New User
- Add an Address
- Create a Business Owner
- Add a Business Owner Address
- Add a Business Owner Identity Document
- Add a Merchant Bank Account
- Accept Our Terms and Conditions
- Activate the New Merchant Account
- Validate the Bank Account
- Enable Webhooks to Receive Application Statuses
- Test and Go Live
- Subaccounts
- Applications API
- Split Payouts
- Balance Transfers
- Paysafe Payments API
- Paysafe Checkout
- Paysafe JS
- Payments API
- Bad Bin API
- Reference Information
- SDKs
- Mobile SDKs
- Additional Documentation
- Resources and Support
- Shopping Carts
- Classic APIs
- Glossary
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:
{{PaysafeJSwithApplePaySSDSSD}
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 = instance.show()
if (paymentMethods.applePay && !paymentMethods.applePay.error) {
// Subscribe for click event on applePay button
}
} catch(error) {
/** Process any errors during the setup*/
}