Welcome to Zuora Product Documentation

Explore our rich library of product information

Create a subscription using the REST API

Learn how to create a subscription using the REST API by utilizing the "Create an order" operation.

You can use the Create an order operation to create a subscription.

Before the Orders feature is enabled, you would have used the "Create subscription", "Subscribe", or "Create account" operation.

  1. Determine the values of the following variables:

    Variable

    Description

    $AccountNum

    The number of the account that will own the order and the subscription. For example, A00000001 .

    To create the order under a new account instead of an existing account, specify the newAccount field instead of the existingAccountNumber field.

    $productRatePlanId

    The ID of the product rate plan to subscribe to. For example, 2c92c0f85e5019d7015e513826e650f7 .

    $Today

    Today's date. For example, 2017-09-30 .

  2. Use the "Create an order" operation to create an order:
    1. Using an existing account without creatjng new contacts for the new subscription:

      Request

      POST /v1/orders/

      Request Body

      {
        "orderDate": "$Today",
        "existingAccountNumber": "$AccountNum",
        "subscriptions": [
          {
            "orderActions": [
              {
                "type": "CreateSubscription",
                "triggerDates": [
                  {
                    "name": "ContractEffective",
                    "triggerDate": "$Today"
                  },
                  {
                    "name": "ServiceActivation",
                    "triggerDate": "$Today"
                  },
                  {
                    "name": "CustomerAcceptance",
                    "triggerDate": "$Today"
                  }
                ],
                "createSubscription": {
                  "terms": {
                    "initialTerm": {
                      "startDate": "$Today",
                      "period": 12,
                      "periodType": "Month",
                      "termType": "TERMED"
                    },
                    "renewalSetting": "RENEW_WITH_SPECIFIC_TERM",
                    "renewalTerms": [
                      {
                        "period": 12,
                        "periodType": "Month"
                      }
                    ]
                  },
                  "subscribeToRatePlans": [
                    {
                      "productRatePlanId": "$productRatePlanId"
                    }
                  ]
                }
              }
            ]
          }
        ],
        "processingOptions": {
          "runBilling": false,
          "collectPayment": false
        }
      }
    2. By creating a new account with the contact information and also creating different contact information for the new subscription.

      Request

      POST /v1/orders/

      Request Body

      {
          "orderNumber": "O-example-002",
          "orderDate": "2025-01-01",
          "newAccount": {
            "accountNumber": "NewAcct-001",
            "name": "NewAcct-001",
            "currency": "USD",
            "billCycleDay": "1",
            "batch": "Batch1",
            "billToContact": {
              "firstName": "Acct",
              "lastName": "BillTo",
              "workEmail": "newacct@test.com",
              "state": "California",
              "country": "United States"
            },
            "soldToContact": {
              "firstName": "Acct",
              "lastName": "SoldTo",
              "workEmail": "newacct2@test.com",
              "state": "California",
              "country": "United States"
            }
          },
          "subscriptions": [
            {
              "orderActions": [
                {
                  "type": "CreateSubscription",
                  "triggerDates": [
                    {
                      "name": "ContractEffective",
                      "triggerDate": "2025-01-01"
                    }
                  ],
                  "createSubscription": {
                    "subscriptionNumber": "S-example-002",
                    "terms": {
                      "initialTerm": {
                        "termType": "TERMED",
                        "startDate": "2025-01-01",
                        "period": 12,
                        "periodType": "Month"
                      },
                      "renewalTerms": [
                        {
                          "period": 12,
                          "periodType": "Month"
                        }
                      ],
                      "renewalSetting": "RENEW_WITH_SPECIFIC_TERM",
                      "autoRenew": false
                    },
                    "subscribeToRatePlans": [
                      {
                        "productRatePlanId": "<your-product-rate-plan-id>",
                        "chargeOverrides": [
                          {
                            "productRatePlanChargeId": "<your-prpc-id>",
                            "pricing": {
                              "recurringFlatFee": {
                                "listPrice": "100"
                              }
                            }
                          }
                        ]
                      }
                    ],
                    "billToContact": {
                      "firstName": "Sub",
                      "lastName": "BillTo",
                      "workEmail": "sub.billto@test.com",
                      "address1": "123 Main St",
                      "city": "San Francisco",
                      "state": "CA",
                      "country": "United States",
                      "postalCode": "94105"
                    },
                    "soldToContact": {
                      "firstName": "Sub",
                      "lastName": "SoldTo",
                      "workEmail": "sub.soldto@test.com",
                      "address1": "456 Oak Ave",
                      "city": "New York",
                      "state": "NY",
                      "country": "United States",
                      "postalCode": "10001"
                    },
                    "shipToContact": {
                      "firstName": "Sub",
                      "lastName": "ShipTo",
                      "workEmail": "sub.shipto@test.com",
                      "address1": "789 Pine Rd",
                      "city": "Seattle",
                      "state": "WA",
                      "country": "United States",
                      "postalCode": "98101"
                    }
                  }
                }
              ]
            }
          ],
          "processingOptions": {
            "runBilling": false,
            "billingOptions": {
              "targetDate": "2025-02-01"
            },
            "collectPayment": false,
            "documentDate": "2024-12-01"
          }
        }

To preview invoices for the new subscription, use the Preview order operation.