v1

latestOpenAPI 3.1.02026-07-2665153355.3 KB

Create Checkout Session

Creates a checkout session.

post/checkout/v1/session

Headers

x-publisher-tokenstring required

Your checkout token that will be presented at Appcharge's dashboard under Admin section -> Integration tab -> Publisher token

Request body

countryCode2string

Two-letter country code in ISO-3166 alpha-2 format. Required if playerIp is not provided. Example: US.

playerIpstring

Player IP address in IPv4 format. Required if countryCode2 is not provided. Example: 192.0.2.1.

sessionMetadataobject

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.

attributesobject

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" }

redirectUrlstring uri

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.

Example request

{
  "offer": {
    "name": "Treasure Chest",
    "sku": "68452829c5e8"
  },
  "items": [
    {
      "name": "coins",
      "assetUrl": "https://media-dev.appcharge.com/coin.png",
      "sku": "coins_386f9b",
      "quantity": 3300000,
      "quantityDisplay": "3.3M"
    }
  ],
  "countryCode2": "US",
  "customer": {
    "id": "7c99fba665c4a",
    "email": "customer@appcharge.com",
    "identitySignals": {
      "firstSeenAt": "2021-01-01T00:00:00Z"
    }
  },
  "receiptMetadata": {
    "locale": "fr-CA"
  }
}

Response

Checkout session created successfully.

checkoutSessionTokenstring

Checkout session token. Use this token when calling the Cancel Checkout Session API to cancel the session.

purchaseIdstring

Purchase ID.

urlstring

Checkout session URL hosted on Appcharge.

parsedUrlstring

New checkout session URL hosted on Appcharge.

Example response

{
  "checkoutSessionToken": "61ed143b22d24815a713e215e99b0ea6",
  "purchaseId": "purchase_abc123def456",
  "url": "https://checkout-v2.appcharge.com",
  "parsedUrl": "https://pay.appcharge.com/61a164d563c54014b1959a5c78704964#boot={PUBLISHER_BOOT_DATA}"
}