Skip to main content
POST
/
subscriptions
Create a subscription
curl --request POST \
  --url https://sandbox-api.paynext.com/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customer": {
    "id": "cus_0c3663c1-ab8e-4c87-b19c-c72814ffe1ac"
  },
  "plan": {
    "id": "price_a5b8fc11-971b-477a-b758-e7fa46260226"
  },
  "subscription": {
    "metadata": {
      "key": "value"
    }
  }
}
'
{
  "id": "sub_123e4567-e89b-12d3-a456-426614174000",
  "current_period_end": "<string>",
  "current_period_start": "<string>",
  "next_billing_date": "2025-06-26T12:00:00Z",
  "past_due": {
    "attempt_count": 2,
    "max_attempts_count": 7
  },
  "plan": {
    "id": "price_1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
    "archived_at": "2025-06-01T10:00:00Z",
    "interval": "days",
    "interval_count": 1,
    "name": "Pro Plan",
    "price": {
      "amount": 1999,
      "currency": "AED"
    },
    "tax": {
      "collect_tax": "<unknown>"
    },
    "trial_interval": "days",
    "trial_interval_count": 14,
    "trial_price": {
      "amount": 1999,
      "currency": "AED"
    },
    "type": "recurring"
  },
  "metadata": {
    "key": "value"
  },
  "created_at": "2025-05-26T10:00:00Z",
  "updated_at": "2025-05-27T10:00:00Z"
}

Authorizations

Authorization
string
header
required

Authentication header of the form api key, where api key is your organization api key.

Headers

X-API-Version
enum<string>

Specifies the version of the API to use

Available options:
2.0.0

Body

application/json

Create subscription

customer
object

Customer details for the subscription

plan
object

Plan details for the subscription

subscription
object

Subscription details

Response

Returns the subscription object after successful creation.

id
string

Unique identifier for the subscription

Example:

"sub_123e4567-e89b-12d3-a456-426614174000"

current_period_end
string
current_period_start
string
next_billing_date
string

Next scheduled billing date for the subscription

Example:

"2025-06-26T12:00:00Z"

past_due
object

Information about past due attempts

plan
object
status
enum<string>

Current status of the subscription

Available options:
trial,
active,
past_due,
cancelled,
scheduled_for_cancellation
metadata
object

Custom metadata associated with the subscription A dictionary of key-value pairs.

Example:
{ "key": "value" }
created_at
string

The date and time at which the subscription was created in UTC format

Example:

"2025-05-26T10:00:00Z"

updated_at
string

The date and time of the last subscription update in UTC format

Example:

"2025-05-27T10:00:00Z"