Skip to main content
POST
/
subscriptions
Create subscription
curl --request POST \
  --url https://api.truust.io/2.0/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "buyer_id": 7485,
  "seller_id": 7485,
  "name": "Subscription Test",
  "value": 10,
  "type": "ADDON"
}
'
{
  "id": 123,
  "self": "<string>",
  "reference_id": "<string>",
  "name": "<string>",
  "amount": 123,
  "currency": "EUR",
  "type": "<string>",
  "status": "CREATED",
  "metadata": {},
  "published_at": "2023-11-07T05:31:56Z",
  "cancelled_at": "2023-11-07T05:31:56Z",
  "connections": {}
}

Authorizations

Authorization
string
header
required

Use your account's Secret Key as the Bearer token.

Body

application/json
buyer_id
integer
required

Customer ID of the subscriber (buyer).

Example:

42

seller_id
integer
required

Customer ID of the seller.

name
string
required
Maximum string length: 120
Example:

"Monthly plan"

value
number
required

Recurring charge amount.

Required range: x >= 0
Example:

9.99

type
string
required

Payment method type for the subscription (e.g. CARD).

Example:

"CARD"

fee_value
number
Required range: x >= 0
fee_percent
number
Required range: 0 <= x <= 100
start_date
string<date>

Date when the subscription starts. Defaults to creation date if not provided.

first_payment_value
number

Amount for the first payment if different from value.

times
integer

Number of billing cycles. Leave null for indefinite.

schedule
string

Cron expression or schedule descriptor (e.g. monthly, weekly).

auto_settle
boolean
tag
string
Maximum string length: 100
metadata
object
order_metadata
object

Metadata applied to each generated order.

buyer_confirmed_url
string<uri>
buyer_denied_url
string<uri>
seller_confirmed_url
string<uri>
seller_denied_url
string<uri>

Response

Subscription created

id
integer
self
string
reference_id
string | null
name
string
amount
number
currency
string
Example:

"EUR"

type
string

Payment method type for this subscription.

status
enum<string>
Available options:
CREATED,
ACTIVE,
CANCELLED,
EXPIRED
metadata
object
published_at
string<date-time> | null
cancelled_at
string<date-time> | null
connections
object

Hypermedia links to related resources.