Edit this Page

Abonelik İptal

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 is two type of cancellation;
    1. IMMEDIATE: It instantly cancels the subscription.
    2. END_OF_PERIOD: Subscription cancellation request is received, but is not applied immediately. Subscription cancellation occurs at the end of the term. (Monthly subscription expires at the end of the month)

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.

 Sample Request

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
}
 Sample Response
{
    "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": []
}