curl --request POST \
--url https://api.yorlet.com/v1/subscriptions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"collection_method": "charge_automatically",
"customer": "<string>",
"interval": "month",
"add_invoice_items": [
{
"amount": 123,
"currency": "<string>",
"description": "<string>",
"tax_percent": 50,
"transfer_behavior": "automatic",
"type": "charge",
"metadata": {},
"price": "<string>",
"tax_rate": "<string>",
"transfer_destination": "<string>",
"unit": "<string>"
}
],
"billing_anchor": 123,
"billing_anchor_config": {
"day_of_month": 16
},
"coupon": "<string>",
"custom_fields": [
{
"name": "<string>",
"value": "<string>"
}
],
"days_before_collection": 3,
"days_until_due": 1,
"default_payment_method": "<string>",
"description": "<string>",
"end_date": 123,
"end_date_config": {
"day": 16,
"month": 6,
"year": 123
},
"metadata": {},
"phases": [
{
"start_date": 123,
"items": [
{
"price_data": {
"amount": 123,
"currency": "<string>",
"tax_percent": 123
},
"type": "charge",
"description": "<string>",
"metadata": {},
"price": "<string>",
"proration_behavior": "create_prorations",
"schedule": [
{
"amount": 123,
"effective_at": 123
}
],
"tax_rate": "<string>",
"transfer_behavior": "automatic",
"transfer_destination": "<string>",
"unit": "<string>"
}
]
}
],
"start_date": 123,
"start_date_config": {
"day": 16,
"month": 6,
"year": 123
},
"application": "<string>",
"currency": "gbp",
"first_invoice_creation": "immediately",
"interval_count": 123,
"invoice_settings": {
"custom_fields": [
{
"name": "<string>",
"value": "<string>"
}
]
},
"items": [
{
"price_data": {
"amount": 123,
"currency": "<string>",
"tax_percent": 123
},
"type": "charge",
"description": "<string>",
"metadata": {},
"price": "<string>",
"proration_behavior": "create_prorations",
"schedule": [
{
"amount": 123,
"effective_at": 123
}
],
"tax_rate": "<string>",
"transfer_behavior": "automatic",
"transfer_destination": "<string>",
"unit": "<string>"
}
],
"use_future_billing_date": true
}
'{
"id": "<string>",
"created": 123,
"object": "subscription",
"application": "<string>",
"billing_anchor": 123,
"billing_anchor_config": {
"day_of_month": 16
},
"cancel_at": 123,
"canceled_at": 123,
"collection_method": "charge_automatically",
"coupon": "<string>",
"currency": "gbp",
"current_period_end": 123,
"current_period_start": 123,
"custom_fields": [
{
"name": "<string>",
"value": "<string>"
}
],
"customer": "<string>",
"days_before_collection": 3,
"days_until_due": 1,
"default_payment_method": "<string>",
"description": "<string>",
"end": 123,
"interval": "month",
"interval_count": 123,
"next_period_end": 123,
"next_period_start": 123,
"pause_collection": {
"behavior": "draft",
"resumes_at": 123
},
"payment_settings": {
"payment_method_types": [
"autogiro"
]
},
"phases": [
{
"start_date": 123,
"items": [
"<unknown>"
]
}
],
"start": 123,
"status": "active",
"account": "<string>",
"deleted": false,
"metadata": {}
}Create a subscription
curl --request POST \
--url https://api.yorlet.com/v1/subscriptions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"collection_method": "charge_automatically",
"customer": "<string>",
"interval": "month",
"add_invoice_items": [
{
"amount": 123,
"currency": "<string>",
"description": "<string>",
"tax_percent": 50,
"transfer_behavior": "automatic",
"type": "charge",
"metadata": {},
"price": "<string>",
"tax_rate": "<string>",
"transfer_destination": "<string>",
"unit": "<string>"
}
],
"billing_anchor": 123,
"billing_anchor_config": {
"day_of_month": 16
},
"coupon": "<string>",
"custom_fields": [
{
"name": "<string>",
"value": "<string>"
}
],
"days_before_collection": 3,
"days_until_due": 1,
"default_payment_method": "<string>",
"description": "<string>",
"end_date": 123,
"end_date_config": {
"day": 16,
"month": 6,
"year": 123
},
"metadata": {},
"phases": [
{
"start_date": 123,
"items": [
{
"price_data": {
"amount": 123,
"currency": "<string>",
"tax_percent": 123
},
"type": "charge",
"description": "<string>",
"metadata": {},
"price": "<string>",
"proration_behavior": "create_prorations",
"schedule": [
{
"amount": 123,
"effective_at": 123
}
],
"tax_rate": "<string>",
"transfer_behavior": "automatic",
"transfer_destination": "<string>",
"unit": "<string>"
}
]
}
],
"start_date": 123,
"start_date_config": {
"day": 16,
"month": 6,
"year": 123
},
"application": "<string>",
"currency": "gbp",
"first_invoice_creation": "immediately",
"interval_count": 123,
"invoice_settings": {
"custom_fields": [
{
"name": "<string>",
"value": "<string>"
}
]
},
"items": [
{
"price_data": {
"amount": 123,
"currency": "<string>",
"tax_percent": 123
},
"type": "charge",
"description": "<string>",
"metadata": {},
"price": "<string>",
"proration_behavior": "create_prorations",
"schedule": [
{
"amount": 123,
"effective_at": 123
}
],
"tax_rate": "<string>",
"transfer_behavior": "automatic",
"transfer_destination": "<string>",
"unit": "<string>"
}
],
"use_future_billing_date": true
}
'{
"id": "<string>",
"created": 123,
"object": "subscription",
"application": "<string>",
"billing_anchor": 123,
"billing_anchor_config": {
"day_of_month": 16
},
"cancel_at": 123,
"canceled_at": 123,
"collection_method": "charge_automatically",
"coupon": "<string>",
"currency": "gbp",
"current_period_end": 123,
"current_period_start": 123,
"custom_fields": [
{
"name": "<string>",
"value": "<string>"
}
],
"customer": "<string>",
"days_before_collection": 3,
"days_until_due": 1,
"default_payment_method": "<string>",
"description": "<string>",
"end": 123,
"interval": "month",
"interval_count": 123,
"next_period_end": 123,
"next_period_start": 123,
"pause_collection": {
"behavior": "draft",
"resumes_at": 123
},
"payment_settings": {
"payment_method_types": [
"autogiro"
]
},
"phases": [
{
"start_date": 123,
"items": [
"<unknown>"
]
}
],
"start": 123,
"status": "active",
"account": "<string>",
"deleted": false,
"metadata": {}
}API Key authentication. Use "Bearer YOUR_API_KEY".
The collection method for the subscription.
charge_automatically, send_invoice The identifier of the customer to create the subscription for.
The billing interval for the subscription.
month, week, custom A list of invoice items to add to invoices created by the subscription.
10Show child attributes
The reference point that aligns future billing cycle dates.
Configuration for the billing anchor.
Show child attributes
The identifier of the coupon to apply to the subscription.
Custom fields attached to the subscription invoices.
4Show child attributes
The number of days before the due date to attempt collection.
0 <= x <= 7The number of days until the invoice is due.
x >= 0The identifier of the default payment method for the subscription.
The description of the subscription.
The end date of the subscription.
Configuration to compute the end date of the subscription.
Show child attributes
Set of key-value pairs to attach to the subscription.
Show child attributes
The payment settings for the subscription.
Show child attributes
The phases of the subscription. Required when interval is custom.
1Show child attributes
The start date of the subscription.
Configuration to compute the start date of the subscription.
Show child attributes
The identifier of the application to associate with the subscription.
The currency of the subscription. Required when application is not provided.
gbp, usd, eur, sek "gbp"
Whether to create the first invoice immediately.
immediately, null Create the subscription as a revision of an existing subscription.
Show child attributes
The number of intervals between each billing cycle. Required when interval is not custom.
The invoice settings for the subscription.
Show child attributes
The items for the subscription. Required when interval is not custom.
1 - 10 elementsShow child attributes
Whether to use a future billing date for the first invoice.
Returns the subscription object if the request succeeded.
Unique identifier for the object.
Time at which the object was created. Measured in seconds since the Unix epoch.
subscription The identifier of the application associated with the subscription.
The reference point that aligns future billing cycle dates.
Configuration for the billing anchor.
Show child attributes
The date at which the subscription will be automatically canceled.
The date the subscription was canceled.
The collection method for the subscription.
charge_automatically, send_invoice The identifier of the coupon applied to the subscription.
The currency of the subscription.
gbp, usd, eur, sek "gbp"
The end of the current billing period.
The start of the current billing period.
Custom fields attached to the subscription invoices.
4Show child attributes
The customer associated with the subscription.
The number of days before the due date to attempt collection.
0 <= x <= 7The number of days until the invoice is due.
x >= 0The identifier of the default payment method for the subscription.
The description of the subscription.
The end date of the subscription.
The billing interval for the subscription.
month, week, custom The number of intervals between each billing cycle.
The end of the next billing period.
The start of the next billing period.
The pause collection settings for the subscription.
Show child attributes
The payment settings for the subscription.
Show child attributes
The phases of the subscription.
Show child attributes
The start date of the subscription.
The status of the subscription.
active, canceled, complete, scheduled The account that the object belongs to. Only returned if the request is made with a valid Yorlet-Context header.
Only returned if the object has been deleted.
Set of key-value pairs attached to the subscription.
Show child attributes
Was this page helpful?