We are trying to implement the the tokenNotificationUrl in a deferredBilling request so that we can get MPAN tokens (when supported) back from ApplePay.
We want to be able to test that the events are working and firing. I have tried creating a deferred billing request, and then unlinked my test card from my test account and did not receive any event at my token notification endpoint. What is the best way to approach this from a lower environment perspective?
We are trying to simulate the UNLINK EventType in the MerchantTokenEventResponse.
Also can you confirm that providing this URL is what determines if we get an MPAN vs a DPAN (when MPAN is supported) or is there a different mechanism that turns that on?
Hi @Jalley316,
You wrote:
[...] What is the best way to approach this from a lower environment perspective? [...]
The Apple Pay sandbox environment allows you to test your implementation of Apple Pay, including merchant token notifications, using test credit and debit cards. To begin testing, you will need to:
- Create a sandbox tester account. Sign in to App Store Connect, navigate to Users and Access, then Sandbox, and click Testers to set up your accounts. Ensure the email address used for a sandbox account is not already registered as an Apple Account.
- Sign in with your sandbox account. On your test device, sign out of your personal Apple Account and sign in with your new sandbox tester account as the device's Apple ID.
- Add a test card. Go to Wallet on your test device and add a new card using manual entry with the provided test card numbers. Ensure your device's region is set to a country that supports Apple Pay.
- Initiate a payment request with
tokenNotificationURL. In your app or on your website, create a payment request for a recurring, automatic reload, or deferred payment, and include your server's tokenNotificationURL parameter. - Trigger a life-cycle event. Simulate a life-cycle event that would affect the merchant token, such as a card expiration or deletion, to prompt Apple Pay to send a notification to your
tokenNotificationURL. - Receive and process the notification. Your server should receive a
GETrequest at the specifiedtokenNotificationURLwith aneventId. Use thiseventIdto fetch the details of the merchant token event from Apple Pay servers.
Note: Sandbox test transactions will decline pre-fulfillment because the test key will not match your production key.
To learn more about sandbox testing, see below:
Sandbox Testing
https://developer.apple.com/apple-pay/sandbox-testing/
Then, you wrote:
[...] Also can you confirm that providing this URL is what determines if we get an MPAN vs a DPAN (when MPAN is supported) or is there a different mechanism that turns that on?
tokenNotificationURL is not what determines whether you receive an MPAN or a DPAN. It plays no role in token type selection. MPAN issuance is determined by:
- The payment request type — using
ApplePayDeferredPaymentRequest/PKDeferredPaymentRequest(or recurring / automatic reload) is what signals to Apple Pay and the card network that this is a stored-credential use case eligible for MPAN provisioning. - Card network and issuer support -- the network and issuing bank must support merchant tokens; if not, Apple Pay silently falls back to a DPAN with no API-level signal.
Cheers,
Paris X Pinkney | WWDR | DTS Engineer