v20

latestOpenAPI 3.0.0raw.githubusercontent.com2026-07-214885191.3 KB
Purchases

Cancel a purchase

Cancels an active purchase. For recurring purchases, cancellation takes effect at the end of the current billing period.

post/v1/sdk/purchases/{purchaseRef}/cancel

Path parameters

purchaseRefstring required
Example:pur_1A2B3C4D

Purchase reference or ID

Request body

reasonstring

Response

Purchase cancelled successfully

successboolean

Example response

{
  "purchase": {
    "amount": 9900,
    "currency": "GBP",
    "customerEmail": "customer@example.com",
    "customerRef": "cus_3C4D5E6F",
    "exchangeRate": 1.3082,
    "isRecurring": true,
    "originalAmount": 10000,
    "planSnapshot": {
      "billingCycle": "monthly",
      "creditsPerUnit": 1,
      "currency": "USD",
      "freeUnits": 100,
      "limit": 5000,
      "meterRef": "mtr_1A2B3C4D",
      "name": "Pro Monthly",
      "planType": "recurring",
      "price": 2999,
      "reference": "pln_1A2B3C4D"
    },
    "productName": "API Gateway Manager",
    "productRef": "prd_1A2B3C4D",
    "reference": "pur_1A2B3C4D",
    "status": "active",
    "usage": {
      "periodEnd": "2025-11-01T00:00:00Z",
      "periodStart": "2025-10-01T00:00:00Z",
      "used": 150
    }
  }
}