Create product (SKU)
Create a product (SKU) for one of your websites. A product defines what a customer is charged: a one-time flat amount, or a recurring subscription with a price schedule.
POST /skuAuthentication
Include your API key in the Authorization header. See Authentication for details.
Request body
The request body differs depending on the product type. Two types are supported: one-time and subscription.
One-time product
A single, flat-rate charge.
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✓ | Set to one-time |
siteId | string | ✓ | The ID of the website this product belongs to |
title | string | ✓ | Product name |
currency | string | ✓ | Payment currency (ISO 4217, for example USD) |
amount | number | ✓ | Charge amount |
externalId | string | The product's identifier within your own system |
curl --request POST \
--url https://api.centrobill.com/sku \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--header 'X-Request-ID: YOUR_UNIQUE_REQUEST_ID' \
--data '{
"type": "one-time",
"siteId": "YOUR_SITE_ID",
"title": "Test Product",
"currency": "USD",
"amount": 1.00
}'Subscription product
A recurring charge defined by a price schedule.
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✓ | Set to subscription |
siteId | string | ✓ | The ID of the website this product belongs to |
title | string | ✓ | Product name |
price | array | ✓ | An array of price objects defining the billing schedule |
externalId | string | The product's identifier within your own system |
curl --request POST \
--url https://api.centrobill.com/sku \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--header 'X-Request-ID: YOUR_UNIQUE_REQUEST_ID' \
--data '{
"type": "subscription",
"siteId": "YOUR_SITE_ID",
"title": "Monthly Plan",
"price": [
{
"offset": "0d",
"amount": 9.99,
"currency": "USD",
"repeat": true
}
]
}'
NoteThe Merchant Portal also offers Trial and Free Trial product types. These are configured through the portal using a subscription with an introductory price. For details, see Create a website to initiate payment.
Response
A successful request returns the created SKU object:
{
"name": "sku_generated_name",
"siteId": "YOUR_SITE_ID",
"externalId": "your_external_id",
"title": "Test Product",
"type": "one-time",
"price": 1.00,
"currency": "USD",
"createdAt": "2020-04-17 13:43:02",
"updatedAt": "2020-11-17 13:43:02"
}| Field | Description |
|---|---|
name | The generated SKU identifier. Use this to reference the product in payment requests |
siteId | The website the product belongs to |
externalId | The product's identifier within your system |
title | Product name |
type | one-time or subscription |
price | The charge amount (one-time) or the price schedule array (subscription) |
currency | Payment currency |
createdAt | Timestamp when the product was created |
updatedAt | Timestamp when the product was last updated |
Errors
| Status | Meaning |
|---|---|
400 | Bad Request — a required field is missing or invalid |
401 | Unauthorized — API key missing or invalid |
403 | Forbidden — the key lacks permission for this operation |
500 | Internal Server Error |
Related
- Get product (SKU)
- Update product (SKU)
- Manage products — create and manage products in the Merchant Portal
Updated 28 days ago
Did this page help you?
