Skip to main content
POST
/
components
/
v1
/
product
cURL
curl --request POST \
  --url https://api-sandbox.appcharge.com/components/v1/product \
  --header 'Content-Type: application/json' \
  --header 'x-publisher-token: <api-key>' \
  --data '
{
  "name": "Gold Coins Pack",
  "publisherProductId": "gold_coins_100",
  "type": "Quantity",
  "textFontColorHex": "#f5c518",
  "productImageUrl": "https://images.pexels.com/photos/35406321/pexels-photo-35406321.jpeg",
  "displayName": "Gold Coins",
  "description": "A pack of 100 gold coins.",
  "prefix": "Get",
  "suffix": "coins",
  "productPrefixImageUrl": "https://example.com/images/gold_coin_icon.png"
}
'
{
  "id": "507f1f77bcf86cd799439015",
  "name": "Gold Coins Pack",
  "displayName": "Gold Coins",
  "publisherProductId": "gold_coins_100",
  "type": "Quantity",
  "description": "A pack of 100 gold coins.",
  "prefix": "Get",
  "suffix": "coins",
  "textFontColorHex": "#f5c518",
  "productImageUrl": "https://media.appcharge.com/product1.png",
  "productPrefixImageUrl": "https://media.appcharge.com/product-prefix1.png",
  "productImageExternalUrl": "https://images.pexels.com/photos/35406321/pexels-photo-35406321.jpeg"
}

Authorizations

x-publisher-token
string
header
required

Publisher token, as displayed in the Publisher Dashboard.

Body

application/json
name
string
required

Product name.

Example:

"Gold Coins Pack"

publisherProductId
string
required

Product ID that you define.

Example:

"gold_coins_100"

type
enum<string>
required

Product unit type.

Available options:
Quantity,
Time
Example:

"Quantity"

textFontColorHex
string
required

Product text font color in hex format.

Pattern: ^#[0-9a-fA-F]{6}$
Example:

"#f5c518"

productImageUrl
string<url>
required

Product image URL in the Assets Library, or an external image link. Must be in PNG or JPEG format.

Example:

"https://images.pexels.com/photos/35406321/pexels-photo-35406321.jpeg"

displayName
string

Product display name.

Example:

"Gold Coins"

description
string

Product description.

Example:

"A pack of 100 gold coins."

prefix
string

Product prefix text.

Example:

"Get"

suffix
string

Product suffix text.

Example:

"coins"

productPrefixImageUrl
string<url>

Product prefix image URL in the Assets Library, or an external image link. Must be in PNG or JPEG format.

Example:

"https://example.com/images/gold_coin_icon.png"

Response

Product created successfully.

id
string

Product ID.

Example:

"507f1f77bcf86cd799439015"

name
string

Product name.

Example:

"Gold Coins Pack"

displayName
string

Product display name.

Example:

"Gold Coins"

publisherProductId
string

Product ID that you defined.

Example:

"gold_coins_100"

type
enum<string>

Product unit type.

Available options:
Quantity,
Time
Example:

"Quantity"

description
string

Product description.

Example:

"A pack of 100 gold coins."

prefix
string

Product prefix text.

Example:

"Get"

suffix
string

Product suffix text.

Example:

"coins"

textFontColorHex
string

Product text font color in hex format.

Pattern: ^#[0-9a-fA-F]{6}$
Example:

"#f5c518"

productImageUrl
string<url>

Product image URL in the Assets Library.

Example:

"https://media.appcharge.com/product1.png"

productPrefixImageUrl
string<url>

Product prefix image URL in the Assets Library.

Example:

"https://media.appcharge.com/product-prefix1.png"

productImageExternalUrl
string<url>

Original URL of the product image if uploaded via external link.

Example:

"https://images.pexels.com/photos/35406321/pexels-photo-35406321.jpeg"