Native app integration provides you with complete control over the Apple Pay user experience within your iOS application. While Dintero handles the payment processing, you implement the Apple Pay user interface directly using Apple’s frameworks (like PassKit), providing a seamless and highly customized experience for your customers.Documentation Index
Fetch the complete documentation index at: https://docs.dintero.com/llms.txt
Use this file to discover all available pages before exploring further.
Native app integration with Apple Pay is supported only via
dintero_psp.applepay. If you are using Worldline (bambora.applepay in the API), native app integration is not available.Prerequisites
Apple Pay Merchant Onboarding
Before you can implement Apple Pay in your app, you must complete Apple’s merchant onboarding process through your Apple Developer Account. This process involves several key steps:- Create a Merchant Identifier: This is a unique identifier that registers your business with Apple as a merchant capable of accepting payments. A single merchant identifier can be used for multiple apps and websites.
- Create a Payment Processing Certificate: This certificate is associated with your merchant ID and is used to encrypt payment data. Contact integration@dintero.com and request a Certificate Signing Request (CSR) from Dintero and use the CSR to create this certificate with Apple. After the certificate has been created you have to download the certificate and get in touch with integration@dintero.com for instructions on how to send us your certificate.
- Enable Apple Pay in Xcode: You need to enable the Apple Pay capability within your Xcode project settings and link it to the merchant identifier you created.
For Apple Pay integration, you must create and use two separate merchant identifiers and two separate Apple Pay Payment Processing Certificates—one set for your test (sandbox) environment and one set for your production environment. Each certificate must be created using the corresponding merchant identifier and environment selection in the Apple Developer portal.
Enable Apple Pay on Your Dintero Account
During your onboarding you will be able to select Apple Pay as a payment method. If it’s not enabled, you can go to settings and payment methods. From there, you can enable Apple Pay as a payment method for your account. If you use payment profiles, ensure that Apple Pay is added to the relevant profiles.Integration with Dintero
The native payment flow with Apple Pay and Dintero is a collaborative process between your app and Dintero’s API. The general flow is as follows:- The user taps the Apple Pay button in your app to begin the checkout process.
- Your app requests a payment session from Dintero’s API.
- Your app fetches payment operations for the session.
- Your app uses the PassKit framework to present the Apple Pay payment sheet to the user.
- After the user authenticates the payment with Face ID, Touch ID, or their passcode, Apple Pay returns an encrypted PKPaymentToken.
- Your app sends the encrypted payment token to Dintero using the endpoint returned in step 3.
-
Your app initiates the checkout Payment using the
transaction_idreturned in step 6 and Dintero creates an authorized transaction
Note that only the Visa and Mastercard payment networks are supported.
Creating an Apple Pay payment session (step 2)
Example payment session request body, note that the return_url must match the app url namespace and thatinitial_recipient=merchant must be set if the link in the session payment response should be followed.
Fetching payment operations for the session (step 3)
The payment operations describe how to post payment data from Apple Pay to Dintero. For a native app integration only the operation withrel set to submit-dintero-psp-applepay is used.
Example request (note, there is no body or content type in this POST request):
Posting payment data from Apple Pay (step 6)
Post the encrypted payment data from Apple Pay to Dintero. For this you use thesubmit-dintero-psp-applepay payment operation.
Extract the access_token query parameter from the operation href and post the payment data. Please remove the access_token query param from the URL before posting payment data. Ensure you send the payment_data as a JSON string.
Transforming the Apple Pay payment token
ThePKPaymentToken from Apple Pay cannot be sent directly — it must be transformed into the following JSON structure before being stringified as payment_data:
PKPayment as follows:
| JSON field | Source |
|---|---|
paymentData | Decode PKPaymentToken.paymentData (raw Data) as JSON |
paymentMethod.displayName | PKPaymentToken.paymentMethod.displayName |
paymentMethod.network | PKPaymentToken.paymentMethod.network.rawValue (e.g. "Visa", "MasterCard") |
paymentMethod.type | PKPaymentToken.paymentMethod.type as string (e.g. "debit", "credit") |
transactionIdentifier | PKPaymentToken.transactionIdentifier |
Initiating checkout payment (step 7)
Initiating the checkout payment using thetransaction_id returned when posting the payment data.
return_url but there is no
need to follow or call it.
Best Practices
Make sure you follow the following best practices.- Never log or store Apple Pay tokens
- Implement proper error handling to avoid exposing sensitive information
- Validate all payment responses on your server