API Subscribe
Pre-requisite: have an existing offer in the catalogue
On this page, you will learn to subscribe a customer to an offer.
Step 1: Generate an OAuth token
See Create an OAuth token for details.
Step 2: Create the order
create a subscription to be named
CLASSIC-C00-SU
from offerOF_REC
ontainingPR_REC_MONTHLY_1ST
andPR_OSS_SUBSCRIPTION_FEE
POST {{opencell.url}}/billing/subscription/subscribeAndInstantiateProducts
CODE
{
"code": "{{subscription.code}}",
"description": "Subscription {{subscription.code}} to {{offer.code}}",
"userAccount": "{{account.code}}",
"offerTemplate": "OF_REC",
"seller": "{{seller}}",
"subscriptionDate": "{{subscription.date}}",
"terminationDate": null,
"endAgreementDate": null,
"status": null,
"terminationReason": null,
"customFields": null,
"productToInstantiateDto": [
{
"productCode": "PR_REC_MONTHLY_1ST",
"quantity": 1
},
{
"productCode": "PR_OSS_SUBSCRIPTION_FEE",
"quantity": 1
}
]
}
CODE
curl --location 'https://sandbox.opencell.net/opencell/api/rest/billing/subscription/subscribeAndInstantiateProducts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{access_token}}' \
--data '{
"code": "CLASSIC-C00-SU",
"description": "Subscription CLASSIC-C00-SU to {{offer.code}}",
"userAccount": "CLASSIC-C00",
"offerTemplate": "OF_REC",
"seller": "MAIN_SELLER",
"subscriptionDate": "2022-01-01T01:23:45.678Z",
"terminationDate": null,
"endAgreementDate": null,
"status": null,
"terminationReason": null,
"customFields": null,
"productToInstantiateDto": [
{
"productCode": "PR_REC_MONTHLY_1ST",
"quantity": 1
},
{
"productCode": "PR_OSS_SUBSCRIPTION_FEE",
"quantity": 1
}
]
}'