cURL
curl --request GET \
--url https://api-sandbox.appcharge.com/components/v1/product \
--header 'x-publisher-token: <api-key>'import requests
url = "https://api-sandbox.appcharge.com/components/v1/product"
headers = {"x-publisher-token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-publisher-token': '<api-key>'}};
fetch('https://api-sandbox.appcharge.com/components/v1/product', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.appcharge.com/components/v1/product"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-publisher-token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-sandbox.appcharge.com/components/v1/product")
.header("x-publisher-token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.appcharge.com/components/v1/product")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-publisher-token"] = '<api-key>'
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/product1.png",
"productPrefixImageUrl": "https://media.appcharge.com/product-prefix1.png"
},
{
"id": "507f1f77bcf86cd799439016",
"name": "Premium Product",
"displayName": "Premium Product",
"publisherProductId": "premium_product",
"type": "Time",
"description": "premium product access.",
"prefix": "Get",
"suffix": "days",
"textFontColorHex": "#d4af37",
"productImageUrl": "https://images.pexels.com/images/product2.png",
"productPrefixImageUrl": "https://media.appcharge.com/product-prefix2.png",
"productImageExternalUrl": "https://images.pexels.com/images/product2.png"
}
]
Products
Get All Products
Retrieves a list of all products.
GET
/
components
/
v1
/
product
cURL
curl --request GET \
--url https://api-sandbox.appcharge.com/components/v1/product \
--header 'x-publisher-token: <api-key>'import requests
url = "https://api-sandbox.appcharge.com/components/v1/product"
headers = {"x-publisher-token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-publisher-token': '<api-key>'}};
fetch('https://api-sandbox.appcharge.com/components/v1/product', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.appcharge.com/components/v1/product"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-publisher-token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-sandbox.appcharge.com/components/v1/product")
.header("x-publisher-token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.appcharge.com/components/v1/product")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-publisher-token"] = '<api-key>'
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/product1.png",
"productPrefixImageUrl": "https://media.appcharge.com/product-prefix1.png"
},
{
"id": "507f1f77bcf86cd799439016",
"name": "Premium Product",
"displayName": "Premium Product",
"publisherProductId": "premium_product",
"type": "Time",
"description": "premium product access.",
"prefix": "Get",
"suffix": "days",
"textFontColorHex": "#d4af37",
"productImageUrl": "https://images.pexels.com/images/product2.png",
"productPrefixImageUrl": "https://media.appcharge.com/product-prefix2.png",
"productImageExternalUrl": "https://images.pexels.com/images/product2.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"
},
{
"id": "507f1f77bcf86cd799439016",
"name": "Premium Product",
"displayName": "Premium Product",
"publisherProductId": "premium_product",
"type": "Time",
"description": "premium product access.",
"prefix": "Get",
"suffix": "days",
"textFontColorHex": "#d4af37",
"productImageUrl": "https://images.pexels.com/images/product2.png",
"productPrefixImageUrl": "https://media.appcharge.com/product-prefix2.png",
"productImageExternalUrl": "https://images.pexels.com/images/product2.png"
}
]
Was this page helpful?
⌘I
