For AI agents: a documentation index is available at the root level at /llms.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Your integration with Apple must retrieve the following information:
Validation URL - Apple provides the validation URL that you send to us when you create an Apple Pay session.
Encrypted payment details - Apple encrypts the cardholder’s payment details and returns them to your integration. After you receive the encrypted payment details, convert them to hexadecimal.
Step 2. Integrate with the Payroc API
Use our API to start the merchant session with Apple Pay and retrieve the startSessionResponse object. After you use the Apple Pay JS API to encrypt the cardholder’s payment details, use our API to run the sale.
Step 2a. Start an Apple Pay session
To start an Apple Pay session with Apple, send a request to our Apple Pay sessions endpoint.
In the body of your request, include the following parameters:
appleDomainId - You can view the appleDomainId after you add the merchant’s domain to the Self-Care Portal.
appleValidationUrl - Apple provides the validation URL as part of your integration with the Apple Pay JS API.
In the response, we return the startSessionResponse object. Send the content of the startSessionResponse object to Apple to retrieve the cardholder’s encrypted payment details.
Request parameters
To create the body of your request, use the following parameters:
Request
appleDomainIdstringRequired
Unique appleDomainId of the merchant's domain that we assigned when you added their domain to our Self-Care Portal.
If your request is successful, our gateway starts the merchant session with Apple and returns the following fields:
Response
startSessionResponsestringRequired
Object that Apple returns when they start the merchant's Apple Pay session.
Send the content in this object to Apple to retrieve the cardholder's encrypted payment details.
In your request, send the following parameters in the paymentMethod object:
type - Provide a value of digitalWallet. serviceProvider - Provide a value of apple. encryptedData - Provide the encrypted payment details that you retrieved from the Apple Pay JS API. The payment details must be in hexadecimal format.
Request parameters
To create the body of your request, use the following parameters:
Request
channelenumRequired
Channel that the merchant used to receive the payment details.
processingTerminalIdstringRequired4-50 characters
Unique identifier that we assigned to the terminal.
orderobjectRequired
Object that contains information about the payment.
paymentMethodobjectRequired
Polymorphic object that contains payment details.
The value of the type parameter determines which variant you should use:
- `card` - Payment card details
- `secureToken` - Secure token details
- `digitalWallet` - Digital wallet details
- `singleUseToken` - Single-use token details
operatorstringOptional0-50 characters
Operator who ran the transaction.
customerobjectOptional
Object that contains the customer's contact details and address information.
Contains parameters required for [Level 2, Level 3, and CEDP transactions](https://docs.payroc.com/knowledge/card-payments/enhanced-data).
ipAddressobjectOptional
Object that contains the IP address of the device that sent the request.
threeDSecureobjectOptional
Polymorphic object that contains authentication information from 3-D Secure.
The value of the serviceProvider parameter determines which variant you should use:
- `gateway` - Use our gateway to run a 3-D Secure check.
- `thirdParty` - Use a third party to run a 3-D Secure check.
credentialOnFileobjectOptional
Object that contains information about saving the customer’s payment details.
offlineProcessingobjectOptional
Object that contains information about the transaction if the merchant ran it when the terminal was offline.
autoCapturebooleanOptionalDefaults to true
Indicates if we should automatically capture the payment amount.
- `true` - Run a sale and automatically capture the transaction.
- `false`- Run a pre-authorization and capture the transaction later.
**Note:** If you send `false` and the terminal doesn't support pre-authorization, we set the transaction's status to pending. The merchant must capture the transaction to take payment from the customer.
processAsSalebooleanOptionalDefaults to false
Indicates if we should immediately settle the sale transaction. The merchant cannot adjust the transaction if we immediately settle it.
**Note:** If the value for **processAsSale** is `true`, the gateway ignores the value in **autoCapture**.
If your request is successful, our gateway uses the card details to run a sale. The response contains the following fields:
Response
paymentIdstringRequired=10 characters
Unique identifier that our gateway assigned to the transaction.
processingTerminalIdstringRequired4-50 characters
Unique identifier of the terminal that initiated the transaction.
orderobjectRequired
Object that contains information about the payment.
cardobjectRequired
Object that contains the details of the payment card.
transactionResultobjectRequired
Object that contains information about the transaction response details.
operatorstringOptional0-50 characters
Operator who initiated the request.
customerobjectOptional
Object that contains the customer's contact details and address information.
refundslist of objectsOptional
Array of refundSummary objects.
Each object contains information about refunds linked to the transaction.
supportedOperationslist of enumsOptional
Array of operations that you can perform on the transaction. Our gateway can return any of the following values:
- `capture` - [Capture the payment](https://docs.payroc.com/api/schema/card-payments/payments/capture).
- `refund` - [Refund the payment](https://docs.payroc.com/api/schema/card-payments/refunds/create-referenced-refund).
- `fullyReverse` - [Fully reverse the transaction](https://docs.payroc.com/api/schema/card-payments/refunds/reverse).
- `partiallyReverse` - [Partially reverse the payment](https://docs.payroc.com/api/schema/card-payments/refunds/reverse).
- `incrementAuthorization` - [Increase the amount of the authorization](https://docs.payroc.com/api/schema/card-payments/payments/adjust).
- `adjustTip` - [Adjust the tip post-payment](https://docs.payroc.com/api/schema/card-payments/payments/adjust).
- `addSignature` - [Add a signature to the payment](https://docs.payroc.com/api/schema/card-payments/payments/adjust).
- `setAsReady` - [Set the transaction’s status to `ready`](https://docs.payroc.com/api/schema/card-payments/payments/adjust).
- `setAsPending` - [Set the transaction’s status to `pending`](https://docs.payroc.com/api/schema/card-payments/payments/adjust).
customFieldslist of objectsOptional
Array of customField objects.
Example response
Response
{
"paymentId": "M2MJOG6O2Y",
"processingTerminalId": "1234001",
"order": {
"orderId": "OrderRef6543",
"amount": 4999,
"currency": "USD",
"dateTime": "2024-07-02T15:30:00Z",
"description": "Large Pepperoni Pizza"
},
"card": {
"type": "MasterCard",
"entryMethod": "keyed",
"cardNumber": "453985******7062",
"expiryDate": "1230",
"securityChecks": {
"cvvResult": "M",
"avsResult": "Y"
}
},
"transactionResult": {
"status": "ready",
"responseCode": "A",
"type": "sale",
"approvalCode": "OK3",
"authorizedAmount": 4999,
"currency": "USD",
"responseMessage": "OK3"
},
"operator": "Jane",
"customer": {
"firstName": "Sarah",
"lastName": "Hopper",
"billingAddress": {
"address1": "1 Example Ave.",
"address2": "Example Address Line 2",
"address3": "Example Address Line 3",
"city": "Chicago",
"state": "Illinois",
"country": "US",
"postalCode": "60056"
},
"shippingAddress": {
"recipientName": "Sarah Hopper",
"address": {
"address1": "1 Example Ave.",
"address2": "Example Address Line 2",
"address3": "Example Address Line 3",
"city": "Chicago",
"state": "Illinois",
"country": "US",
"postalCode": "60056"
}
}
},
"supportedOperations": [
"capture",
"fullyReverse",
"partiallyReverse",
"incrementAuthorization",
"adjustTip",
"setAsPending"
],
"customFields": [
{
"name": "yourCustomField",
"value": "abc123"
}
]
}
Next steps
After you integrate with the Apple Pay JS API and the Payroc API, complete the following steps:
Set up Apple Pay for each merchant - To set up Apple Pay for a merchant to run transactions, go to Set up Apple Pay for a Merchant.
Set up a Sandbox Apple Account - To run test transactions with Apple Pay, set up a Sandbox Apple Account. To set up a Sandbox Apple Account, contact our Integrations Team at [email protected].