Skip to main content

Manage subscriptions

Update, cancel, resume, and list subscriptions using the Subscriptions API.

Retrieve a subscription

GET /api/v1/subscriptions/:id

Returns the full subscription object. Use this to check status, current_period_end, latest_payment_link, and (for auto_charge) auto_charge details.

Example:

curl https://api.orcarail.com/api/v1/subscriptions/sub_550e8400e29b41d4a716446655440000 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"

List subscriptions

GET /api/v1/subscriptions

Supports cursor-based pagination and filters.

Query parameters

ParameterTypeDescription
statusstringFilter by status: trialing, active, past_due, canceled, paused, completed
collection_methodstringFilter by send_payment_link or auto_charge
current_period_startobjectFilter by period: gt, gte, lt, lte (ISO timestamps)
current_period_endobjectSame as above for period end
createdobjectFilter by created: gt, gte, lt, lte
limitnumberPage size (default 10, max 100)
starting_afterstringCursor: subscription ID to start after
ending_beforestringCursor: subscription ID to end before

Example:

curl "https://api.orcarail.com/api/v1/subscriptions?status=active&limit=20" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"

Response shape:

{
"object": "list",
"data": [ { ... subscription objects ... } ],
"has_more": false
}

Update a subscription

PATCH /api/v1/subscriptions/:id

Partial update. Only send fields you want to change.

Updatable fields

ParameterTypeDescription
descriptionstringSubscription description
amountstringNew amount per period
currencystringCurrency code
token_idstringToken ID
network_idstringNetwork ID
collection_methodstringsend_payment_link or auto_charge
cancel_atstring | nullISO timestamp to cancel at, or null to clear
cancel_at_period_endbooleanCancel at end of current period
days_until_duenumberDays after period end until overdue
trial_endstringWhen trial ends (ISO or "now")
metadataobjectKey-value metadata
withdrawal_addressesobjectChain type → address
pause_collectionobject | null{ "behavior": "void" | "keep_as_draft" } to pause; null to resume

Example (cancel at period end):

curl -X PATCH https://api.orcarail.com/api/v1/subscriptions/sub_xxx \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "cancel_at_period_end": true }'

Example (pause collection):

{
"pause_collection": { "behavior": "void" }
}

Cancel a subscription

DELETE /api/v1/subscriptions/:id

Cancel immediately or at period end (if you previously set cancel_at_period_end). Request body is optional.

Cancel body (optional)

ParameterTypeDescription
cancellation_detailsobjectOptional feedback
cancellation_details.commentstringFree-text comment
cancellation_details.feedbackstringOne of: too_expensive, missing_features, switched_service, unused, other

Example:

curl -X DELETE https://api.orcarail.com/api/v1/subscriptions/sub_xxx \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"cancellation_details": {
"comment": "Switching to annual",
"feedback": "other"
}
}'

Resume a subscription

POST /api/v1/subscriptions/:id/resume

Resumes a paused subscription. No body required. After resume, the subscription returns to active and the next cycle will create a payment link or run auto-charge as configured.

Example:

curl -X POST https://api.orcarail.com/api/v1/subscriptions/sub_xxx/resume \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
GET /api/v1/subscriptions/:id/payment-links

Returns payment links (one per billing cycle) for this subscription. Supports pagination (e.g. limit, starting_after, ending_before). Use this to show cycle history or link status per period.

Example:

curl "https://api.orcarail.com/api/v1/subscriptions/sub_xxx/payment-links?limit=10" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"

Next steps