Create Payment Methods
Zuora supports a variety of payment methods. End subscribers sometimes find the default payment methods they already have could not be used and want to add a new payment method to complete the order. The new payment method is expected to be set up and associated with their account directly.
Note: Zuora’s Payment Pages 2.0 allow subscribers to send payment details to your company in a secure and PCI-compliant manner. Alternative to using the REST API, you can also consider integrating a hosted payment page to your portal. For more information about Payment Pages 2.0, see Payment Pages 2.0.
In this guide, you will learn:
- How to create a credit card payment method by API.
Step 1. Generate an OAuth token
See Create an OAuth token for details.
Step 2. Collect the credit card information
In order to make a valid request, ensure that you have the following information:
-
cardHolderInfo
(cardHolderName
required) -
cardNumber
(required) -
cardType
(required) -
expirationMonth
(required) -
expirationYear
(required)
Step 3. Create a credit card payment method using the "Create a payment method" operation
Use the Create a payment method operation to create a credit card payment method.
The following cURL code sample creates a Discover credit card with securityCode
= 123
. This card will expire on October, 2023.
curl --location --request POST 'https://rest.zuora.com/v1/payment-methods' \
--header 'Authorization: Bearer e05fd08c256b4dd78c0eca181208dd16' \
--header 'Content-Type: application/json' \
--data-raw '{
"cardHolderInfo": {
"addressLine1": "77 Fallon Glen",
"addressLine2": "",
"cardHolderName": "Leo",
"city": "Fremont",
"country": "USA",
"email": "smith@example.com",
"phone": "4155551234",
"state": "California",
"zipCode": "94020"
},
"cardNumber": "1111222233334444",
"cardType": "Discover",
"makeDefault": false,
"expirationMonth": 10,
"expirationYear": 2023,
"securityCode": "123",
"type": "CreditCard"
}'
Step 4. Verify the result
After the payment method is created, you can verify the result in the Zuora UI or through the GET operations for the Payment Method object.
To verify the result through the Zuora UI, you can find the created payment method displayed at the top of the All Payment Methods page by navigating to Payments > Payment methods in the Zuora UI.
To verify the result through the API, See Retrieve Object Information for details.