Skip to main content

apple-pay

Anonymous ApplePay integration with Adyen

An ApplePay(ment) is performed on the device first. After that the CreatePayment service is called with the ApplePay payment type. The information received from the ApplePay API has to be provided in the CreatePayment service, in its Properties object like so:

[block:code] { "codes": [ { "code": "{\n \"OrderID\": 123,\n \"PaymentTypeID\": 456,\n \"Properties\": {\n \"Channel\": 2, // iOS\n \"Data\": {} // the current already used data object for the CheckoutAPI\n \"ApplePayData\": {\n \"Token\": \"sjkjkdj\", //The stringified and base64 encoded paymentData you retrieved from the Apple framework.\n \"BillingAddress\": {\n \"EmailAddress\": \"\",\n \"PhoneNumber\": \"\",\n \"GivenName\": \"\",\n \"FamilyName\": \"\",\n \"PostalCode\": \"\",\n \"CountryID\": \"\",\n \"Locality\": \"\",\n \"AdministrativeArea\": \"\",\n \"SubAdministrativeArea\": \"\"\n \"SubLocality\": \"\",\n \"AddressLines\": [\n \"\",\n \"\"\n ]\n },\n \"ShippingAddress\": {\n // same\n }\n } \n }\n}", "language": "json", "name": "CreatePayment" } ] } [/block] These address objects are almost an exact duplicate of the response of the Apple Framework (see Apple's support docs).

The ApplePayData should only be filled however in the case of ApplePay being triggered as a one-click-checkout. When the payment is successful, EVA will try to create a user based on the provided data, attach the addresses to the order and validate everything.

If for some reason the order is not valid to be placed, the order will be cancelled and refunded. A new order with the same products will then be created. If this happens the customer can try a regular full-blown checkout instead.

Indications about the result can be found in the response properties:

[block:code] { "codes": [ { "code": "{\n \"Properties\": {\n \"ApplePayData\": {\n \"OrderID\": 123, // only filled if a new order is created due to validation problems\n \"AuthenticationToken\": \"jsjksjs\", // the newly created user is logged in automatically, this is the AuthenticationToken for it\n \"Success\": true\n }\n }\n}", "language": "json", "name": "Response of CreatePayment" } ] } [/block] If this method of payment is used while a user is already logged in, the addresses provided by Apple Pay are used for the order, but no new user is created. The result will be Success, but no AuthenticationToken will be returned.

For additional information, see Adyen's Apple Pay support page.