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.
- Determine the values of the following variables:
Variable
Description
$AccountNumThe 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
newAccountfield instead of theexistingAccountNumberfield.$productRatePlanIdThe ID of the product rate plan to subscribe to. For example,
2c92c0f85e5019d7015e513826e650f7.$TodayToday's date. For example,
2017-09-30. - Use the "Create an order" operation to create an order:
- 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 } } - 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" } }
When using the Create Subscription order actions, you can create new sold-to and ship-to contacts in the newSubscriptionOwnerAccount section directly in the REST API order request:
- Using an existing account without creatjng new contacts for the new subscription:
- Use the "Create an order" operation to create an order. You can create new sold-to and ship-to contacts in the newSubscriptionOwnerAccount section directly in the REST API order request:
Request
POST /v1/orders/Request Body
{ "orderNumber": "O-example-004", "orderDate": "2025-01-15", "subscriptions": [ { "orderActions": [ { "type": "CreateSubscription", "triggerDates": [ { "name": "ContractEffective", "triggerDate": "2025-01-15" }, { "name": "ServiceActivation", "triggerDate": "2025-01-15" }, { "name": "CustomerAcceptance", "triggerDate": "2025-01-15" } ], "createSubscription": { "subscriptionNumber": "S-example-004", "newSubscriptionOwnerAccount": { "accountNumber": "NewAcct-004", "name": "Acme Corporation", "currency": "USD", "billCycleDay": "1", "batch": "Batch1", "soldToContact": { "firstName": "John", "lastName": "Sales", "workEmail": "sales@acmecorp.com", "workPhone": "+1-555-987-6543", "state": "New York", "country": "United States" }, "shipToContact": { "firstName": "Mike", "lastName": "Shipping", "workEmail": "shipping@acmecorp.com", "workPhone": "+1-555-456-7890", "state": "Texas", "country": "United States" } }, "terms": { "initialTerm": { "termType": "TERMED", "startDate": "2025-01-15", "period": 12, "periodType": "Month" }, "renewalTerms": [ { "period": 12, "periodType": "Month" } ], "renewalSetting": "RENEW_WITH_SPECIFIC_TERM", "autoRenew": true }, "subscribeToRatePlans": [ { "productRatePlanId": "<your-product-rate-plan-id>", "chargeOverrides": [ { "productRatePlanChargeId": "<your-prpc-id>", "pricing": { "recurringFlatFee": { "listPrice": "150.00" } } } ] } ] } } ] } ], "processingOptions": { "runBilling": false, "collectPayment": false } }
To preview invoices for the new subscription, use the Preview order operation.