π΄DELETE
Last updated
Last updated
Cancels a specific subscription contract by setting its status to "CANCELLED". This endpoint also triggers configured integration actions, such as sending a cancellation email via Klaviyo.
The unique identifier of the subscription contract to be canceled.
Successfully canceled the subscription contract. Returns information about the canceled subscription and any integration actions triggered.
const response = await fetch('http://localhost:3002/subscriptions/{contractId}?shop=text', {
method: 'DELETE',
headers: {},
});
const data = await response.json();
{
"success": false,
"data": {
"id": "text",
"failedBillingCount": 0,
"subscriptionTotal": 0,
"draft": false,
"createdAt": "text",
"notification_at": "2024-11-09T23:36:19.339Z",
"notified": false,
"billingInterval": "text",
"billingIntervalCount": 0,
"maxCycles": 0,
"isPrepaid": false,
"minCycles": 0,
"billingAnchorType": "text",
"billingAnchorDay": 0,
"billingAnchorMonth": 0,
"currencyCode": "text",
"customer": {
"id": "text",
"addresses": [
{
"id": "text",
"address1": "text",
"address2": "text",
"city": "text",
"company": "text",
"country": "text",
"countryCodeV2": "text",
"firstName": "text",
"lastName": "text",
"phone": "text",
"province": "text",
"provinceCode": "text",
"zip": "text"
}
],
"tags": [
"text"
],
"firstName": "text",
"lastName": "text",
"email": "text",
"phone": "text",
"state": "text",
"createdAt": "text",
"imageUrl": "text"
},
"deliveryPrice": 0,
"customAttributes": [
{
"key": "text",
"value": "text"
}
],
"orderIds": [
"text"
],
"status": "text",
"shop": "text",
"lines": [
{
"id": "text",
"sku": "text",
"title": "text",
"productId": "text",
"variantId": "text",
"variantTitle": "text",
"sellingPlanName": "text",
"displayName": "text",
"sellingPlanId": "text",
"taxable": false,
"handle": "text",
"variantImage": {
"url": "text"
},
"currentPrice": {
"amount": "text",
"currencyCode": "text"
},
"lineDiscountedPrice": {
"amount": "text",
"currencyCode": "text"
},
"requiresShipping": false,
"customAttributes": [
{
"key": "text",
"value": "text"
}
],
"discountAllocations": [
{
"amount": {
"amount": "text",
"currencyCode": "text"
},
"discount": "text"
}
],
"pricingPolicy": {
"basePrice": {
"amount": "text",
"currencyCode": "text"
},
"cycleDiscounts": [
{
"adjustmentType": "text",
"adjustmentValue": {
"SellingPlanPricingPolicyPercentageValue": {
"percentage": "text"
}
},
"afterCycle": 0,
"computedPrice": {
"amount": "text",
"currencyCode": "text"
}
}
]
}
}
],
"addons": [
{
"id": "text",
"sku": "text",
"title": "text",
"productId": "text",
"variantId": "text",
"variantTitle": "text",
"sellingPlanName": "text",
"displayName": "text",
"sellingPlanId": "text",
"taxable": false,
"handle": "text",
"variantImage": {
"url": "text"
},
"currentPrice": {
"amount": "text",
"currencyCode": "text"
},
"lineDiscountedPrice": {
"amount": "text",
"currencyCode": "text"
},
"requiresShipping": false,
"customAttributes": [
{
"key": "text",
"value": "text"
}
],
"discountAllocations": [
{
"amount": {
"amount": "text",
"currencyCode": "text"
},
"discount": "text"
}
],
"pricingPolicy": {
"basePrice": {
"amount": "text",
"currencyCode": "text"
},
"cycleDiscounts": [
{
"adjustmentType": "text",
"adjustmentValue": {
"SellingPlanPricingPolicyPercentageValue": {
"percentage": "text"
}
},
"afterCycle": 0,
"computedPrice": {
"amount": "text",
"currencyCode": "text"
}
}
]
}
}
],
"deliveryMethod": {
"shippingOption": {
"code": "text",
"description": "text"
}
},
"originOrder": {
"id": "text",
"legacyResourceId": "text",
"name": "text",
"createdAt": "text",
"amount": "text"
}
}
}