In order to create a new subscription using API you need 2 information:
subscriptionId
: You can learn subscriptionId from customers page.
cancellationType
: You have to send type of cancellation. There are two type of cancellation;
You see the cancel time in simple response below. System let you know to when subscription will end completely.
Method: PUT
Path: /api/subscriptions/cancel
Sandbox Url: https://sandbox.subscreasy.com/api/subscriptions/cancel
For security reasons, this service requires API authorization. Click for details about API authorization.
Curl
curl -X PUT https://sandbox.subscreasy.com/api/subscriptions/cancel \
-H 'Accept: application/json' -H 'Content-Type: application/json' -H 'Cache-Control: no-cache' \
-H 'Authorization: Apikey brs-1234567890' \
-d '{
"subscriptionId": 3,
"cancellationType": 1
}'
C#
var client = new RestClient("https://sandbox.subscreasy.com/api/subscriptions/cancel");
var request = new RestRequest(Method.PUT);
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Authorization", "Apikey brs-1234567890");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddParameter("undefined", "{ \"subscriptionId\": \"3\", \"cancellationType\": \"1\" }}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
JSON
{
"subscriptionId": 3,
"cancellationType": 1
}
{
"id": 3,
"status": "ACTIVE",
"paymentMethod": "CC",
"startDate": "2021-03-24T14:26:58+03:00",
"termStartDate": "2021-03-24T14:26:58+03:00",
"termEndDate": "2021-04-24T14:26:58+03:00",
"endDate": "2021-09-24T14:26:58+03:00",
"cancelDate": "2021-04-24T14:26:58+03:00",
"subscriber": {
"id": 1,
"name": "John",
"surname": "Doe"
},
"offer": {
"id": -1,
"secureId": "asd-011",
"name": "6 aylık paket",
"price": 11,
"currency": "TRY",
"openEnded": false,
"multiplePurchase": false,
"recurrenceCount": 6,
"recurrence": {
"id": 5,
"recurrenceType": "MONTHLY",
"length": 1
},
"disablePaymentForm": false,
"physicalProduct": false,
"renewalBillcycleBased": false
},
"lastEvent": "ENDOFPERIOD_CANCELLATION_REQUESTED",
"company": {
"id": -2
},
"card": {
"id": 1,
"cardAlias": "Halk Bankası",
"binNumber": "5528-79xx-xxxx-xxxx"
},
"services": []
}