Skip to main content
POST
/
v1
/
subscriptions
/
{subscriptionId}
/
{action}
TypeScript SDK
import { Solifyn } from 'solifyn';

const solifyn = new Solifyn({ apiKey: 'your_private_api_key_here' });

// Execute actions: 'pause' | 'resume' | 'cancel' | 'uncancel'
const response = await solifyn.subscriptions.executeAction(
  'sub_019e56a1...',
  'cancel'
);
console.log('Subscription Action Result:', response);
{
  "id": "mem_123",
  "status": "active",
  "created_at": "2025-01-01T12:00:00.000Z",
  "joined_at": "2025-01-01T12:00:00.000Z",
  "updated_at": "2025-01-01T12:00:00.000Z",
  "manage_url": "https://example.com/billing/manage/mber_123",
  "member": {
    "id": "mber_123"
  },
  "user": {
    "id": "user_123",
    "username": "johndoe",
    "name": "John Doe",
    "email": "john.doe@example.com"
  },
  "renewal_period_start": null,
  "renewal_period_end": null,
  "cancel_at_period_end": false,
  "cancel_option": null,
  "cancellation_reason": null,
  "canceled_at": null,
  "currency": "usd",
  "company": {
    "id": "biz_123",
    "title": "Company Name"
  },
  "plan": {
    "id": "plan_123",
    "metadata": {}
  },
  "promo_code": null,
  "product": {
    "id": "prod_123",
    "title": "Product Name",
    "metadata": {}
  },
  "license_key": null,
  "metadata": {
    "is_usage_based": "false"
  },
  "payment_collection_paused": false,
  "checkout_configuration_id": "ch_123",
  "price": 99,
  "type": "renewal",
  "customerId": "cust_123"
}

Authorizations

Authorization
string
header
required

Authenticate requests using your standard bearer API key (e.g. YOUR_API_KEY).

Path Parameters

subscriptionId
string
required

The customer subscription ID

Example:

"mem_123"

action
enum<string>
required

The subscription task to execute

Available options:
add_free_days,
cancel,
pause,
resume,
uncancel,
adjust_seats

Body

application/json
free_days
number

Number of free days to add (used with action: add_free_days)

Required range: 1 <= x <= 3650
Example:

30

cancellation_mode
enum<string>

Cancellation mode (used with action: cancel)

Available options:
immediate,
at_period_end
Maximum string length: 50
Example:

"immediate"

void_payments
boolean

Whether to void subsequent payments (used with action: pause)

Example:

true

addonProductId
string

ID of the addon product to adjust seats for (used with action: adjust_seats)

Example:

"prod_seat_123"

newQuantity
number

The new seat quantity (used with action: adjust_seats)

Required range: x >= 0
Example:

5

prorationType
enum<string>

Proration strategy mode (used with action: adjust_seats)

Available options:
prorated_immediately,
full_immediately,
difference_immediately,
do_not_bill
Example:

"do_not_bill"

idempotencyKey
string

A unique idempotency key to prevent duplicate mutative actions for network transient retries.

Maximum string length: 100
Example:

"sub_action_idem_123"

Response

201 - application/json

Subscription action processed successfully.

Represents a customer subscription membership resource, containing current billing terms, plan, status, and metadata.

id
string
required

The unique ID of the subscription

Example:

"mem_123"

status
string
required

The status of the subscription (e.g. completed, active, trialing, past_due, canceled)

Example:

"active"

created_at
string<date-time>
required

Timestamp when the subscription was created

Example:

"2025-01-01T12:00:00.000Z"

joined_at
string<date-time>
required

Timestamp when the member joined

Example:

"2025-01-01T12:00:00.000Z"

updated_at
string<date-time>
required

Timestamp when the subscription was last updated

Example:

"2025-01-01T12:00:00.000Z"

manage_url
string
required

The management URL for the billing/subscription

Example:

"https://example.com/billing/manage/mber_123"

member
object
required

The member details

user
object
required

The user details

renewal_period_start
object
required

Start timestamp of the current renewal period

Example:

null

renewal_period_end
object
required

End timestamp of the current renewal period

Example:

null

cancel_at_period_end
boolean
required

Whether the subscription is set to cancel at the end of the billing period

Example:

false

cancel_option
object
required

The cancel option details

Example:

null

cancellation_reason
object
required

The reason for cancellation

Example:

null

canceled_at
object
required

Timestamp when the subscription was canceled

Example:

null

currency
string
required

The currency used for payments

Example:

"usd"

company
object
required

The company context details

plan
object
required

The plan associated with this subscription

promo_code
object
required

The promo code applied to the subscription

Example:

null

product
object
required

The product associated with the subscription

license_key
object
required

The license key associated with this subscription

Example:

null

metadata
object
required

Additional metadata for the subscription

Example:
{ "is_usage_based": "false" }
payment_collection_paused
boolean
required

Whether the payment collection is currently paused

Example:

false

checkout_configuration_id
string
required

The checkout configuration ID used

Example:

"ch_123"

price
object

The price/amount of the membership

Example:

99

type
object

The type of the membership plan

Example:

"renewal"

customerId
object

The business customer ID

Example:

"cust_123"