Click to Download the apple-developer-merchantid-domain-association file.
Save the file to the following location on the domain where you want to offer Apple Pay: /.well-known/apple-developer-merchantid-domain-association Repeat this step for each additional domain where you want to offer Apple Pay. For example: https://buy.mydomain.com/.well-known/apple-developer-merchantid-domain-association https://shop.mydomain.com/.well-known/apple-developer-merchantid-domain-association https://www.mydomain.com/.well-known/apple-developer-merchantid-domain-associationNote: You must serve the apple-developer-merchantid-domain-association file over HTTPS.
Contact your Digital River representative with the list of domains you want to register.
Step 2: Create an Apple Pay source using DigitalRiver.js
The customer has chosen a different shipping option than was previously selected. You should use this data to re-price your order totals (if applicable).
The customer has authorized the payment and a source, and DigitalRiver.js returned associated data.
Note: To use Apple Pay, you must listen to, at minimum, the Shipping Address Changed and Source events.
applepay.on('source',function(event) {var source =result.source;//pass the source to your back end for further processing. //once verified that the source is created successfully, complete the Apple Pay session by answering with a success message
event.complete('success');});applepay.on('shippingaddresschange',function(event) {var shippingAddress =event.shippingAddress;//create a Payment Request Details Update Objectvar newDetails =createPaymentRequestDetailsUpdateObject();event.updateWith(newDetails);});
The Shipping Address Changed and Shipping Method Changed events require a response of updated details to present to the Shopper. This system expects the response to be in the format of a Payment Request Details Update object.
Place the elements on the page
The following example shows how to place the elements on the page. For more information on placing elements on a page, see the Apple Pay example.
if (applepay.canMakePayment()) {applepay.mount("applepay-element");document.getElementById('applepay-element').style.display ='blocck';}
Apple Pay source and response examples
The source event will surface a Source plus other shopper details Apple Pay provides, like the billing address, shipping address, and contact information.
The following example shows placing an Apple Pay element on your page. Use this in conjunction with the DigitalRiver.js reference guide to build your solution.