Skip to main content
POST
/
api
/
v1
/
subscriptions
/
{subscription_id}
/
cancel
{
  "id": "<string>",
  "object": "subscription",
  "customer": "<string>",
  "store_id": "<string>",
  "currency": "<string>",
  "description": "<string>",
  "status": "incomplete",
  "items": [
    {
      "id": "<string>",
      "price_data": {
        "id": "<string>",
        "currency": "<string>",
        "product": "<string>",
        "unit_amount": 123,
        "recurring": {
          "interval": "day",
          "interval_count": 123
        }
      },
      "quantity": 2,
      "metadata": {}
    }
  ],
  "payment_method_id": "<string>",
  "billing_cycle_anchor": 123,
  "current_period_start": 123,
  "current_period_end": 123,
  "canceled_at": 123,
  "cancel_at": 123,
  "latest_invoice": "<string>",
  "latest_invoice_object": {
    "id": "<string>",
    "object": "invoice",
    "subscription_id": "<string>",
    "customer": "<string>",
    "amount_due": 123,
    "amount_paid": 123,
    "amount_remaining": 123,
    "currency": "<string>",
    "status": "open",
    "payment_status": "pending",
    "billing_reason": "<string>",
    "period_start": 123,
    "period_end": 123,
    "created": 123,
    "frequency": "<string>",
    "recurring_interval": "day",
    "recurring_interval_count": 123,
    "payment_id": "<string>",
    "paid_at": 123,
    "due_date": 123
  },
  "customer_object": {
    "id": "<string>",
    "object": "customer",
    "merchant_id": "<string>",
    "external_customer_id": "<string>",
    "email": "jsmith@example.com",
    "name": "<string>",
    "phone": "<string>",
    "default_payment_method": "<string>",
    "description": "<string>",
    "created": 123
  },
  "payment_method_object": {
    "id": "<string>",
    "object": "payment_method",
    "customer": "<string>",
    "merchant_id": "<string>",
    "type": "<string>",
    "currency": "<string>",
    "chain_type": 123,
    "status": "active",
    "mandate_id": "<string>",
    "metadata": {},
    "created": 123
  },
  "checkout_url": "<string>",
  "metadata": {},
  "created": 123
}

Documentation Index

Fetch the complete documentation index at: https://docs.stablepayfi.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer API Key, for example Bearer sk_live_xxx.

X-StablePay-Timestamp
string
header
required

Unix timestamp in seconds. Must be within 5 minutes of server time.

X-StablePay-Nonce
string
header
required

Replay-protection nonce, 16-64 characters. Use a fresh UUID per request.

X-StablePay-Signature
string
header
required

Lowercase hex HMAC-SHA256 of {timestamp}.{nonce}.{requestBody} signed with the merchant API Secret. For GET requests, requestBody is an empty string.

Headers

X-StablePay-Timestamp
string
required

Unix timestamp in seconds. Must be within 5 minutes of server time.

X-StablePay-Nonce
string
required

Replay-protection nonce, 16-64 characters. Use a fresh UUID per request.

Required string length: 16 - 64
X-StablePay-Signature
string
required

Lowercase hex HMAC-SHA256 of {timestamp}.{nonce}.{requestBody} signed with the merchant API Secret. For GET requests, requestBody is an empty string.

Path Parameters

subscription_id
string
required

Subscription ID.

Body

application/json
cancel_at_period_end
boolean
default:false

Whether to cancel at the end of the current billing period. Defaults to false for immediate cancellation.

cancellation_reason
string

Cancellation reason.

cancellation_comment
string

Cancellation comment.

Response

Canceled successfully.

Subscription object.

id
string

Subscription ID.

object
string
Example:

"subscription"

customer
string

External customer ID.

store_id
string

Store ID.

currency
string

Currency.

description
string

Subscription description.

status
enum<string>

Subscription status.

Available options:
incomplete,
trialing,
active,
past_due,
canceled,
incomplete_expired
items
object[]

Subscription items.

payment_method_id
string

Default payment method ID.

billing_cycle_anchor
integer<int64>

Billing cycle anchor, Unix seconds.

current_period_start
integer<int64>

Current period start, Unix seconds.

current_period_end
integer<int64>

Current period end, Unix seconds.

canceled_at
integer<int64>

Cancellation time, Unix seconds.

cancel_at
integer<int64>

Scheduled cancellation time, Unix seconds.

latest_invoice
string

Latest invoice ID.

latest_invoice_object
object

Full invoice object returned when expand=latest_invoice.

customer_object
object

Full customer object returned when expand=customer.

payment_method_object
object

Full payment method object returned when expand=payment_method.

checkout_url
string

Initial-payment checkout URL, returned on creation.

metadata
object

Merchant metadata.

created
integer<int64>

Creation time, Unix seconds.

Last modified on April 30, 2026