After end customers enter the payment method information in the Payment Form, the order is created when they click Pay Now. If the subscription is created and the payment is successfully collected, an invoice is generated with a zero balance that you can choose to send to the customer using their bill-to contact.
The following sample code creates an order with the following information:
existingAccountNumber: A00024362 (obtained from the "Create a billing account" section)subscribeToRatePlans:productRatePlanNumber: PRP-00000180 (obtained from the "Show specific product details" section)productRatePlanId:8a90a9b784ae5f180184c6c4650446a1
orderDate: Today's date (assuming that today is 2025-01-01).processingOptions:runBilling:true. It means that the invoice is generated while the subscription is created.collectPayment:true. Collects the payment when the invoice is generated.targetDate: the same as theorderDate. The invoice is generated and posted on the same day the order is created.
cURL
curl -L -X POST 'https://rest.test.zuora.com/v1/orders' \
-H 'Authorization: Bearer 82db6bcc9b384c159a37262795f12a0a' \
-H 'Content-Type: application/json' \
-d '{
"orderDate": "2025-01-01",
"processingOptions": {
"runBilling": true,
"collectPayment": true,
"billingOptions": {
"targetDate": "2025-01-01"
}
},
"existingAccountNumber": "A00024362",
"subscriptions": [
{
"orderActions": [
{
"type": "CreateSubscription",
"createSubscription": {
"terms": {
"initialTerm": {
"termType": "EVERGREEN"
}
},
"subscribeToRatePlans":[
{
"productRatePlanNumber": "PRP-00000180"
}
]
}
}
]
}
]
}'If the request succeeds, you will get a response similar to the following snippet:
{
"success": true,
"orderNumber": "O-00000047",
"accountNumber": "A00024362",
"status": "Completed",
"subscriptionNumbers": [
"A-S00000031"
],
"invoiceNumbers": [
"INV00000041"
]
}