ApplePay Integration

Introduction

Paysafe.js v2 allows merchants to take payments from their websites using mobile-based payment methods, such as Apple Pay that rely on card payments made through the Paysafe Payments API. It is a JavaScript SDK which is based on the Payment Request API standard design. You can use this Javascript SDK to offer Apple pay in your merchant website.

Advantages

  • Complies with PCI SAQ-A
  • Simple integration
  • Fully "white label", with no indication to your customers that Paysafe is handling the payment
  • No redirection from the merchant web site required

Example

If your OS and browser comply with Apple Pay prerequisites (an iOS or macOS device with Safari, and an Apple sandbox account) an example of Paysafe Request in action will be displayed below. If you do not meet these prerequisites, a message to that effect is displayed instead. The example does not make a real payment, and no money is transferred.

The payment-handle returned can then be used to make a payment using the Payments API.

Before you begin

Before you begin, you need to obtain your standard server-to-server API key (private key) and a Payment-handle generating API key (public key) from the Business portal.

Note: Please contact your business relationship manager or reach out to integrations@paysafe.com for your credentials to the Business Portal.

Note: The payment-handle generating API key is used in your JavaScript code on the client to generate payment-handles from customer credit cards and bank accounts. Unlike the server-to-server API key, this key has no ability to take payment or carry out any other operation, and can therefore be safely exposed in your client side code.

To obtain the Public API key from the Business Portal:

  1. Go to Integrate>API Keys
  2. For Public Key, click the Copy icon to copy the API key.
    1. Your API key will have the following format:
      1. Key Username – MerchantXYZ
      2. Key Password – B-tst1-0-51ed39e4-312d02345d3f123120881dff9bb4020a89e8ac44cdfdcecd702151182fdc952272661d290ab2e5849e31bb03deede7e

  3. For Private key, click on "Authentic Now" and enter your Business portal password to view the private apikey

    1. Your API key will have the following format:
      1. Key Username – MerchantXYZ
      2. Key Password – B-tst1-0-51ed39e4-312d02345d3f123120881dff9bb4020a89e8ac44cdfdcecd702151182fdc952272661d290ab2e5849e31bb03deede7e

The API key is case-sensitive. For server-to-server calls, apikey is sent using HTTP Basic Authentication.

To use HTTP Basic Authentication, you must send the API key credentials using the Authorization header with every request. You must construct the Authorization header as follows:

  1. Combine the Key Username and Key Password into a string separated by a colon, e.g., “Key Username:Key Password”.
  2. The resulting string literal is then encoded using Base64.
  3. The authorization method and space (i.e., “Basic”) are then put before the encoded string.

For example, using the Key Username and Password examples above, the header is formed as follows:

Authorization: Basic TWVyY2hhbnRYWVo6Qi10c3QxLTAtNTFlZDM5ZTQtMzEyZDAyMzQ1ZDNmMTIzMTIwODgxZGZmOWJiNDAyMGE4OWU4YWM0NGNkZmRjZWNkNzAyMTUxMTgyZmRjOTU yMjcyNjYxZDI5MGFiMmU1ODQ5ZTMxYmIwM2RlZWRlN2U=

For additional details, please refer here.

Getting the Apple Pay Certificates

As a merchant, to accept payments from Apple Pay, you need to add two certificates called the processing certificate and identity certificate in the Business Portal. If the certificates are not added, you won’t be able to accept payments from customer’s Apple Pay accounts.

In the Business Portal, at Integrate > Apple Pay Certificates, you can add and manage your Apple Pay certificates. After you navigate to the Apple Pay Certificates page, you can see two sections:

  1. Merchant Pay Processing Certificate
  2. Merchant Identity Certificate

The first step in the configuration is to add a Payment Processing Certificate from Apple’s website. If you are a merchant who accepts payments from web applications, you need to add the Apple Pay Merchant Identity Certificate.

To accept Apple Pay payments from both web and iOS, you need to configure the Merchant Payment Processing Certificate. This certificate is required to decrypt the token that is passed in Apple Pay transactions. Only when the token is decrypted the payment becomes successful.

Add a Merchant Identity Certificate

  1. Click Add a Certificate. The Add New Certificate screen appears.
  2. Click Generate CSR. A CSR file downloads to your local machine.
  3. Click Visit Apple Developer Portal. The Apple Developer portal opens in a new tab.
  4. Login to the Apple Developer portal. After you login, the Certificates, Identifiers, & Profiles page appears. As a merchant, you need to create a login in the developer portal and associate merchant ID’s associated under your profile to process Apple Pay payments.
  5. Click + (plus icon) to create a new certificate.
  6. Select Apple Pay Merchant Identity Certificate option and click Continue. The Select a Merchant ID step appears.
  7. Select a merchant ID that you’ve created in the Apple’s Developer portal and click Continue. The Upload a Certificate Signing Request step appears.
  8. Click Choose File and select the CSR file that you’ve downloaded previously in Step 2 and click Continue. The Download your Certificate step appears.
  9. Click Download to download the certificate.
  10. Navigate back to the Business Portal > Add New Certificate screen.
  11. Click Upload at the 3rd step. The Authenticate dialog appears.
  12. Enter your portal password in the dialog box and click Authenticate. The Select dialog appears.
  13. Select the certificate downloaded from the Apple Developer Portal. After you select a certificate, the portal shows if the upload was successful and shows the expiry date of the certificate. Also, you can see the certificates in the Integrate > Apple Pay Certificates page.

Add a Merchant Payment Processing Certificate

  1. Click Add a Certificate. The Add New Certificate screen appears.
  2. Click Generate CSR. A CSR file downloads to your local machine.
  3. Click Visit Apple Developer Portal. The Apple Developer portal opens in a new tab.
  4. Login to the Apple Developer portal. After you login, the Certificates, Identifiers, & Profiles page appears. As a merchant, you need to create a login in the developer portal and have some merchant ID’s associated under your profile to process Apple Pay payments.
  5. Click + (plus icon) to create a new certificate.
  6. Select Apple Pay Payment Processing Certificate option and click Continue. The Select a Merchant ID step appears.
  7. Select a merchant ID that you’ve created in the Apple’s Developer portal and click Continue. The Upload a Certificate Signing Request step appears.
  8. Click Choose File and select the CSR file that you’ve downloaded previously in Step 2 and click Continue. The Download your Certificate step appears.
  9. Click Download to download the certificate.
  10. Navigate back to the Business Portal > Add New Certificate screen.
  11. Click Upload at the 3rd step. The Authenticate dialog appears.
  12. Enter your portal password in the dialog box and click Authenticate. The Select dialog appears.
  13. Select the certificate downloaded from the Apple Developer Portal. After you select a certificate, the portal shows if the upload was successful and shows the expiry date of the certificate. Also, you can see the certificates in the Integrate > Apple Pay Certificates page.

Note: If the certificate expires then it is not possible to accept payments from Apple Pay payments. You can view the certificate expiry at Integrate > Apple Pay Certificate page.

For Merchants using the old setup of paysafe JS can refer to the old Netbanx Portal Guide to get the Apple Pay Certificates.

Changelog

Version Description
1.13.0

Paysafe.js integration with Payment API launched.

Did you find this page useful?