Subscription
400 words 2 minutes
Data type representing a subscription. When creating a subscription, the Creatable Subscription datatype will be used.
When calling the subscription endpoint to add a subscription to an account, add a Creatable Subscription Object.
The schedule and items field allow both for very specific and complex structures as well as simple payment models.
If no start date is specified, the start date will be set as the current date.
Creatable Subscription
Property | Type | Description |
---|---|---|
number |
string |
(optional) identifier in your system |
items |
`number | Item |
currency |
string |
3-letter currency code, e.g. “SEK” |
schedule |
`Frequency | Schedule` |
start |
string |
(optional) date in shortened ISO format |
end |
string |
(optional) date in shortened ISO format |
callback |
string |
(optional) |
Simple Example:
{
"number": "standard",
"items": 25,
"currency": "SEK",
"schedule": "monthly",
}
Complex Example:
{
"number": "aaa-001",
"items": [
{
"name": "Basic Access",
"price": 42.00,
"vat": 25.00,
"quantity": 1
},
{
"name": "Premium Access",
"price": 100.00,
"vat": 25.00,
"quantity": 2
}
],
"currency": "SEK",
"schedule": {
"frequency":"quarterly",
"offset": [ 2,-1 ]
},
"start": "2021-07-03",
"callback":"your.callback.com/subscription"
}
Responses from the Subscription endpoint will be of the completed Subscription type, which always includes a start date as well as a 4-letter identifier, which is unique per account. The “due” field contains the date in ISO format at which the next order charging the subscription will be placed into the system. At this point the system automatically calculates the next “due” date as long as it is not past the “end” date of the subscription.
Subscription
Property | Type | Description |
---|---|---|
id |
string |
Unique 4-letter identifier in our system |
number |
string |
(optional) identifier in your system |
items |
`number | Item |
currency |
string |
3-letter currency code, e.g. “SEK” |
schedule |
`Frequency | Schedule` |
start |
string |
date in ISO format |
end |
string |
(optional) date in shortened ISO format |
due |
string |
(optional) date in shortened ISO format |
callback |
string |
(optional) |
Example:
{
"id":"test",
"number": "aaa-001",
"items": [
{
"name": "Basic Access",
"price": 50.00,
"vat": 12.50,
"quantity": 1
},
{
"name": "Premium Access",
"price": 100.00,
"vat": 25.00,
"quantity": 2
}
],
"currency": "SEK",
"schedule": {
"frequency":"quarterly",
"offset": [ 2,-1 ]
},
"start": "2021-07-03",
"due": "2021-09-30",
"callback":"your.callback.com/subscription"
}