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 /sku

Authentication

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.

FieldTypeRequiredDescription
typestring✓Set to one-time
siteIdstring✓The ID of the website this product belongs to
titlestring✓Product name
currencystring✓Payment currency (ISO 4217, for example USD)
amountnumber✓Charge amount
externalIdstringThe 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.

FieldTypeRequiredDescription
typestring✓Set to subscription
siteIdstring✓The ID of the website this product belongs to
titlestring✓Product name
pricearray✓An array of price objects defining the billing schedule
externalIdstringThe 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
      }
    ]
  }'
📘

Note

The 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"
}
FieldDescription
nameThe generated SKU identifier. Use this to reference the product in payment requests
siteIdThe website the product belongs to
externalIdThe product's identifier within your system
titleProduct name
typeone-time or subscription
priceThe charge amount (one-time) or the price schedule array (subscription)
currencyPayment currency
createdAtTimestamp when the product was created
updatedAtTimestamp when the product was last updated

Errors

StatusMeaning
400Bad Request — a required field is missing or invalid
401Unauthorized — API key missing or invalid
403Forbidden — the key lacks permission for this operation
500Internal Server Error

Related


Did this page help you?