POST
/
v1
/
subscriptions
curl --request POST \
   --url https://client.corrily.com/v1/subscriptions \
   --header 'Accept: application/json' \
   --header 'Content-Type: application/json' \
   --data '
{
   "amount": 0,
   "country": "string",
   "created": 0,
   "currency": "string",
   "origin": "string",
   "origin_id": "string",
   "product": "Your product api_id",
   "status": "string",
   "user_id": "string",
   "cancel_at": 0,
   "canceled_at": 0,
   "trial_end": 0,
   "trial_start": 0
}
'
{
  "message": "[dev=False] subscription record 97#user123#stripe#origin789 was written.",
  "success": true,
  "record": {
    "origin": "stripe",
    "type": "subscription",
    "latest_event_timestamp": 1628549872,
    "latest_event_id": "corrily_evt_1628549872",
    "corrily_product_id": 122,
    "org_id": 97,
    "origin_id": "origin789",
    "user_id": "user123",
    "created": 1628548983,
    "interval": "month",
    "interval_count": 1,
    "status": "active",
    "cancel_at": null,
    "canceled_at": null,
    "trial_start": null,
    "trial_end": null,
    "currency": null,
    "amount": null,
    "amount_usd": null,
    "amount_usd_monthly": null
  }
}

Custom payment gateway integrations only

You do not need to use this endpoint if you have granted Corrily automated access to your payment gateway’s subscription and charge events.

Body Params

amount
float
required

The amount (price) of the subscription.

country
string

Users’s two-letter ISO3166 country code.

created
integer
required

A 10-digit (seconds) UNIX timestamp indicating when the subscription was created. This timestamp should represent when the subscription was initialized, regardless of the status of the subscription during the initialization. It’s rare to need to update created after initially setting it.

currency
string
required

The three-letter (ISO4217) currency code.

origin
string
required

The payment gateway that handled the subscription. Accepted values: stripe, paypal, chargebee

origin_id
string
required

A unique identifier for the subscription. This can be the ID that the payment gateway assigned to the subscription.

product
string
required

A product ID string or a payment gateway integration object. Product IDs are created by Corrily when you set up your Corrily account. Email support@corrily.com if you don’t know them. See the response of the calculate price endpoint for an example of the structure of integration objects.

status
string
required

The status of the subscription. Accepted values: pending, trialing, active, canceled

user_id
string
required

A User ID.

cancel_at
integer

A 10-digit (seconds) UNIX timestamp indicating when the subscription will be canceled. In other words, the customer will no longer have access to your service after this time. This parameter should only be provided when status is set to canceled.

canceled_at
integer

A 10-digit (seconds) unix timestamp indicating when customer expressed their intent to cancel. This parameter should only be provided when status is set to canceled.

trial_end
integer

A 10-digit (seconds) UNIX timestamp indicating when the trial subscription ends. This parameter should only be provided when status is set to trialing.

trial_start
integer

A 10-digit (seconds) UNIX timestamp indicating when the trial subscription begins. This parameter should only be provided when status is set to trialing.