XM

Create Subscriptions

Path:

POST /data-subscription/subscriptions

This API facilitates easy creation of a new subscription based on the subscription details such as planId, itemId, quantity, etc. in the request body.

Headers

Content-Type : application/json

Authorization: JWT Token

x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox"

Parameters

Type : body

Name : Subscription details

Required: true

Sample Path

https://{baseurl}/data-subscription/subscriptions

Sample Request

{
"planID": "6069ad22b68b21000ab1b046",
"itemID": "1000000058",
"quantity": 3,
"customerEmail": "[email protected]",
"status": "ACTIVE",
"paymentMethod": "pm_1ISekkETggmgrCy2b7osIpl8",
"customerReferenceId": "606efb7ec042330007b48447",
"orderReferenceId": "5082-5948-21691",
"shippingCost": 2,
"customerFullName": "test",
"discount": 2,
"tax": 2,
"shipTo": {
"shipToId":"testShip",
"name": {
"firstName": "test IQBAR",
"middleName": "",
"lastName": "test"
},
"streetAddress": {
"street1": "185-S QA Estate",
"street2": ""
},
"city": "Lahore",
"state": "Punjab",
"zipCode": "a1a1a1",
"country": "Pakistan"
},
"billTo": {
"billToId":"testBill",
"name": {
"firstName": "test bill",
"middleName": "",
"lastName": "test"
},
"streetAddress": {
"street1": "185-S QA Estate bill",
"street2": ""
},
"city": "Lahore",
"state": "Punjab",
"zipCode": "a1a1a1",
"country": "Pakistan"
}
}

Sample Response

Response Code: 200

Message: OK

{
"success": true,
"responseStatus": "OK",
"message": "Request processed successfully.",
"data": {
"shipTo": {
"name": {
"firstName": "test IQBAR",
"middleName": "",
"lastName": "test"
},
"streetAddress": {
"street1": "185-S QA Estate",
"street2": ""
},
"shipToId": "testShip",
"city": "Lahore",
"state": "Punjab",
"zipCode": "a1a1a1",
"country": "Pakistan"
},
"billTo": {
"name": {
"firstName": "test bill",
"middleName": "",
"lastName": "test"
},
"streetAddress": {
"street1": "185-S QA Estate bill",
"street2": ""
},
"billToId": "testBill",
"city": "Lahore",
"state": "Punjab",
"zipCode": "a1a1a1",
"country": "Pakistan"
},
"paymentDetails": {
"processor": "stripe"
},
"_id": "6089337f982e030009d7925e",
"isDeleted": false,
"deletedAt": null,
"planID": "6069ad22b68b21000ab1b046",
"itemID": "1000000058",
"priceListID": "100024",
"quantity": 3,
"customerID": "606efdc83bf07b0009bb92e7",
"frequency": 4,
"frequencyType": "Weekly",
"merchantAccount": "5fc78dfc6135050007191290",
"status": "ACTIVE",
"lastOrderReferenceId": "5082-5948-21691",
"cancellationReason": "",
"discount": 10,
"tax": 2,
"shippingCost": 2,
"paymentMethod": "pm_1ISekkETggmgrCy2b7osIpl8",
"lastPaymentDate": "2021-04-28T10:05:51.669Z",
"nextPaymentDate": "2021-05-26T10:05:51.667Z",
"createdAt": "2021-04-28T10:05:51.683Z",
"updatedAt": "2021-04-28T10:05:51.683Z",
"__v": 0
}
}

Response Code: 404

Message: Not in stock

Change Log

  • April-2021 first updated

‚Äč