Create a product
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
rate_usd_per_second: '0.004',
description: '<string>',
allow_pause: true
})
};
fetch('http://localhost:4000/v1/products', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url http://localhost:4000/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"rate_usd_per_second": "0.004",
"description": "<string>",
"allow_pause": true
}
'{
"id": "prod_9Xk2mQ1pL0vRsT",
"object": "product",
"name": "<string>",
"description": "<string>",
"rate_usd_per_second": "0.004",
"rate_per_second_wei": "4000",
"currency": "ausd",
"allow_pause": true,
"start_mode": "checkout",
"active": true,
"active_subscriptions": 123,
"livemode": true,
"created": 123
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Products
Create a product
POST
/
v1
/
products
Create a product
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
rate_usd_per_second: '0.004',
description: '<string>',
allow_pause: true
})
};
fetch('http://localhost:4000/v1/products', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url http://localhost:4000/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"rate_usd_per_second": "0.004",
"description": "<string>",
"allow_pause": true
}
'{
"id": "prod_9Xk2mQ1pL0vRsT",
"object": "product",
"name": "<string>",
"description": "<string>",
"rate_usd_per_second": "0.004",
"rate_per_second_wei": "4000",
"currency": "ausd",
"allow_pause": true,
"start_mode": "checkout",
"active": true,
"active_subscriptions": 123,
"livemode": true,
"created": 123
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
Your secret key: sk_test_… for test mode, sk_live_… for live. Server-side only.
Body
application/json
Required string length:
1 - 200USD per second as a decimal string. Never a float.
Pattern:
^\d+(\.\d+)?$Example:
"0.004"
Maximum string length:
1000Default checkout. Use merchant when billing should begin once your resource is ready.
Available options:
checkout, merchant Response
The created product.
Example:
"prod_9Xk2mQ1pL0vRsT"
Available options:
product USD per second as a decimal string. Never a float.
Pattern:
^\d+(\.\d+)?$Example:
"0.004"
Rate in token base units (6 decimals for AUSD).
Example:
"4000"
Available options:
ausd checkout starts the meter when the subscriber authorises; merchant waits until you call subscriptions.start.
Available options:
checkout, merchant Running or paused meters on this product.
Unix seconds.