Skip to main content

Apple Pay

FeatureDescription
Payment Logo - Usage Guidelines
Integration Methods
  1. ✅ Hosted Checkout
  2. ✅ Embedded
  3. ✅ Server-to-Server
Recommended RegionsGlobal
Virtual Industry Support
Subscription Support✅ Varies by industry
Supported SaaSAll integrated SaaS platforms
Supported Open-Source Platforms
  1. ✅ Magento
  2. ✅ WordPress/Woocommerce
  3. ✅ OpenCart
  4. ✅ PrestaShop
  5. ✅ ZenCart

Integration Method

Oceanpayment supports the following Apple Pay integration methods:

Integration MethodDescription
EmbeddedMerchants are not required to enroll in the Apple Developer Program. Oceanpayment handles Merchant Validation and payment processing.
Server-to-ServerMerchants must enroll in the Apple Developer Program, obtain the Apple Pay Payment Token, and submit payment requests through Oceanpayment's server-side API.

Embedded

1. Deploy the Domain Verification File

Merchants must host Apple's domain verification file on every domain where Apple Pay will be used and ensure that the file is publicly accessible. Click to ⬇️ download the domain verification file.

https://[DOMAIN_NAME]/.well-known/apple-developer-merchantid-domain-association
Notice

The verification file must be deployed on each individual domain and subdomain that will support Apple Pay.

https://example.com/.well-known/apple-developer-merchantid-domain-association  
https://test.example.com/.well-known/apple-developer-merchantid-domain-association
···

2. Register Domains

  • After deploying the verification file, call the Oceanpayment domain registration API.
cURL -X POST 'https://mds.oceanpayment.com/appleregistermerchant'
-H 'Authorization: MVc9Lt1CDY7RBRUvh8iVmvvPbYF3uvWkymUDz'
-d '{
"website": ["example.com,test.example.com"]
}'
ParameterTypeRequiredDescription
websiteArrayRequiredList of domains to be registered.
  </TabItem>
<TabItem value="Response" label="Response">
```json
{
"statusMessage": "Success",
"statusCode": 200
}
  • Errors Handling
Response codeDescription
200OK
  • Success.
400Bad Request
  • The request is malformed or invalid.
401Unauthorized
  • The request is malformed or invalid.
417Expectation Failed
  • The e-commerce platform isn’t registered with Apple Developer.
500Internal Server Error
  • An internal server error occurred.

3. Complete the Integration

Once domain registration has been successfully completed, Apple Pay will automatically be displayed as a payment option at checkout when the customer's device and browser support Apple Pay. Continue the integration by following the Embedded Integration Guide.

Notice

Apple Pay via the Embedded integration method is only available on supported Apple devices and browsers, such as Safari on macOS, iPhone, and iPad. The Apple Pay button is displayed only on devices running iOS 17 or later.

Server to Server

When using the Server-to-Server integration method, merchants are responsible for completing the Apple Pay developer setup.

1. Enroll in the Apple Developer Program

2. Create Merchant ID

  • Sign in to Apple Developer.
  • Navigate to Certificates, Identifiers & Profiles.
  • Select Identifiers → Merchant IDs.
  • Click (+) to create a Merchant ID. Example: merchant.com.example.store

3. Create a Payment Processing Certificate

  • Generate a CSR (Certificate Signing Request) using Keychain Access on macOS or OpenSSL.
  • Sign in to Apple Developer and navigate to Certificates.
  • Create a certificate of type Payment Processing Certificate.
  • Upload the CSR file.
  • Download the generated .cer certificate from Apple.
  • Install the certificate into your local Keychain.
  • Export the certificate as a .p12 file, including the private key. The exported .p12 file is used to decrypt Apple Pay Payment Tokens on the server side.

4. Configure Merchant Domain Verification

5. Obtain the Payment Token

Refer to the official Apple Pay demo site for Payment Token examples:

{
"paymentData": {
"data": "",
"signature": "",
"header": {
"publicKeyHash": "",
"ephemeralPublicKey": "",
"transactionId": ""
},
"version": "EC_v1"
},
"paymentMethod": {
"displayName": "Visa 0112",
"network": "Visa",
"type": "credit"
},
"transactionIdentifier": ""
}

6. Payment Token Mapping

  • When submitting a payment request to Oceanpayment, pay_accountNumber is used to pass the paymentData object from the Apple Pay Payment Token.
  • Mapping Rules: Pass the complete paymentData object as the value of pay_accountNumber.
{
"data": "",
"signature": "",
"header": {
"publicKeyHash": "",
"ephemeralPublicKey": "",
"transactionId": ""
},
"version": "EC_v1"
}
Notice
  1. The pay_accountNumber parameter must contain the complete paymentData object returned by Apple Pay.
  2. Payment requests should be submitted immediately after the Payment Token is obtained to avoid token expiration.
  3. Only the EC_v1 encryption format is currently supported.

7. card_type Mapping

When submitting a payment request to Oceanpayment, the card_type parameter is used to identify the card network returned in paymentMethod.network. Merchants must map the value of paymentMethod.network to a supported Oceanpayment card_type enumeration before submitting the payment request.

paymentMethod.networkcard_type
visaVISA
masterCardMASTERCARD
maestroMAESTRO
JCBJCB
eloELO
discoverDISCOVER
chinaUnionPayCHINAUNIONPAY
cartesBancairesCARTESBANCAIRES
amexAMEX
-d 'card_type=VISA' \

8. Complete the Payment

Submit the Apple Pay Payment Token to Oceanpayment through the pay_accountNumber parameter and complete the integration using the Server-to-Server Integration flow.

const paymentRequest = {
countryCode: 'US',
currencyCode: 'USD',
total: {
label: 'OceanPayment Checkout',
amount: '10.00',
},
supportedNetworks: ['visa', 'masterCard', 'amex'],
merchantCapabilities: ['supports3DS'],
merchantIdentifier: 'merchant.oceanpayment.test',
};

session.onpaymentauthorized = function (event) {
const payment = event.payment;
console.log(JSON.stringify(payment));
console.log(JSON.stringify(payment.token));

processPayment(payment.token).then(function (response) {
console.log("response from datatrans received");
console.log(response);

if (response.match(/status=.error./)) {
console.log("an error occured!");
console.log(response);
return session.abort();
}

session.completePayment(ApplePaySession.STATUS_SUCCESS);
window.location.href = "/success.html";
});

};


function processPayment(paymentToken) {
let paymentMethod = paymentToken.paymentMethod;
let cardType = paymentMethod.network;
let environment = document.getElementById('environment').value;

let account = payParams[environment].account;
let terminal = payParams[environment].terminal;
let orderNo = new Date().getTime();
let orderCurrency = document.getElementById('#order_currency').value;
let orderAmount = document.getElementById('#order_amount').value;

document.getElementById('form').action = payParams[environment].url;
document.getElementById('account').value = account;
document.getElementById('terminal').value = terminal;
document.getElementById('pay_accountNumber').value = paymentToken.paymentData;
document.getElementById('card_type').value = cardType;
document.getElementById('order_number').value = orderNo;
document.getElementById('order_amount').value = orderAmount;
document.getElementById('methods').value = 'ApplePay';

let billingId = document.getElementById('billing_id').value;
let billingFirstName = document.getElementById('billing_firstName').value;
let billingLastName = document.getElementById('billing_lastName').value;
let billingEmail = document.getElementById('billing_email').value;

let signString = account + terminal + orderNo + orderCurrency + orderAmount
+ billingId + billingFirstName + billingLastName + billingEmail + payParams[environment].secureCode;

document.getElementById('signValue').value = sha256_digest(signString);
document.getElementById('form').submit();

}