Create a Payment Method API approach
Learn how to enable Adyen Apple Pay in Zuora and create a payment method using the REST API.
Take the following steps to enable Adyen Apple Pay:
- In your Zuora tenant, navigate to Settings > Payments > Payment Method .
- Click Edit and then select Adyen Apple Pay .
- Click Save . The Adyen Apple Pay payment method is then activated in your Zuora tenant.
Note that no update is required for your existing Adyen Integration v2.0 instance in Zuora to support Apple Pay.
You can use the Create a payment method REST API operation to create an Adyen Apple Pay payment method. The following fields must be specified in the request:
-
accountKey: Specify the customer account ID. This field is required unless the Orphan Payment Method feature is enabled. -
type: SpecifyAdyenApplePay. -
applePaymentData: Include payload with Apple Pay token or Apple payment data. This information should be stringified.
You can also pass the
shopperEmail
information to the gateway through any of the following methods:
-
Use the
emailfield in any of the following API operations:-
Create a payment method
-
Create an account
-
Create an order
-
Create an order asynchronously
-
-
Use the
gatewayOptionsfield in the Create a payment method API operation.
If
shopperEmail
is not provided through either the
email
or
gatewayOptions
field, the
shopperEmail
field in the payment request is set to the BillTo personal email if it is available. If BillTo personal email is not specified, the
shopperEmail
field is set to the BillTo work email.
The following code is a sample request:
|
Method and endpoint |
POST https://apisandbox.zuora.com/apps/v1/payment-methods |
|
Request body |
|
You must ensure that the currency and authorization amount included in
applePaymentData
are the same as the ones configured in your Apple Pay payment form when Verification is enabled. Verification is required to return a
recurringDetailReference
that will be used in subsequent requests. In the example above, the currency is EUR and the authorization is 1.
In addition to the Create a payment method REST API operation, you can also use the following REST API operations to create an Apple Pay payment method together with other objects:
-
Create an account
-
Create an order
-
Create an order asynchronously
Note that once an Adyen Apple Pay payment method is created, it cannot be edited.
After an Adyen Apple Pay payment method is successfully created, you can view this payment method from the customer account details page in the Zuora UI or the response of the API operations for retrieving payment methods.
All related information about Adyen Apple Pay payment methods can be exported using the Method Specific Data field for the Payment Method data source. If you are not familiar with Data Source Exports, see Create a Data Source Export for instructions.
To filter only specific information about Adyen Apple Pay payment methods, you can use several other Payment Method data source fields. The following table provides the mapping relationship between Zuora data source fields and Adyen Apple Pay fields.
|
Data source field |
Adyen Apple Pay field |
Description |
|---|---|---|
|
Method Reference Id |
AppleGatewayToken |
The
|
|
Sub-Type |
AppleCardType |
The brand or type of the card. For example, Visa and Mastercard. |
|
User Reference Id |
AppleCardNumber |
The last 4 digits of the DPAN returned from Adyen as the card summary. |
Note that in the
Credit Card Type
field in the UI and the
appleCardType
field in the API response, Zuora stores the first 100 characters of paymentMethodVariant
returned from Adyen.
After an Apple Pay payment method for Adyen has been added to a customer account, it can be used to make payments similar to using credit cards. You can use Adyen Apple Pay payment methods in all REST operations for processing payments, except for CRUD operations.
You can pass the
shopperEmail
information to the gateway through the
gatewayOptions
field in the Create a payment
REST API operation. For more information about the logic of populating the
shopperEmail
field in the request, see Gateway Options fields supported by Adyen Integration v2.0
.