Create Subscriptions

In this guide, you will learn:

  • How to create a subscription through the "Create an order" operation

Step 1. Generate an OAuth token

See Create an OAuth token for details.

Step 2. Create a subscription

The following cURL code sample creates a subscription to the product rate plan efbff07e6290dfb8016291003bd00dda. The subscription is effective from 2022-01-01, and the initial term is 12 months.

Copy
Copied
curl --location --request POST 'https://rest.zuora.com/v1/orders' \
--header 'Authorization: Bearer e05fd08c256b4dd78c0eca181208dd16' \
--header 'Content-Type: application/json' \
--data-raw '{
    "description": "This is a description for the Order.",
    "existingAccountNumber": "A00000001",
    "orderDate": "2022-01-01",
    "orderNumber": "OM-00001",
    "processingOptions": {
        "collectPayment": true,
        "runBilling": true
    },
    "subscriptions": [
        {
            "orderActions": [
                {
                    "createSubscription": {
                        "billToContactId": "efbff07e6290dfb8016291003bd00dda",
                        "invoiceTemplateId": "2c9081a03c638994013c63978baf002b",
                        "paymentTerm": "Net 30",
                        "sequenceSetId": "6abcc30846de11e990900242ac1f0003",
                        "subscribeToRatePlans": [
                            {
                                "productRatePlanId": "efbff07e6290dfb8016291003bd00dda"
                            }
                        ],
                        "subscriptionNumber": "SM-00001",
                        "terms": {
                            "autoRenew": true,
                            "initialTerm": {
                                "period": 12,
                                "periodType": "Month",
                                "startDate": "2022-01-01",
                                "termType": "TERMED"
                            },
                            "renewalSetting": "RENEW_WITH_SPECIFIC_TERM",
                            "renewalTerms": [
                                {
                                    "period": 12,
                                    "periodType": "Month"
                                }
                            ]
                        }
                    },
                    "triggerDates": [
                        {
                            "name": "ContractEffective",
                            "triggerDate": "2022-01-01"
                        }
                    ],
                    "type": "CreateSubscription"
                }
            ]
        }
    ]
}'

Step 3. Verify the result

After the process is done, you can verify the result in the Zuora UI or through the GET API operations for the Orders object. To verify the result through the Zuora UI, you can find the subscriptions you just created displayed at the top of the All Subscriptions page by navigating to Customers > Subscriptions in the Zuora UI. To verify the result through the API, See Retrieve Object Information for details.

Additional Information

You can use this operation to create subscriptions and make changes to subscriptions by creating orders. You can also use this operation to create order line items by creating orders.

To learn more use cases using the "Create an order" operation, see the following articles: