Checkout Links API overview
Learn more about the Checkout Links API
The Checkout Links API allows you to create checkout sessions and accept payments. You send a POST request to Stash with payment related information, and then Stash creates the session and returns a checkout link to you.
Each request requires an authorization header with your API key. The body contains a JSON object with payment related information.
Always call this endpoint from your backend and then pass the checkout link to the client. This ensures that your API key isn't exposed to the internet.
Checkout Link parameters
You can view all parameters in the API Reference but the table highlights the required values.
Parameter | Content | Type |
---|---|---|
shopHandle | The name of your shop. You can find this value in the Details section of Stash Studio. | string |
currency | The currency code to use for the payment. | string |
externalUser | An object containing information about the player that initiated the purchase. | object |
items | An array of items included in the purchase. | array[object] |
externalUser
externalUser
The externalUser
object contains information about the player making the purchase. The ID is what ties the purchase to the player, and it's used in webhook events.
Parameter | Content | Type |
---|---|---|
id | The ID of the user making the purchase. | string |
validatedEmail | An optional validated email for the user. When provided, receipts are sent to this email address. | string |
items[]
items[]
The items[]
array contains each item in the cart. You define items using the following structure.
Parameter | Content | Type |
---|---|---|
id | The item's ID. | string |
pricePerItem | The price for a single item. | string |
quantity | The number of items. | int64 |
imageUrl | The URL to the item's image. | string |
name | The item's name. | string |
description | The item's description. | string |
Response objects
API responses include a JSON object containing a URL. You use this URL on the client side to start the payment flow for the player.
{
"url": "https://test.stash.gg/docsdemos/order/609b-d48c-4b5f4e1",
"id": "609b-d48c-4b5f4e1"
}
Example repositories
There's a Checkout Link client example built with React, as well as a playground. The playground is still in active development.
Updated 5 months ago