After your customers click your Checkout button, they might be taken to a login page or registration page where they can register before purchasing.
If they do not already have a billing account, one can be created for them at this point through the "Create an account" API.
Zuora strongly recommends that you create a billing account for every customer. Remember, the sold-to contact data stored on the billing account is used to determine the tax owed by customers based on where your products and services are delivered.
It's a best practice to always collect accurate address information from your customers to ensure regulatory compliance.
Note: This step demonstrates how to create a billing account instead of a login user accout.
The following sample codes creates a new billing account with the following information:
- Bill-to contact:
- Name: Amy Lawrence
- State: California
- Country: USA
- Account name: Amy's account
- Currency: USD
- Bill cycle day: 1st of each month
curl -L -X POST 'https://rest.test.zuora.com/v1/accounts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer be616b3c658c420489e1c31e015fb8fe' \
-d '{
"billToContact": {
"firstName": "Amy",
"lastName": "Lawrence",
"state": "California",
"country": "USA"
},
"name": "Amy Lawrence account",
"autoPay": false,
"currency": "USD",
"billCycleDay": 1
}'If the request succeeds, you will get a response similar to the following snippet:
{
"success": true,
"accountId": "8ad087d290a5e7330190b989ca221bac",
"accountNumber": "A00024362",
"billToContactId": "8ad087d290a5e7330190b989ca961bad",
"soldToContactId": "8ad087d290a5e7330190b989cb1f1baf"
}