curl --request PUT \
--url https://api-sandbox.appcharge.com/components/v1/product/{externalId} \
--header 'Content-Type: application/json' \
--header 'x-publisher-token: <api-key>' \
--data '
{
"name": "Premium Gold Coins Pack",
"displayName": "Premium Gold Coins",
"publisherProductId": "gold_coins_100",
"type": "Quantity",
"prefix": "Get",
"suffix": "premium coins",
"textFontColorHex": "#d4af37",
"productImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5",
"productPrefixImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5"
}
'import requests
url = "https://api-sandbox.appcharge.com/components/v1/product/{externalId}"
payload = {
"name": "Premium Gold Coins Pack",
"displayName": "Premium Gold Coins",
"publisherProductId": "gold_coins_100",
"type": "Quantity",
"prefix": "Get",
"suffix": "premium coins",
"textFontColorHex": "#d4af37",
"productImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5",
"productPrefixImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5"
}
headers = {
"x-publisher-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-publisher-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Premium Gold Coins Pack',
displayName: 'Premium Gold Coins',
publisherProductId: 'gold_coins_100',
type: 'Quantity',
prefix: 'Get',
suffix: 'premium coins',
textFontColorHex: '#d4af37',
productImageUrl: 'https://media.appcharge.com/media/69133d595af23405d8e843a5',
productPrefixImageUrl: 'https://media.appcharge.com/media/69133d595af23405d8e843a5'
})
};
fetch('https://api-sandbox.appcharge.com/components/v1/product/{externalId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.appcharge.com/components/v1/product/{externalId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Premium Gold Coins Pack',
'displayName' => 'Premium Gold Coins',
'publisherProductId' => 'gold_coins_100',
'type' => 'Quantity',
'prefix' => 'Get',
'suffix' => 'premium coins',
'textFontColorHex' => '#d4af37',
'productImageUrl' => 'https://media.appcharge.com/media/69133d595af23405d8e843a5',
'productPrefixImageUrl' => 'https://media.appcharge.com/media/69133d595af23405d8e843a5'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-publisher-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.appcharge.com/components/v1/product/{externalId}"
payload := strings.NewReader("{\n \"name\": \"Premium Gold Coins Pack\",\n \"displayName\": \"Premium Gold Coins\",\n \"publisherProductId\": \"gold_coins_100\",\n \"type\": \"Quantity\",\n \"prefix\": \"Get\",\n \"suffix\": \"premium coins\",\n \"textFontColorHex\": \"#d4af37\",\n \"productImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\",\n \"productPrefixImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-publisher-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api-sandbox.appcharge.com/components/v1/product/{externalId}")
.header("x-publisher-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Premium Gold Coins Pack\",\n \"displayName\": \"Premium Gold Coins\",\n \"publisherProductId\": \"gold_coins_100\",\n \"type\": \"Quantity\",\n \"prefix\": \"Get\",\n \"suffix\": \"premium coins\",\n \"textFontColorHex\": \"#d4af37\",\n \"productImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\",\n \"productPrefixImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.appcharge.com/components/v1/product/{externalId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-publisher-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Premium Gold Coins Pack\",\n \"displayName\": \"Premium Gold Coins\",\n \"publisherProductId\": \"gold_coins_100\",\n \"type\": \"Quantity\",\n \"prefix\": \"Get\",\n \"suffix\": \"premium coins\",\n \"textFontColorHex\": \"#d4af37\",\n \"productImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\",\n \"productPrefixImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\"\n}"
response = http.request(request)
puts response.read_body{
"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/media/69133d595af23405d8e843a5",
"productPrefixImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5",
"productImageExternalUrl": "https://images.pexels.com/photos/35406321/pexels-photo-35406321.jpeg"
}Update Product
Updates a product.
curl --request PUT \
--url https://api-sandbox.appcharge.com/components/v1/product/{externalId} \
--header 'Content-Type: application/json' \
--header 'x-publisher-token: <api-key>' \
--data '
{
"name": "Premium Gold Coins Pack",
"displayName": "Premium Gold Coins",
"publisherProductId": "gold_coins_100",
"type": "Quantity",
"prefix": "Get",
"suffix": "premium coins",
"textFontColorHex": "#d4af37",
"productImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5",
"productPrefixImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5"
}
'import requests
url = "https://api-sandbox.appcharge.com/components/v1/product/{externalId}"
payload = {
"name": "Premium Gold Coins Pack",
"displayName": "Premium Gold Coins",
"publisherProductId": "gold_coins_100",
"type": "Quantity",
"prefix": "Get",
"suffix": "premium coins",
"textFontColorHex": "#d4af37",
"productImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5",
"productPrefixImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5"
}
headers = {
"x-publisher-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-publisher-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Premium Gold Coins Pack',
displayName: 'Premium Gold Coins',
publisherProductId: 'gold_coins_100',
type: 'Quantity',
prefix: 'Get',
suffix: 'premium coins',
textFontColorHex: '#d4af37',
productImageUrl: 'https://media.appcharge.com/media/69133d595af23405d8e843a5',
productPrefixImageUrl: 'https://media.appcharge.com/media/69133d595af23405d8e843a5'
})
};
fetch('https://api-sandbox.appcharge.com/components/v1/product/{externalId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.appcharge.com/components/v1/product/{externalId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Premium Gold Coins Pack',
'displayName' => 'Premium Gold Coins',
'publisherProductId' => 'gold_coins_100',
'type' => 'Quantity',
'prefix' => 'Get',
'suffix' => 'premium coins',
'textFontColorHex' => '#d4af37',
'productImageUrl' => 'https://media.appcharge.com/media/69133d595af23405d8e843a5',
'productPrefixImageUrl' => 'https://media.appcharge.com/media/69133d595af23405d8e843a5'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-publisher-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.appcharge.com/components/v1/product/{externalId}"
payload := strings.NewReader("{\n \"name\": \"Premium Gold Coins Pack\",\n \"displayName\": \"Premium Gold Coins\",\n \"publisherProductId\": \"gold_coins_100\",\n \"type\": \"Quantity\",\n \"prefix\": \"Get\",\n \"suffix\": \"premium coins\",\n \"textFontColorHex\": \"#d4af37\",\n \"productImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\",\n \"productPrefixImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-publisher-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api-sandbox.appcharge.com/components/v1/product/{externalId}")
.header("x-publisher-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Premium Gold Coins Pack\",\n \"displayName\": \"Premium Gold Coins\",\n \"publisherProductId\": \"gold_coins_100\",\n \"type\": \"Quantity\",\n \"prefix\": \"Get\",\n \"suffix\": \"premium coins\",\n \"textFontColorHex\": \"#d4af37\",\n \"productImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\",\n \"productPrefixImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.appcharge.com/components/v1/product/{externalId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-publisher-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Premium Gold Coins Pack\",\n \"displayName\": \"Premium Gold Coins\",\n \"publisherProductId\": \"gold_coins_100\",\n \"type\": \"Quantity\",\n \"prefix\": \"Get\",\n \"suffix\": \"premium coins\",\n \"textFontColorHex\": \"#d4af37\",\n \"productImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\",\n \"productPrefixImageUrl\": \"https://media.appcharge.com/media/69133d595af23405d8e843a5\"\n}"
response = http.request(request)
puts response.read_body{
"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/media/69133d595af23405d8e843a5",
"productPrefixImageUrl": "https://media.appcharge.com/media/69133d595af23405d8e843a5",
"productImageExternalUrl": "https://images.pexels.com/photos/35406321/pexels-photo-35406321.jpeg"
}Authorizations
Publisher token, as displayed in the Publisher Dashboard.
Path Parameters
External ID that you defined.
"gold_coins_pack"
Body
Product name.
"Premium Gold Coins Pack"
Product display name.
"Premium Gold Coins"
Product ID that you define
"gold_coins_100"
Product unit type.
Quantity, Time "Quantity"
Product prefix text.
"Get"
Product suffix text.
"premium coins"
Product text font color in hex format.
^#[0-9a-fA-F]{6}$"#d4af37"
Product image URL in PNG or JPEG format.
For uploaded files, this is the Appcharge-hosted CDN URL. For external image URLs, this is the original image URL served from the provided URL. External image URLs are saved and used as-is, and Appcharge doesn't download, copy, upload, or host them. Images must remain available at the provided URLs.
We recommend uploading image files instead of using external URLs when possible.
"https://media.appcharge.com/media/69133d595af23405d8e843a5"
Product prefix image URL in PNG or JPEG format.
For uploaded files, this is the Appcharge-hosted CDN URL. For external image URLs, this is the original image URL served from the provided URL. External image URLs are saved and used as-is, and Appcharge doesn't download, copy, upload, or host them. Images must remain available at the provided URLs.
We recommend uploading image files instead of using external URLs when possible.
"https://media.appcharge.com/media/69133d595af23405d8e843a5"
Response
Product updated successfully.
Product ID.
"507f1f77bcf86cd799439015"
Product name.
"Gold Coins Pack"
Product display name.
"Gold Coins"
Product ID that you defined.
"gold_coins_100"
Product unit type.
Quantity, Time "Quantity"
Product description.
"A pack of 100 gold coins."
Product prefix text.
"Get"
Product suffix text.
"coins"
Product text font color in hex format.
^#[0-9a-fA-F]{6}$"#f5c518"
Product image URL. For uploaded files, this is the Appcharge-hosted CDN URL. For external image URLs, this is the original image URL served from the provided URL.
"https://media.appcharge.com/media/69133d595af23405d8e843a5"
Product prefix image URL. For uploaded files, this is the Appcharge-hosted CDN URL. For external image URLs, this is the original image URL served from the provided URL.
"https://media.appcharge.com/media/69133d595af23405d8e843a5"
Original product image URL when the product uses an external image URL. This URL is used as provided to serve the image.
"https://images.pexels.com/photos/35406321/pexels-photo-35406321.jpeg"
Was this page helpful?
