Apple Pay

Everything you need to take Apple Pay payments via web or app:

How it works

../resources/images/applepayflow_thumb_350_0.png

  1. You request the encrypted payload from your app or website

  2. Apple Pay returns the encrypted payload following shopper authentication

  3. You send the encrypted payload to your server

  4. You send an XML Direct request to Worldpay containing the encrypted Apple Pay data

  5. We send you the payment response

  6. You inform the shopper of the outcome

Setup

Prerequisites

You need:

  • ADirectintegration to Worldpay

  • An Apple iOS Developer account

  • Worldpay to enable Apple Pay on your account

Set up the Apple Merchant ID

Create an Apple Merchant ID through Apple’s developer portal.

In-app

For in-app payments Apple only needs you to configure one item:

  • Payment Processing Certificate: This is where you upload the CSR generated by Worldpay. Contact Corporate Support with your WorldpayMerchant Codeand your Apple Merchant ID, and we'll enable Apple Pay on your account. You can generate your own CSR using the WorldpayMAI.

    Note: We give you separate CSRs for test and production environments. This means you must upload a new CSR when you migrate transaction processing between environments.

Detailed instructions to configure your Apple Merchant ID for in-app payments are at: https://developer.apple.com/library/archive/ApplePay_Guide/Configuration.html

On web

For web payments, Apple need three items configured:

  • Payment Processing Certificate: This is where you upload the CSR generated by Worldpay. Contact Corporate Support with your Worldpay Merchant Code and your Apple Merchant ID, and we'll also enable Apple Pay on your account. .

    Note: We give you separate CSRs for test and production environments. This means you must upload a new CSR when you migrate transaction processing between environments.

  • Merchant Domain: Apple will provide a file for you to host on your own server so that they can verify the domain used for the Apple Pay service.

  • Merchant Identity Certificate: This CSR is generated by you in order to facilitate a two way Transport Layer Security (TLS) 1.2 connection between your server and Apple’s servers when creating an Apple Pay session.

More instructions to configure your Apple Merchant ID for your website are at: https://developer.apple.com/documentation/apple_pay_on_the_web

Integrate with Apple Pay

Integrate to Apple Pay to obtain the encrypted payment credentials. While doing this, be aware of the below properties which relate to the Worldpay integration.

  • In-app: https://developer.apple.com/library/archive/ApplePay_Guide/

  • On web: https://developer.apple.com/reference/applepayjs/applepaysession

Set the merchantCapabilities property

Worldpay only supports the 3DS merchantCapabilities option, so configure your Apple Pay integration as follows:

In-app

In Xcode, configure the merchantCapabilities property of the request object to only accept the PKMerchantCapability3DS option:

Copied!
request.merchantCapabilities = PKMerchantCapability3DS;

Note: See Apple’s developer guides for more details: https://developer.apple.com/library/content/ApplePay_Guide/CreateRequest.html

#### On web In your JavaScript, configure the merchantCapabilities property of the request object to only accept the supports3DS option:
Copied!
var request = {
  countryCode: 'US',
  currencyCode: 'USD',
  supportedNetworks: ['visa', 'masterCard', 'amex', 'discover'],
  merchantCapabilities: ['supports3DS'], // Only use 'supports3DS' here
  total: { label: 'Your Label', amount: '10.00' },
}

Note: See Apple’s developer guides for more details: https://developer.apple.com/reference/applepayjs/applepaysession

Set the supportedNetworks property

Worldpay only supports Apple Pay payments with Visa, Mastercard, Maestro, American Express (Amex) and Discover cards.

In-app

In Xcode, configure the supportedNetworks property of the request object to only accept the card networks Worldpay support:

Copied!
request.supportedNetworks =
@[PKPaymentNetworkAmex,PKPaymentNetworkVisa,PKPaymentNetworkMasterCard,PKPaymentNetworkDiscover];

Note: See Apple’s developer guides for more details: https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest

On web

In JavaScript, configure the supportedNetworks property of the request object to only accept the card networks Worldpay support:

Copied!
var request = {
  countryCode: 'US',
  currencyCode: 'USD',
  supportedNetworks: ['visa', 'masterCard', 'amex', 'discover'], // Only use the cards listed here
  merchantCapabilities: ['supports3DS'],
  total: { label: 'Your Label', amount: '10.00' },
}

Note: See Apple’s developer guides for more details: https://developer.apple.com/reference/applepayjs/applepaysession

Integrate with Worldpay

Prerequisite: You've successfullyintegrated Apple Payto your website or app, and can generate an encrypted payload.

When you've generated an encrypted payload, and have passed this to your server, send the payload to us within <APPLEPAY-SSL>.

Example XML request

Copied!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay/DTD WorldPay PaymentService v1//EN"
"http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE">
  <submit>
  <order orderCode="YOUR_ORDER_CODE" shopperLanguageCode="en">
    <description>APPLE_PAY_TEST_ORDER</description>
    <amount value="100" currencyCode="GBP" exponent="2"/>
    <orderContent>
      <![CDATA[]]>
    </orderContent>
    <paymentDetails>
      <APPLEPAY-SSL>
        <header>
          <ephemeralPublicKey>AAAA...</ephemeralPublicKey>
          <publicKeyHash>AAAA...</publicKeyHash>
          <transactionId>AAAA...</transactionId>
        </header>
        <signature>AAAA...</signature>
        <version>EC_v1</version>
        <data>AAAA...</data>
      </APPLEPAY-SSL>
    </paymentDetails>
    <shopper>
      <shopperEmailAddress>sp@worldpay.com</shopperEmailAddress>
    </shopper>
  </order>
  </submit>
</paymentService>

Response

The response message is the same as ourstandard XML responses.

Recurring payments

To take recurring payments you must create atokenand follow ourstored credentials integration guide.

Full XML payment request using tokenisation and stored credentials:

Copied!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE">
  <submit>
    <order orderCode="YOUR_ORDER_CODE">
      <description>test order</description>
      <amount value="100" currencyCode="GBP" exponent="2"/>
      <orderContent>
        <![CDATA[]]>
      </orderContent>
      <paymentDetails>
        <APPLEPAY-SSL>
          <header>
            <ephemeralPublicKey>MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEh2j5Uf1TPSTv9s1ScPq9L562AUMws6HlqvTTIymzGGe35diIyUyjOHmhg+bZYXJP/bb+KbMWGA4Ow2ADHK2aVw==</ephemeralPublicKey>
            <publicKeyHash>QfMuIHzBakZ8bDqdm1SgybHdc/hi19OJMO6DIqVeDYY=</publicKeyHash>
            <transactionId>614253d6219d69589e15cacdf7de2ce135716528b9fad0dfa3beb1d3e88bfa91</transactionId>
          </header>
          <signature>MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID4zCCA4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lQV2erQCbZ3OLbGezEqibsqr5/qNTG+sQn05S4fHfGOmUbysjNH8ozJI3coPAiZzH0BptXMfhDKFIQdA4HBIGr10B7jskX965U0PWIWwAAu7/jkmK3aM2BOJPDEZ2U=</data>
        </APPLEPAY-SSL>
          <storedCredentials usage="FIRST" merchantInitiatedReason="UNSCHEDULED"></storedCredentials>
          <session shopperIPAddress="127.0.0.1" id="ssn542175964"/>
      </paymentDetails>
      <shopper>
        <shopperEmailAddress>sp@worldpay.com</shopperEmailAddress>
        <authenticatedShopperID>shopperID</authenticatedShopperID>
        <browser>
          <acceptHeader>text/html</acceptHeader>
          <userAgentHeader>Mozilla/5.0 ...</userAgentHeader>
        </browser>
      </shopper>
      <createToken tokenScope="shopper">
        <tokenEventReference>eventReference</tokenEventReference>
        <tokenReason>reason</tokenReason>
      </createToken>
    </order>
  </submit>
</paymentService>

Test

Worldpay’s test environment supports the use of Apple’s Sandbox Tester accounts and the Sandbox test cards (Mastercard, Maestro, Visa, Amex and Discover) provided by Apple.

More details are at: https://developer.apple.com/support/apple-pay-sandbox/

All Apple Pay transactions processed against the Worldpay test environment receive an AUTHORISED response status.

When you are ready to go live you must upload the production CSR we gave you.

Some links to Apple Pay websites.

Apple Pay: Your Wallet. Without the wallet

Worldpay/Apple Pay

Developer: Apple Pay Resources

Developer: Apple Pay Developer Forums

Create a payment with a decrypted payload