curl --request POST \
--url https://api-sandbox.appcharge.com/checkout/v1/session \
--header 'Content-Type: application/json' \
--header 'x-publisher-token: <x-publisher-token>' \
--data '
{
"priceDetails": {
"price": 1000,
"currency": "USD"
},
"offer": {
"name": "Treasure Chest",
"sku": "68452829c5e8",
"displayName": "<string>",
"pricePointMetadata": 123
},
"customer": {
"id": "7c99fba665c4a",
"email": "customer@appcharge.com",
"identitySignals": {
"firstSeenAt": "2021-01-01T00:00:00Z"
}
},
"items": [
{
"name": "coins",
"sku": "coins_386f9b",
"quantity": 3300000,
"assetUrl": "https://media-dev.appcharge.com/coin.png",
"quantityDisplay": "3.3M",
"displayName": "<string>"
}
],
"countryCode2": "US",
"playerIp": "<string>",
"receiptMetadata": {
"locale": "fr-CA"
},
"sessionMetadata": {},
"attributes": {},
"redirectUrl": "<string>"
}
'import requests
url = "https://api-sandbox.appcharge.com/checkout/v1/session"
payload = {
"priceDetails": {
"price": 1000,
"currency": "USD"
},
"offer": {
"name": "Treasure Chest",
"sku": "68452829c5e8",
"displayName": "<string>",
"pricePointMetadata": 123
},
"customer": {
"id": "7c99fba665c4a",
"email": "customer@appcharge.com",
"identitySignals": { "firstSeenAt": "2021-01-01T00:00:00Z" }
},
"items": [
{
"name": "coins",
"sku": "coins_386f9b",
"quantity": 3300000,
"assetUrl": "https://media-dev.appcharge.com/coin.png",
"quantityDisplay": "3.3M",
"displayName": "<string>"
}
],
"countryCode2": "US",
"playerIp": "<string>",
"receiptMetadata": { "locale": "fr-CA" },
"sessionMetadata": {},
"attributes": {},
"redirectUrl": "<string>"
}
headers = {
"x-publisher-token": "<x-publisher-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-publisher-token': '<x-publisher-token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
priceDetails: {price: 1000, currency: 'USD'},
offer: {
name: 'Treasure Chest',
sku: '68452829c5e8',
displayName: '<string>',
pricePointMetadata: 123
},
customer: {
id: '7c99fba665c4a',
email: 'customer@appcharge.com',
identitySignals: {firstSeenAt: '2021-01-01T00:00:00Z'}
},
items: [
{
name: 'coins',
sku: 'coins_386f9b',
quantity: 3300000,
assetUrl: 'https://media-dev.appcharge.com/coin.png',
quantityDisplay: '3.3M',
displayName: '<string>'
}
],
countryCode2: 'US',
playerIp: '<string>',
receiptMetadata: {locale: 'fr-CA'},
sessionMetadata: {},
attributes: {},
redirectUrl: '<string>'
})
};
fetch('https://api-sandbox.appcharge.com/checkout/v1/session', 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/checkout/v1/session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'priceDetails' => [
'price' => 1000,
'currency' => 'USD'
],
'offer' => [
'name' => 'Treasure Chest',
'sku' => '68452829c5e8',
'displayName' => '<string>',
'pricePointMetadata' => 123
],
'customer' => [
'id' => '7c99fba665c4a',
'email' => 'customer@appcharge.com',
'identitySignals' => [
'firstSeenAt' => '2021-01-01T00:00:00Z'
]
],
'items' => [
[
'name' => 'coins',
'sku' => 'coins_386f9b',
'quantity' => 3300000,
'assetUrl' => 'https://media-dev.appcharge.com/coin.png',
'quantityDisplay' => '3.3M',
'displayName' => '<string>'
]
],
'countryCode2' => 'US',
'playerIp' => '<string>',
'receiptMetadata' => [
'locale' => 'fr-CA'
],
'sessionMetadata' => [
],
'attributes' => [
],
'redirectUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-publisher-token: <x-publisher-token>"
],
]);
$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/checkout/v1/session"
payload := strings.NewReader("{\n \"priceDetails\": {\n \"price\": 1000,\n \"currency\": \"USD\"\n },\n \"offer\": {\n \"name\": \"Treasure Chest\",\n \"sku\": \"68452829c5e8\",\n \"displayName\": \"<string>\",\n \"pricePointMetadata\": 123\n },\n \"customer\": {\n \"id\": \"7c99fba665c4a\",\n \"email\": \"customer@appcharge.com\",\n \"identitySignals\": {\n \"firstSeenAt\": \"2021-01-01T00:00:00Z\"\n }\n },\n \"items\": [\n {\n \"name\": \"coins\",\n \"sku\": \"coins_386f9b\",\n \"quantity\": 3300000,\n \"assetUrl\": \"https://media-dev.appcharge.com/coin.png\",\n \"quantityDisplay\": \"3.3M\",\n \"displayName\": \"<string>\"\n }\n ],\n \"countryCode2\": \"US\",\n \"playerIp\": \"<string>\",\n \"receiptMetadata\": {\n \"locale\": \"fr-CA\"\n },\n \"sessionMetadata\": {},\n \"attributes\": {},\n \"redirectUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-publisher-token", "<x-publisher-token>")
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.post("https://api-sandbox.appcharge.com/checkout/v1/session")
.header("x-publisher-token", "<x-publisher-token>")
.header("Content-Type", "application/json")
.body("{\n \"priceDetails\": {\n \"price\": 1000,\n \"currency\": \"USD\"\n },\n \"offer\": {\n \"name\": \"Treasure Chest\",\n \"sku\": \"68452829c5e8\",\n \"displayName\": \"<string>\",\n \"pricePointMetadata\": 123\n },\n \"customer\": {\n \"id\": \"7c99fba665c4a\",\n \"email\": \"customer@appcharge.com\",\n \"identitySignals\": {\n \"firstSeenAt\": \"2021-01-01T00:00:00Z\"\n }\n },\n \"items\": [\n {\n \"name\": \"coins\",\n \"sku\": \"coins_386f9b\",\n \"quantity\": 3300000,\n \"assetUrl\": \"https://media-dev.appcharge.com/coin.png\",\n \"quantityDisplay\": \"3.3M\",\n \"displayName\": \"<string>\"\n }\n ],\n \"countryCode2\": \"US\",\n \"playerIp\": \"<string>\",\n \"receiptMetadata\": {\n \"locale\": \"fr-CA\"\n },\n \"sessionMetadata\": {},\n \"attributes\": {},\n \"redirectUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.appcharge.com/checkout/v1/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-publisher-token"] = '<x-publisher-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"priceDetails\": {\n \"price\": 1000,\n \"currency\": \"USD\"\n },\n \"offer\": {\n \"name\": \"Treasure Chest\",\n \"sku\": \"68452829c5e8\",\n \"displayName\": \"<string>\",\n \"pricePointMetadata\": 123\n },\n \"customer\": {\n \"id\": \"7c99fba665c4a\",\n \"email\": \"customer@appcharge.com\",\n \"identitySignals\": {\n \"firstSeenAt\": \"2021-01-01T00:00:00Z\"\n }\n },\n \"items\": [\n {\n \"name\": \"coins\",\n \"sku\": \"coins_386f9b\",\n \"quantity\": 3300000,\n \"assetUrl\": \"https://media-dev.appcharge.com/coin.png\",\n \"quantityDisplay\": \"3.3M\",\n \"displayName\": \"<string>\"\n }\n ],\n \"countryCode2\": \"US\",\n \"playerIp\": \"<string>\",\n \"receiptMetadata\": {\n \"locale\": \"fr-CA\"\n },\n \"sessionMetadata\": {},\n \"attributes\": {},\n \"redirectUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"checkoutSessionToken": "61ed143b22d24815a713e215e99b0ea6",
"purchaseId": "purchase_abc123def456",
"url": "https://checkout-v2.appcharge.com",
"parsedUrl": "https://pay.appcharge.com/61a164d563c54014b1959a5c78704964#boot={PUBLISHER_BOOT_DATA}"
}{
"errorCode": 0,
"errorMessage": "<string>"
}{
"message": "Blocked player: this player has been blocked. See the blocked player list in the dashboard for more info."
}Create Checkout Session API
Creates a checkout session.
curl --request POST \
--url https://api-sandbox.appcharge.com/checkout/v1/session \
--header 'Content-Type: application/json' \
--header 'x-publisher-token: <x-publisher-token>' \
--data '
{
"priceDetails": {
"price": 1000,
"currency": "USD"
},
"offer": {
"name": "Treasure Chest",
"sku": "68452829c5e8",
"displayName": "<string>",
"pricePointMetadata": 123
},
"customer": {
"id": "7c99fba665c4a",
"email": "customer@appcharge.com",
"identitySignals": {
"firstSeenAt": "2021-01-01T00:00:00Z"
}
},
"items": [
{
"name": "coins",
"sku": "coins_386f9b",
"quantity": 3300000,
"assetUrl": "https://media-dev.appcharge.com/coin.png",
"quantityDisplay": "3.3M",
"displayName": "<string>"
}
],
"countryCode2": "US",
"playerIp": "<string>",
"receiptMetadata": {
"locale": "fr-CA"
},
"sessionMetadata": {},
"attributes": {},
"redirectUrl": "<string>"
}
'import requests
url = "https://api-sandbox.appcharge.com/checkout/v1/session"
payload = {
"priceDetails": {
"price": 1000,
"currency": "USD"
},
"offer": {
"name": "Treasure Chest",
"sku": "68452829c5e8",
"displayName": "<string>",
"pricePointMetadata": 123
},
"customer": {
"id": "7c99fba665c4a",
"email": "customer@appcharge.com",
"identitySignals": { "firstSeenAt": "2021-01-01T00:00:00Z" }
},
"items": [
{
"name": "coins",
"sku": "coins_386f9b",
"quantity": 3300000,
"assetUrl": "https://media-dev.appcharge.com/coin.png",
"quantityDisplay": "3.3M",
"displayName": "<string>"
}
],
"countryCode2": "US",
"playerIp": "<string>",
"receiptMetadata": { "locale": "fr-CA" },
"sessionMetadata": {},
"attributes": {},
"redirectUrl": "<string>"
}
headers = {
"x-publisher-token": "<x-publisher-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-publisher-token': '<x-publisher-token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
priceDetails: {price: 1000, currency: 'USD'},
offer: {
name: 'Treasure Chest',
sku: '68452829c5e8',
displayName: '<string>',
pricePointMetadata: 123
},
customer: {
id: '7c99fba665c4a',
email: 'customer@appcharge.com',
identitySignals: {firstSeenAt: '2021-01-01T00:00:00Z'}
},
items: [
{
name: 'coins',
sku: 'coins_386f9b',
quantity: 3300000,
assetUrl: 'https://media-dev.appcharge.com/coin.png',
quantityDisplay: '3.3M',
displayName: '<string>'
}
],
countryCode2: 'US',
playerIp: '<string>',
receiptMetadata: {locale: 'fr-CA'},
sessionMetadata: {},
attributes: {},
redirectUrl: '<string>'
})
};
fetch('https://api-sandbox.appcharge.com/checkout/v1/session', 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/checkout/v1/session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'priceDetails' => [
'price' => 1000,
'currency' => 'USD'
],
'offer' => [
'name' => 'Treasure Chest',
'sku' => '68452829c5e8',
'displayName' => '<string>',
'pricePointMetadata' => 123
],
'customer' => [
'id' => '7c99fba665c4a',
'email' => 'customer@appcharge.com',
'identitySignals' => [
'firstSeenAt' => '2021-01-01T00:00:00Z'
]
],
'items' => [
[
'name' => 'coins',
'sku' => 'coins_386f9b',
'quantity' => 3300000,
'assetUrl' => 'https://media-dev.appcharge.com/coin.png',
'quantityDisplay' => '3.3M',
'displayName' => '<string>'
]
],
'countryCode2' => 'US',
'playerIp' => '<string>',
'receiptMetadata' => [
'locale' => 'fr-CA'
],
'sessionMetadata' => [
],
'attributes' => [
],
'redirectUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-publisher-token: <x-publisher-token>"
],
]);
$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/checkout/v1/session"
payload := strings.NewReader("{\n \"priceDetails\": {\n \"price\": 1000,\n \"currency\": \"USD\"\n },\n \"offer\": {\n \"name\": \"Treasure Chest\",\n \"sku\": \"68452829c5e8\",\n \"displayName\": \"<string>\",\n \"pricePointMetadata\": 123\n },\n \"customer\": {\n \"id\": \"7c99fba665c4a\",\n \"email\": \"customer@appcharge.com\",\n \"identitySignals\": {\n \"firstSeenAt\": \"2021-01-01T00:00:00Z\"\n }\n },\n \"items\": [\n {\n \"name\": \"coins\",\n \"sku\": \"coins_386f9b\",\n \"quantity\": 3300000,\n \"assetUrl\": \"https://media-dev.appcharge.com/coin.png\",\n \"quantityDisplay\": \"3.3M\",\n \"displayName\": \"<string>\"\n }\n ],\n \"countryCode2\": \"US\",\n \"playerIp\": \"<string>\",\n \"receiptMetadata\": {\n \"locale\": \"fr-CA\"\n },\n \"sessionMetadata\": {},\n \"attributes\": {},\n \"redirectUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-publisher-token", "<x-publisher-token>")
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.post("https://api-sandbox.appcharge.com/checkout/v1/session")
.header("x-publisher-token", "<x-publisher-token>")
.header("Content-Type", "application/json")
.body("{\n \"priceDetails\": {\n \"price\": 1000,\n \"currency\": \"USD\"\n },\n \"offer\": {\n \"name\": \"Treasure Chest\",\n \"sku\": \"68452829c5e8\",\n \"displayName\": \"<string>\",\n \"pricePointMetadata\": 123\n },\n \"customer\": {\n \"id\": \"7c99fba665c4a\",\n \"email\": \"customer@appcharge.com\",\n \"identitySignals\": {\n \"firstSeenAt\": \"2021-01-01T00:00:00Z\"\n }\n },\n \"items\": [\n {\n \"name\": \"coins\",\n \"sku\": \"coins_386f9b\",\n \"quantity\": 3300000,\n \"assetUrl\": \"https://media-dev.appcharge.com/coin.png\",\n \"quantityDisplay\": \"3.3M\",\n \"displayName\": \"<string>\"\n }\n ],\n \"countryCode2\": \"US\",\n \"playerIp\": \"<string>\",\n \"receiptMetadata\": {\n \"locale\": \"fr-CA\"\n },\n \"sessionMetadata\": {},\n \"attributes\": {},\n \"redirectUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.appcharge.com/checkout/v1/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-publisher-token"] = '<x-publisher-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"priceDetails\": {\n \"price\": 1000,\n \"currency\": \"USD\"\n },\n \"offer\": {\n \"name\": \"Treasure Chest\",\n \"sku\": \"68452829c5e8\",\n \"displayName\": \"<string>\",\n \"pricePointMetadata\": 123\n },\n \"customer\": {\n \"id\": \"7c99fba665c4a\",\n \"email\": \"customer@appcharge.com\",\n \"identitySignals\": {\n \"firstSeenAt\": \"2021-01-01T00:00:00Z\"\n }\n },\n \"items\": [\n {\n \"name\": \"coins\",\n \"sku\": \"coins_386f9b\",\n \"quantity\": 3300000,\n \"assetUrl\": \"https://media-dev.appcharge.com/coin.png\",\n \"quantityDisplay\": \"3.3M\",\n \"displayName\": \"<string>\"\n }\n ],\n \"countryCode2\": \"US\",\n \"playerIp\": \"<string>\",\n \"receiptMetadata\": {\n \"locale\": \"fr-CA\"\n },\n \"sessionMetadata\": {},\n \"attributes\": {},\n \"redirectUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"checkoutSessionToken": "61ed143b22d24815a713e215e99b0ea6",
"purchaseId": "purchase_abc123def456",
"url": "https://checkout-v2.appcharge.com",
"parsedUrl": "https://pay.appcharge.com/61a164d563c54014b1959a5c78704964#boot={PUBLISHER_BOOT_DATA}"
}{
"errorCode": 0,
"errorMessage": "<string>"
}{
"message": "Blocked player: this player has been blocked. See the blocked player list in the dashboard for more info."
}Headers
Your checkout token that will be presented at Appcharge's dashboard under Admin section -> Integration tab -> Publisher token
Body
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
List of items in the offer.
Show child attributes
Show child attributes
Two-letter country code in ISO-3166 alpha-2 format. Required if playerIp is not provided. Example: US.
"US"
Metadata for the receipt.
Note: If you want the receipt to be sent in a specific language, first configure your translations in the Publisher Dashboard or via the Translations API service, and then include the desired locale here.
Show child attributes
Show child attributes
This entity serves as a versatile container for storing any pertinent information related to the player's session. You can add any additional data you wish to pass as a payload.
A set of custom key-value pairs that you can define to tag players for segmentation and A/B testing. These attributes can then be used to filter players in the Publisher Dashboard.
Example: { "BF_test": "test", "monetization_persona": "non_payer" }
A deeplink URL for redirecting the player to your domain, bringing them back to the game. For more information, see Link Out Without SDK.
Note: This property is not relevant if you're using the Payment Links SDK.
Response
Checkout session created successfully.
Checkout session token. Use this token when calling the Cancel Checkout Session API to cancel the session.
"61ed143b22d24815a713e215e99b0ea6"
Purchase ID.
"purchase_abc123def456"
Checkout session URL hosted on Appcharge.
"https://checkout-v2.appcharge.com"
New checkout session URL hosted on Appcharge.
"https://pay.appcharge.com/61a164d563c54014b1959a5c78704964#boot={PUBLISHER_BOOT_DATA}"
Was this page helpful?
