Skip to Content
Docs
Subscriptions

Withdraw from a subscription

POST/subscriptions/{subscription_id}/withdraw

Where the law gives the customer a right to withdraw, ends the contract immediately. The subscription moves to canceled with cancellation_reason: withdrawn, and returns withdrawal_charge and refund_due_by. Pay.com never collects a withdrawal charge automatically. After withdrawal_ends_at, this returns 422 with withdrawal_period_ended.

Headers

AuthorizationstringRequired
HTTP Basic auth: your API key as the password, with an empty username. See Authentication.
idempotency-keystring

A unique key, such as a UUID, that makes a POST safe to retry. Pay.com keeps each key for 24 hours, separately for each workspace. A retry with the same key, endpoint and body gets the first response. Another endpoint or body gets 400 idempotency_error, and a retry while the first is running gets 409.

Path parameters

subscription_idstringRequired

The subscription's ID (sub_).

Parameters

sent_atstringRequired

When the customer sent the withdrawal. It counts for the deadline.

Returns

The ended subscription.

idstring
resourcestring
versioninteger

Goes up by one with every change. Events carry it, so you can skip one older than one you've processed.

statusstring

One of draft, trialing, active, unpaid, paused, canceled or failed.

customerstring
customer_reference_idstring
referencestring or null
itemsarray of objects
Show 5 child attributesHide child attributes
idstring

The item (subitem_).

pricestring
price_versioninteger

The version it was sold at.

productstring
quantityinteger
Show 24 more attributesShow fewer attributes
currencystring

Three-letter ISO currency code, in lowercase.

current_period_startstring
current_period_endstring
trial_endstring or null
cancel_atstring or null
canceled_atstring or null
cancellation_reasonstring or null

One of requested, ended, withdrawn, payment_failed or dispute.

payment_methodstring or null
seller_of_recordobject

Who sells: you, or Pay.com as merchant of record. Fixed when the customer pays, and never changed on renewal.

Show 2 child attributesHide child attributes
typestring

pay_com comes with merchant of record.

One of merchant or pay_com.

entitystring

The selling legal entity (ent_).

engineobject
Show 5 child attributesHide child attributes
typestring
connectionstring or null
collection_modelstring

One of native, directed, handoff, engine_gateway, merchant_scheduled or mirror.

externalobject or null
Show 3 child attributesHide child attributes
customerstring
subscriptionstring
statusstring
syncobject
Show 2 child attributesHide child attributes
statusstring

One of in_sync or failed.

last_synced_atstring or null
responsibilitiesobject

Who owns each job. Exactly one owner each, so it's always clear which system charged a customer.

Show 5 child attributesHide child attributes
schedulerstring

One of pay_com, engine, merchant or outside.

collectorstring

One of pay_com, engine, merchant or outside.

dunningstring

One of pay_com, engine, merchant or outside.

invoice_issuerstring

One of pay_com, engine, merchant or outside.

taxstring

One of pay_com, engine, merchant or outside.

processorobject

Where the subscription's payments are processed. It stays within the seller: Pay.com sells only on accounts it controls.

Show 4 child attributesHide child attributes
servicestring

acquiring for Pay.com Acquiring, orchestration for one of your own processors.

One of acquiring or orchestration.

account_ownerstring

One of pay_com or merchant.

settlement_accountstring or null

Your settlement account the payments go to. null when Pay.com sells.

providerstring or null

Your processor, with orchestration. Otherwise null.

accessobject

Access is separate from payment status.

Show 2 child attributesHide child attributes
statusstring

One of pending, granted, grace or revoked.

ends_atstring or null
next_paymentobject or null
Show 4 child attributesHide child attributes
amountinteger
currencystring
due_onstring
cancel_byobject

Canceling before at stops this charge. Show last_day in time_zone. Never work a date out on the screen.

Show 3 child attributesHide child attributes
atstring
last_daystring
time_zonestring
price_changeobject or null
Show 5 child attributesHide child attributes
pricestring
versioninteger
amountinteger
currencystring
due_onstring
latest_invoiceobject or null
Show 5 child attributesHide child attributes
idstring or null
external_idstring or null
numberstring or null
statusstring
issuerstring

One of pay_com, engine or merchant.

withdrawal_ends_atstring or null
withdrawal_chargeobject or null
Show 3 child attributesHide child attributes
amountinteger
currencystring
statusstring

One of none, owed, kept, paid or waived.

refund_due_bystring or null
last_failureobject or null
Show 2 child attributesHide child attributes
categorystring
retryableboolean
metadataobject

Your key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.

createdstring
test_modeboolean

Errors

400
The request is invalid.
401
The API key is missing or wrong.
403
The key's permissions don't allow this route.
404
No such object in this workspace and environment.
422
The request is valid but can't be done. Codes include: - amount_mismatch: amount doesn't equal the line items' total. - price_inactive, product_inactive: an item can't be sold. - currency_mismatch: the items or rates use different currencies. - no_shipping_rate: an item ships and no active rate covers the session's currency. - checkout_not_open: the session is completed or expired. - order_not_refundable: the order is fully refunded, or under a dispute. - amount_exceeds_refundable: more than what's left to refund. - quantity_exceeds_refundable: more of an item than was sold and not yet refunded. - order_not_shippable: shipped_at was sent for an order with nothing that ships. - shipping_rate_inactive: a rate in shipping_options is archived. - tax_exceeds_amount: inclusive tax figures are more than an item's amount. - refund_failed: the payment method refused the refund. Nothing was refunded. - custom_css_not_approved: the draft's changed custom CSS isn't approved yet. - default_profile: your default design profile can't be archived. - profile_not_published: the design profile has nothing published yet, so sessions and links can't use it and it can't be your default. - profile_archived: the design profile is archived, so new sessions and links can't use it and it can't be your default. - display_name_required: the draft to publish has no display_name. - low_contrast: white text on colors.accent, or colors.text on colors.background, is under 4.5:1. - number_in_use: the next number is one the series has already used. - tax_rate_required: a subscription sent with your own tax figures has a tax_breakdown entry without a percentage_decimal or a flat_amount, so it can't be applied to renewals. - seller_engine_conflict: the request names an external engine for a sale that can resolve to Pay.com as seller. - engine_not_allowed_for_seller: the engine can't run a subscription this seller sells. - processor_not_allowed_for_seller: Pay.com sells only on accounts it controls, and the processor isn't one of them. - engine_capability_missing: the engine or its connection can't do what the request needs. - connection_not_ready: the engine's connection isn't connected, or needs action. - product_refused: a product failed review for merchant of record, and you can't sell it yourself in this request. Subscription and seller refusals come at creation, never at renewal.
Was this page helpful?