Request Apple Pay Payment Session

Wallets API v2
POSThttps://api.mollie.com/v2/wallets/applepay/sessions

For integrating Apple Pay in your own checkout on the web, you need to provide merchant validation. This is normally done using Apple’s Requesting Apple Pay Session. The merchant validation proves (to Apple) that a validated merchant is calling the Apple Pay Javascript APIs.

To integrate Apple Pay via Mollie, you will have to call the Mollie API instead of Apple’s API. The response of this API call can then be passed as-is to the completion method, completeMerchantValidation.

Before requesting an Apple Pay Payment Session, you must place the domain validation file on your server at: https://[domain]/.well-known/apple-developer-merchantid-domain-association. Without this file, it will not be possible to use Apple Pay on your domain.

The guidelines for working with a payment session are:

  • Request a new payment session object for each transaction. You can only use a merchant session object a single time.
  • The payment session object expires five minutes after it is created.
  • Never request the payment session from the browser. The request must be sent from your server.

For the full documentation, see the official Apple Pay JS API documentation.

Parameters

validationUrlstringrequired

The validationUrl you got from the ApplePayValidateMerchant event.

A list of all valid host names for merchant validation is available. You should white list these in your application and reject any validationUrl that have a host name not in the list.

domainstringrequired
The domain of your web shop, that is visible in the browser’s location bar. For example pay.myshop.com.

Access token parameters

If you are using organization access tokens or are creating an OAuth app, you have to specify which profile you are creating the payment session for using the profileId parameter. Data from the profile will be used for Apple Pay. For example, the name of the profile will be displayed on the touch bar, if the payment is used on a MacBook with touch bar.

profileIdstringrequired for access tokens

Example

Request

1
2
3
4
5
6
7
8
POST /v2/wallets/applepay/sessions HTTP/1.1
Authorization: Bearer live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM
Content-Type: application/json

{
    "domain": "pay.mywebshop.com",
    "validationUrl": "https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession",
}

Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
HTTP/1.1 201 Created
Content-Type: application/hal+json

{
    "epochTimestamp": 1555507053169,
    "expiresAt": 1555510653169,
    "merchantSessionIdentifier": "SSH2EAF8AFAEAA94DEEA898162A5DAFD36E_916523AAED1343F5BC5815E12BEE9250AFFDC1A17C46B0DE5A943F0F94927C24",
    "nonce": "0206b8db",
    "merchantIdentifier": "BD62FEB196874511C22DB28A9E14A89E3534C93194F73EA417EC566368D391EB",
    "domainName": "pay.example.org",
    "displayName": "Chuck Norris's Store",
    "signature": "308006092a864886f7...8cc030ad3000000000000"
}