# CoinStack > Guides and API reference for CoinStack. > ## Agent Instructions > The CoinStack API base URL is https://coinstack.net/api/v1. Authenticate with an API key sent as 'Authorization: Bearer sk_...' from a server, never from a browser. Every response is a JSON object with 'success' and 'response'. Amounts are strings; token amounts on quotes and payments are in the token's smallest unit. Fulfil an order when its checkout status is 'completed', not when the customer returns to success_url. Verify the CoinStack-Signature header on every webhook using the raw request body. The OpenAPI file is at https://docs.coinstack.net/openapi.json. # Build with AI Source: https://docs.coinstack.net/ai Give coding agents and AI assistants direct access to these docs. These docs are available in forms that AI tools can read directly, so an agent can look up the API while it writes your integration. ## The docs as text The quickest way to give an AI tool these docs is to hand it one of these URLs. There is nothing to install. ``` https://docs.coinstack.net/llms-full.txt ``` That file holds every page of these docs, so an agent can read all of it in one request. | URL | Contents | | - | - | | [`/llms-full.txt`](https://docs.coinstack.net/llms-full.txt) | Every page in one file. | | [`/llms.txt`](https://docs.coinstack.net/llms.txt) | A list of every page with a one-line description and a link. | | Any page URL followed by `.md` | That page as Markdown, for example [`/quickstart.md`](https://docs.coinstack.net/quickstart.md). | The menu at the top of each page can also copy the page as Markdown or open it in an AI assistant. ## OpenAPI The whole API is described in one OpenAPI 3.1 file: ``` https://docs.coinstack.net/openapi.json ``` Use it to generate a client, or give it to an agent as the source of truth for endpoints, fields and error messages. ## MCP server If your tool supports MCP, it can search these docs itself instead of reading them all up front. The server is at: ``` https://docs.coinstack.net/mcp ``` Add it to your tool once: > [tab] Claude > > Open **Settings**, then **Connectors**, select **Add custom connector**, and enter `https://docs.coinstack.net/mcp`. > [tab] Claude Code > > ```bash theme={null} > claude mcp add --transport http coinstack-docs https://docs.coinstack.net/mcp > ``` > [tab] Cursor > > Add this to `mcp.json`: > > ```json theme={null} > { > "mcpServers": { > "coinstack-docs": { > "url": "https://docs.coinstack.net/mcp" > } > } > } > ``` > [tab] VS Code > > Add this to `.vscode/mcp.json`: > > ```json theme={null} > { > "servers": { > "coinstack-docs": { > "type": "http", > "url": "https://docs.coinstack.net/mcp" > } > } > } > ``` ## What to tell an agent If you are writing your own prompt, these are the points integrations most often get wrong: * The base URL is `https://coinstack.net/api/v1`. Authenticate with `Authorization: Bearer sk_...` from a server, never from a browser. * Every response is `{"success": true, "response": {...}}` or `{"success": false, "response": "message"}`. * Amounts are strings. Token amounts on quotes and payments are in the token's smallest unit. * Fulfil an order when its checkout's `status` is `completed`, not when the customer returns to `success_url`. * Verify the `CoinStack-Signature` header on every webhook, using the raw request body. * The same webhook event can arrive more than once. # Authentication Source: https://docs.coinstack.net/api-reference/authentication Authenticate requests with an API key. The API uses API keys. Send your key as a Bearer token on every request. ```bash theme={null} curl https://coinstack.net/api/v1/checkouts \ -H "Authorization: Bearer sk_your_api_key" ``` ## Create a key 1. Sign in to the [dashboard](https://coinstack.net/dashboard) and open **Developers**. 2. Select **New API key**. 3. Give the key a name and choose its access. 4. Copy the key. It is shown only once. Keys start with `sk_`. An account can have up to 10 keys. Only owners and admins of a merchant account can create or delete them. ## Access A key has one of two access levels. | Access | What it can do | | - | - | | Read and write | Everything in this reference. | | Read only | List and get checkouts, payments and tokens. | A read-only key gets a `403` with `Invalid permissions` on every other endpoint, including all webhook and event endpoints. ## Keep keys safe * Use keys only from your server. Do not put a key in a web page, a mobile app or a public repository. * Use a separate key for each system, so you can delete one without affecting the others. * If a key may have leaked, delete it in the dashboard and create a new one. A deleted key stops working straight away. ## Errors | Status | Message | Meaning | | - | - | - | | `401` | `Invalid authentication` | The `Authorization` header is missing, or the key is wrong or deleted. | | `403` | `Invalid permissions` | The key is read only and the endpoint needs write access. | # Create a checkout Source: https://docs.coinstack.net/api-reference/checkouts/create-a-checkout /openapi.json post /checkouts Creates a checkout and returns the URL of its checkout page. Requires an API key with write access. # Expire a checkout Source: https://docs.coinstack.net/api-reference/checkouts/expire-a-checkout /openapi.json post /checkouts/{checkout_id}/expire Closes a checkout now instead of waiting for `expires_at`. Only checkouts with the status `pending` or `partial` can be expired. Sends a `checkout.expired` event. Requires an API key with write access. # Get a checkout Source: https://docs.coinstack.net/api-reference/checkouts/get-a-checkout /openapi.json get /checkouts/{checkout_id} Returns a checkout with its quotes and payments. # List checkouts Source: https://docs.coinstack.net/api-reference/checkouts/list-checkouts /openapi.json get /checkouts Returns your checkouts, newest first. # Resolve a checkout Source: https://docs.coinstack.net/api-reference/checkouts/resolve-a-checkout /openapi.json post /checkouts/{checkout_id}/resolve Marks an underpaid checkout as settled, for when you decide to accept what was paid. The checkout must have the status `partial` or `expired` and must have received a payment. Sends a `checkout.resolved` event. Requires an API key with write access. # Errors Source: https://docs.coinstack.net/api-reference/errors How the API reports a failed request. A failed request returns a `4xx` or `5xx` status and a JSON body with `success` set to `false`. The `response` field holds a short message. ```json theme={null} { "success": false, "response": "Invalid amount" } ``` ## Status codes | Status | Meaning | | - | - | | `200` | The request worked. | | `400` | The request is not valid. The message says which field or why. | | `401` | The API key is missing, wrong or deleted. | | `403` | The API key does not have the access this endpoint needs. | | `404` | The checkout, payment, quote or webhook was not found on your account. | | `500` | Something failed on our side. | ## Messages Validation messages name the field that was rejected, such as `Invalid currency`, `Invalid amount` or `Invalid expires_at`. Each endpoint in this reference lists the messages it can return. Other messages describe a rule that was broken: | Message | Meaning | | - | - | | `Invalid checkout` | The checkout does not exist, or its status does not allow this action. | | `Amount below minimum` | The checkout is worth less than the token's `minimum`. | | `Too many quotes` | The checkout already has 10 quotes. | | `Too many webhooks` | The account already has 10 webhooks. | Messages are written for people. Base your code on the HTTP status and on `success`, not on the exact text. ## Request bodies that are not JSON A request body that is not valid JSON, or that is sent without `Content-Type: application/json`, is rejected before it reaches the endpoint. That response has a `4xx` status and a plain text body instead of the JSON shown above. ## Handling failures * **`400`, `401`, `403`, `404`:** fix the request. Sending the same request again returns the same error. * **`500` and timeouts:** wait a moment and try again. Creating a checkout twice makes two checkouts. If a create request times out, [list checkouts](/api-reference/checkouts/list-checkouts) by the `reference` you sent before trying again, in case the first request went through. # List events Source: https://docs.coinstack.net/api-reference/events/list-events /openapi.json get /events Returns your events, newest first, each with the record of its deliveries to your webhooks. Requires an API key with write access. # Resend an event Source: https://docs.coinstack.net/api-reference/events/resend-an-event /openapi.json post /events/{event_id}/resend Queues an event for delivery again to every webhook that is subscribed to it. The `event_id` in the request your server receives stays the same. Requires an API key with write access. # Overview Source: https://docs.coinstack.net/api-reference/introduction The base URL, request format and response format shared by every endpoint. ## Base URL ``` https://coinstack.net/api/v1 ``` All requests use HTTPS. ## Requests Send your API key in the `Authorization` header on every request. See [Authentication](/api-reference/authentication). Requests with a body send JSON and must include `Content-Type: application/json`. ```bash theme={null} curl https://coinstack.net/api/v1/checkouts \ -H "Authorization: Bearer $COINSTACK_API_KEY" \ -H "Content-Type: application/json" \ -d '{"amount": "25.00", "currency": "USD"}' ``` ## Responses Every response is a JSON object with two fields. | Field | Type | Description | | - | - | - | | `success` | boolean | `true` if the request worked, `false` if it did not. | | `response` | object or string | The result on success. A short error message on failure. | A successful request returns HTTP `200`: ```json theme={null} { "success": true, "response": { "checkout": { "checkout_id": "8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53", "status": "pending" } } } ``` A failed request returns a `4xx` or `5xx` status. See [Errors](/api-reference/errors). ```json theme={null} { "success": false, "response": "Invalid amount" } ``` ## Amounts Amounts are strings, not numbers, so no precision is lost. There are two kinds. | Kind | Example | Used for | | - | - | - | | Decimal | `"25.00000000"` | Money in a currency or in US dollars, such as a checkout's `amount`, `value` and `fee`. | | Smallest unit | `"25000000"` | Token amounts on quotes and payments. Divide by 10 to the power of the token's `decimals` to get the display amount. | `"25000000"` of USDC, which has 6 decimals, is 25 USDC. The number of decimal places in a decimal string can vary, so parse it with a decimal type instead of comparing strings. ## Times Times are RFC 3339 strings in UTC, such as `2026-12-02T16:20:11.482913Z`. ## Pagination List endpoints return the newest results first and accept two query parameters. | Parameter | Description | | - | - | | `limit` | How many results to return, from 1 to 100. The default is 100. | | `cursor` | The `cursor` value from the previous response. Leave it out for the first page. | Each list response includes a `cursor`. Pass it back to get the next page. When it is `null`, there are no more results. ```bash theme={null} curl "https://coinstack.net/api/v1/checkouts?limit=50&cursor=50" \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` ## Empty fields Text fields that have no value are returned as an empty string, not left out. Time fields that have no value yet, such as `completed_at`, are `null`. # Get a payment Source: https://docs.coinstack.net/api-reference/payments/get-a-payment /openapi.json get /payments/{payment_id} Returns one payment. # List payments Source: https://docs.coinstack.net/api-reference/payments/list-payments /openapi.json get /payments Returns your payments, newest first. # Create a quote Source: https://docs.coinstack.net/api-reference/quotes/create-a-quote /openapi.json post /checkouts/{checkout_id}/quotes Returns a deposit address and an amount for paying a checkout with one token on one network. Use this when you show the payment details in your own interface instead of sending the customer to the checkout page. Asking again for the same network and token returns the existing quote. A checkout can have up to 10 quotes. The checkout must have the status `pending` or `partial` and must not be past `expires_at`. Requires an API key with write access. # Refresh a quote Source: https://docs.coinstack.net/api-reference/quotes/refresh-a-quote /openapi.json post /checkouts/{checkout_id}/quotes/{quote_id}/refresh Returns a quote with an amount that is guaranteed again. If the quote has not reached `expires_at` it is returned unchanged. If it has, the amount is recalculated at the current price and `expires_at` moves forward. The deposit address stays the same. Requires an API key with write access. # List tokens Source: https://docs.coinstack.net/api-reference/tokens/list-tokens /openapi.json get /tokens Returns every token and network that can be used to pay right now, with its current price, estimated network cost and minimum checkout value. # Checkout event Source: https://docs.coinstack.net/api-reference/webhook-events/checkout-event /openapi.json webhook checkoutEvent Sent when a checkout changes status. `data.checkout` is the checkout as it was when the event happened. # Payment event Source: https://docs.coinstack.net/api-reference/webhook-events/payment-event /openapi.json webhook paymentEvent Sent when a payment is detected, completed or returned to the sender. `data.payment` is the payment as it was when the event happened. # Create a webhook Source: https://docs.coinstack.net/api-reference/webhooks/create-a-webhook /openapi.json post /webhooks Registers a URL to receive events. The response includes the signing secret, which is shown only once. An account can have up to 10 webhooks. Requires an API key with write access. # Delete a webhook Source: https://docs.coinstack.net/api-reference/webhooks/delete-a-webhook /openapi.json delete /webhooks/{webhook_id} Deletes a webhook. Events that were still waiting to be delivered to it are dropped. Requires an API key with write access. # List webhooks Source: https://docs.coinstack.net/api-reference/webhooks/list-webhooks /openapi.json get /webhooks Returns your webhooks, newest first. Signing secrets are not included. Requires an API key with write access. # Rotate a webhook secret Source: https://docs.coinstack.net/api-reference/webhooks/rotate-a-webhook-secret /openapi.json post /webhooks/{webhook_id}/rotate Replaces a webhook's signing secret. The old secret stops working straight away, so update your server as soon as you have the new one. Requires an API key with write access. # Send a test event Source: https://docs.coinstack.net/api-reference/webhooks/send-a-test-event /openapi.json post /webhooks/{webhook_id}/test Sends a sample `checkout.completed` event to a webhook once and reports how your server answered. The sample checkout is for 10 US dollars and has the reference `test`. It is not saved and does not appear in your events. Requires an API key with write access. # Update a webhook Source: https://docs.coinstack.net/api-reference/webhooks/update-a-webhook /openapi.json patch /webhooks/{webhook_id} Changes a webhook's URL, its events, or both. Fields you leave out stay as they are. Requires an API key with write access. # Checkouts Source: https://docs.coinstack.net/guides/checkouts What a checkout is, the fields you can set, and the statuses it moves through. A checkout is a request for one payment. It has an amount, a page where the customer pays, and a status that tells you whether it has been paid. ## Create a checkout Only `amount` and `currency` are required. ```bash theme={null} curl https://coinstack.net/api/v1/checkouts \ -H "Authorization: Bearer $COINSTACK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": "25.00", "currency": "USD", "email": "customer@example.com", "reference": "order-1042", "description": "Order #1042", "success_url": "https://example.com/orders/1042/thanks", "cancel_url": "https://example.com/cart", "metadata": { "order_id": "1042" } }' ``` | Field | Description | | - | - | | `amount` | The amount to charge, as a string such as `"25.00"`. | | `currency` | One of the [supported currencies](/reference/currencies), such as `USD`. | | `email` | The customer's email address. | | `reference` | Your own identifier, such as an order number. Up to 200 characters. | | `description` | Text shown to the customer on the checkout page. Up to 1,000 characters. | | `success_url` | A link back to your site, shown once the checkout is completed. | | `cancel_url` | A link back to your site, shown before the customer pays and if the checkout expires. | | `metadata` | Up to 50 key-value pairs of your own. Values must be strings. | | `expires_at` | When the checkout closes. Defaults to 24 hours from now. | The full rules for each field are in [Create a checkout](/api-reference/checkouts/create-a-checkout). ### Amount and currency The amount is converted to US dollars when the checkout is created. The result is the checkout's `value`, and it does not change afterwards. A checkout must be worth between 1 and 1,000,000 US dollars. Use no more decimal places than the currency has. `"25.00"` is valid for USD, and `"2500"` is valid for JPY, which has none. ### Return links `success_url` and `cancel_url` are links on the checkout page. They are not redirects, and the customer may close the page without using them, so confirm payment with a [webhook](/guides/webhooks) and not by waiting for the customer to arrive at `success_url`. Put `{CHECKOUT_ID}` anywhere in either URL and it is replaced with the checkout's ID: ``` https://example.com/return?checkout={CHECKOUT_ID} ``` ### Reference and metadata `reference` and `metadata` are stored with the checkout and returned whenever you read it, including in webhook events. Use them to tie a checkout to a record in your own system. You can find checkouts by reference later: ```bash theme={null} curl "https://coinstack.net/api/v1/checkouts?reference=order-1042" \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` References do not have to be unique. If two checkouts share one, both are returned. ## The checkout page Each checkout has a page at its `url`. On it the customer: 1. Chooses a token and network from the ones you accept. 2. Sees the address and the exact amount to send, with a QR code. 3. Watches the page update as the payment is detected and completed. To show these details in your own site or app, see [Build your own checkout](/guides/custom-checkout). ### Settings that change the page Owners and admins of a merchant account can change how its checkout page behaves under **Settings** in the dashboard. | Setting | What it changes | | - | - | | **Checkout layout** | How the first screen offers payment methods: **Grid** or **List**. | | **Payment methods** | Which tokens and networks customers can pay with. | | **Network cost** | Who covers the network cost on each network. Where the customer does, it is added to the amount they pay. See [Fees and settlement](/guides/fees-and-settlement#network-cost). | | **Underpayment** | How far short a payment can fall and still complete the checkout. See [Underpayments and late payments](/guides/underpayments#small-shortfalls). | ## Statuses | Status | Meaning | | - | - | | `pending` | Nothing has been paid yet. | | `confirming` | A payment was detected and is being processed. | | `partial` | Less than the full amount has been paid. The checkout is still open for the rest. | | `completed` | The checkout was paid in full. | | `expired` | The checkout closed before it was paid in full. | | `resolved` | You marked an underpaid checkout as settled. | A checkout starts as `pending` and usually moves to `confirming` and then `completed`. Each change after `pending` sends a [webhook event](/guides/webhooks#events) named after the new status, such as `checkout.completed`. Fulfil an order when its checkout is `completed`. Treat `resolved` as paid too if you use it. Three flags add detail to the status: | Flag | Meaning | | - | - | | `underpaid` | Payments have arrived but add up to less than the full amount. | | `overpaid` | The customer paid more than 2% over the full amount. | | `late` | The payment that completed the checkout arrived after `expires_at`. | [Underpayments and late payments](/guides/underpayments) explains what to do in each case. ## Expiry A checkout closes at `expires_at`. If it has not been paid in full by then, its status becomes `expired`. The default is 24 hours after creation. Set `expires_at` to any time between 10 minutes and 365 days from now: ```json theme={null} { "amount": "25.00", "currency": "USD", "expires_at": "2026-12-02T18:00:00Z" } ``` To close a checkout early, for example when the customer cancels the order, [expire it](/api-reference/checkouts/expire-a-checkout): ```bash theme={null} curl -X POST https://coinstack.net/api/v1/checkouts/8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53/expire \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` Only a `pending` or `partial` checkout can be expired. ## Read a checkout [Get a checkout](/api-reference/checkouts/get-a-checkout) returns the checkout together with its quotes and payments: ```bash theme={null} curl https://coinstack.net/api/v1/checkouts/8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53 \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` `received` is the USDC that has reached your wallet from this checkout so far. It is lower than `value` on a fully paid checkout because the fee has been taken out. Use `status`, not `received`, to decide whether a checkout is paid. See [Fees and settlement](/guides/fees-and-settlement). # Build your own checkout Source: https://docs.coinstack.net/guides/custom-checkout Show the address and amount in your own site or app instead of the checkout page. The checkout page is the quickest way to accept a payment. If you want the customer to stay inside your own interface, you can ask the API for the payment details and show them yourself. The flow has four parts: create a checkout, let the customer pick a token and network, create a quote for that choice, and track the payment. > [!NOTE] > > All of these requests need your API key, so make them from your server and pass the results to your front end. ## 1. Create a checkout Create the checkout as usual. You do not need `success_url` or `cancel_url`, because the customer never sees the checkout page. ```bash theme={null} curl https://coinstack.net/api/v1/checkouts \ -H "Authorization: Bearer $COINSTACK_API_KEY" \ -H "Content-Type: application/json" \ -d '{"amount": "25.00", "currency": "USD", "reference": "order-1042"}' ``` ## 2. Offer tokens and networks [List tokens](/api-reference/tokens/list-tokens) returns every token and network that can be used right now. ```bash theme={null} curl https://coinstack.net/api/v1/tokens \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` ```json theme={null} { "success": true, "response": { "tokens": [ { "network": "base", "token": "USDC", "chain_id": 8453, "contract": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "decimals": 6, "price": "0.99975000", "cost": "0.02356800", "minimum": "1.00000000", "stable": true, "active": true, "created_at": "2026-11-17T03:12:44.190233Z", "updated_at": "2026-12-02T16:19:48.557120Z" } ] } } ``` Before you show an option, check two things: * **The minimum.** Leave out any token whose `minimum` is higher than the checkout's `value`. Networks with a high network cost, such as Bitcoin, have a higher minimum. * **Your own settings.** If you have turned off some tokens or networks under **Settings**, then **Payment methods**, in the dashboard, they still appear in this list. Creating a quote for one of them returns `Invalid token`. Keep `decimals` for each option. You need it to display amounts. ## 3. Create a quote When the customer has chosen, [create a quote](/api-reference/quotes/create-a-quote) for that token and network. ```bash theme={null} curl https://coinstack.net/api/v1/checkouts/8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53/quotes \ -H "Authorization: Bearer $COINSTACK_API_KEY" \ -H "Content-Type: application/json" \ -d '{"network": "base", "token": "USDC"}' ``` ```json theme={null} { "success": true, "response": { "quote": { "checkout_id": "8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53", "quote_id": "0x5c1d9a7e3b6f48021e9d7c4a5b3f6e8d1a2c4b6e8f0a1c3e5d7f9b2a4c6e8d0f", "network": "base", "token": "USDC", "address": "0x7a3e9c5d1b4f8026e9a1c3d5b7f9e2a4c6d8b0f1", "settlement": "base", "recipient": "0x91C4e7B2a6D83f05E2b7A9c4D6f8E1a3B5c7D9F0", "amount": "25000000", "received": "0", "expected": "24.77643200", "rate": "1.00000000", "cost": "0.02356800", "created_at": "2026-12-02T16:21:03.220145Z", "updated_at": "2026-12-02T16:21:03.220145Z", "expires_at": "2026-12-02T17:21:02.981377Z", "remaining": "25000000", "uri": "ethereum:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913@8453/transfer?address=0x7a3e9c5d1b4f8026e9a1c3d5b7f9e2a4c6d8b0f1&uint256=25000000" } } } ``` Show the customer three things from the quote: | Field | What to show | | - | - | | `address` | The address to send to. | | `remaining` | The amount to send. Divide it by 10 to the power of the token's `decimals`. Here `25000000` with 6 decimals is 25 USDC. | | `uri` | A QR code of this value. Wallets that scan it fill in the address and amount. On TRON it is the plain address. | Also show the network name clearly, so the customer sends on the right one. Each quote has its own address, and that address belongs to one checkout. A checkout can have up to 10 quotes. Asking again for the same token and network returns the quote you already have. ### When a quote expires For tokens that are not stablecoins, the amount is based on the price when the quote was made. `expires_at` is when that amount stops being guaranteed: 20 minutes for most tokens and 60 minutes for BTC. After `expires_at`, [refresh the quote](/api-reference/quotes/refresh-a-quote) to get an amount at the current price. The address stays the same. ```bash theme={null} curl -X POST https://coinstack.net/api/v1/checkouts/8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53/quotes/0x5c1d9a7e3b6f48021e9d7c4a5b3f6e8d1a2c4b6e8f0a1c3e5d7f9b2a4c6e8d0f/refresh \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` Show the customer a countdown to `expires_at` and refresh when it runs out. A payment sent after the quote has expired is counted at the market price when it arrived, which can leave the checkout [underpaid](/guides/underpayments#payments-after-the-price-lock). ## 4. Track the payment Use [webhooks](/guides/webhooks) to follow the payment from your server. | Event | What to show the customer | | - | - | | `payment.pending` or `checkout.confirming` | The payment was detected and is confirming. | | `checkout.partial` | Part of the amount arrived. Get the checkout and show the new `remaining`. | | `checkout.completed` | The payment is complete. | | `checkout.expired` | The checkout closed. | To get the current state at any time, for example when the customer reloads the page, [get the checkout](/api-reference/checkouts/get-a-checkout). The response includes every quote with its current `remaining`, and every payment. ```bash theme={null} curl https://coinstack.net/api/v1/checkouts/8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53 \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` After a partial payment, `remaining` on each quote drops to what is still owed. Show the customer the new amount and the same address. # Fees and settlement Source: https://docs.coinstack.net/guides/fees-and-settlement What a payment costs, where the money goes, and how to read the amounts. ## Settlement A wallet is created for each merchant account when the account is set up. Every payment is settled in USDC to that wallet, whatever token and network the customer paid with. * **Balance.** The **Overview** page of the dashboard shows it as **Wallet balance**. * **Address.** The account's owner can see it under **Settings**, then **Settlement**. It is also the `recipient` on every quote and payment. * **Withdrawals.** Only the owner of the merchant account can withdraw from the wallet. ## The fee The CoinStack fee is 0.8% of each payment. It is taken out of the payment before it is settled. There are no setup or monthly fees. ## Network cost Moving a payment from the customer's network to your wallet has a network cost. It is small on most networks and higher on Bitcoin and TRON. [List tokens](/api-reference/tokens/list-tokens) returns the current estimate for each token as `cost`. You choose who covers it for each network under **Settings**, then **Network cost**, in the dashboard: * **Customer.** The cost is added to the amount the customer pays. * **You.** The cost is taken out of what you receive. By default, customers cover it on Bitcoin and TRON, and you cover it everywhere else. ## Reading the amounts A checkout carries the totals for the whole order: | Field | Meaning | | - | - | | `amount` | What you charged, in the checkout's `currency`. | | `value` | The same amount in US dollars, fixed when the checkout was created. | | `fee` | The CoinStack fee for the full amount, in US dollars. | | `received` | The USDC that has reached your wallet from this checkout. | Each payment carries its own breakdown: | Field | Meaning | | - | - | | `amount` | What the customer sent, in the token's smallest unit. | | `value` | What the customer sent, in US dollars. | | `fee` | The CoinStack fee taken from this payment, in US dollars. | | `cost` | The network cost of this payment, in US dollars. | | `settled` | The USDC that reached your wallet. | For a completed payment, `settled` is approximately `value` minus `fee` and `cost`. ### Example A customer pays a 25 US dollar checkout with USDC on Base, where you cover the network cost. | | | | - | - | | Customer sends | 25 USDC | | `value` | 24.99375 | | `fee` | 0.19995 | | `cost` | 0.017368 | | `settled` | 24.776432 | `value` is slightly under 25 because it uses the market price of USDC at the time, which is rarely exactly one dollar. ## Withdrawing Withdraw from the **Overview** page of the dashboard. You can withdraw to any supported token and network. Only the owner of a merchant account can withdraw. Withdrawals are not available through the API. # Payments Source: https://docs.coinstack.net/guides/payments The transfers customers send, and how they change a checkout. A payment is one transfer a customer sent to a checkout's deposit address. Most checkouts have one payment. A checkout has more than one when the customer pays in parts, or sends again after paying too little. You do not create payments. One appears when a transfer is detected. ## Statuses | Status | Meaning | In the dashboard | | - | - | - | | `pending` | The transfer was detected and is being processed. | Confirming | | `completed` | The USDC reached your wallet. | Completed | | `refunded` | The transfer could not be processed and was returned to the sender. | Returned to sender | | `failed` | The transfer could not be processed. | Failed | A payment starts as `pending` and ends in one of the other three. Only `completed` payments count towards a checkout. ## How a payment changes its checkout * While a payment is `pending`, the checkout's status is `confirming`. * When a payment is `completed`, its USDC is added to the checkout's `received`. If the checkout is now paid in full it becomes `completed`. If not, it becomes `partial`. * If a payment ends as `refunded` or `failed`, it adds nothing. A checkout with no other payments goes back to `pending`, or becomes `expired` if it is past `expires_at`. Each completed payment has a `share`: how much of the checkout it covered. `1` is the full amount and `0.4` is 40%. A checkout is paid in full when the shares of its completed payments add up to 1, or fall short by no more than your [underpayment allowance](/guides/underpayments#small-shortfalls). ## Read payments [Get a checkout](/api-reference/checkouts/get-a-checkout) returns its payments along with the checkout. To get payments on their own, [list them](/api-reference/payments/list-payments), optionally for one checkout: ```bash theme={null} curl "https://coinstack.net/api/v1/payments?checkout_id=8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53" \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` ```json theme={null} { "success": true, "response": { "payments": [ { "checkout_id": "8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53", "quote_id": "0x5c1d9a7e3b6f48021e9d7c4a5b3f6e8d1a2c4b6e8f0a1c3e5d7f9b2a4c6e8d0f", "payment_id": "0x5c1d9a7e3b6f48021e9d7c4a5b3f6e8d1a2c4b6e8f0a1c3e5d7f9b2a4c6e8d0f", "network": "base", "token": "USDC", "address": "0x7a3e9c5d1b4f8026e9a1c3d5b7f9e2a4c6d8b0f1", "sender": "0x2b9d4f6a8c1e3057b9d2f4a6c8e0b1d3f5a7c9e2", "settlement": "base", "recipient": "0x91C4e7B2a6D83f05E2b7A9c4D6f8E1a3B5c7D9F0", "status": "completed", "amount": "25000000", "value": "24.99375000", "settled": "24.77643200", "fee": "0.19995000", "cost": "0.01736800", "share": "1.000000000000000000", "deposit_tx_hash": "0x3e7a1c9d5b2f4e6a8c0d1b3f5a7e9c2d4b6f8a0c1e3d5b7f9a2c4e6d8b0f1a3c", "fill_tx_hash": "0x9b2d4f6a8c0e1b3d5f7a9c2e4b6d8f0a1c3e5b7d9f2a4c6e8b0d1f3a5c7e9b2d", "fail_reason": "", "created_at": "2026-12-02T16:23:58.774310Z", "updated_at": "2026-12-02T16:24:37.889456Z", "settled_at": "2026-12-02T16:24:37.889456Z" } ], "cursor": null } } ``` `network` and `token` are what the customer paid with. The amounts are explained in [Fees and settlement](/guides/fees-and-settlement#reading-the-amounts). ## Transactions A payment records two transactions: | Field | Meaning | | - | - | | `deposit_tx_hash` | The transaction the customer sent, on the network they paid on. | | `fill_tx_hash` | The transaction that delivered the USDC to your wallet. Empty until the payment is completed. | Look either one up in a block explorer for its network. ## Events Payments send three [webhook events](/guides/webhooks#events): `payment.pending`, `payment.completed` and `payment.refunded`. No event is sent when a payment ends as `failed`. To decide whether an order is paid, use the checkout's events and status, not the payment's. A completed payment can still leave its checkout `partial`. # Underpayments and late payments Source: https://docs.coinstack.net/guides/underpayments What happens when a customer pays too little, too much or too late. Customers send payments from their own wallets, so the amount and timing are not always exact. This page covers each case and what your integration should do. ## Underpayments ### Small shortfalls A payment that falls slightly short still completes the checkout. How short is set under **Settings**, then **Underpayment**, in the dashboard: * **Percent of the total.** The default is 0.5%. * **Fixed amount in USD.** Off by default. If both are set, the smaller allowance applies. A checkout completed this way has the status `completed`, and `underpaid` is `true` if it was short by one cent or more. ### Partial payments A payment that falls short by more than the allowance moves the checkout to `partial` and sends a `checkout.partial` event. The checkout stays open, and the customer can send the rest to the same address. When the total reaches the full amount, the checkout becomes `completed`. If the checkout reaches `expires_at` while it is still `partial`, it becomes `expired` with `underpaid` set to `true`. The USDC from the partial payment has already reached your wallet. ### Resolving an underpaid checkout When a checkout is `partial` or `expired` and has received a payment, you have two options: * **Accept what was paid.** [Resolve the checkout](/api-reference/checkouts/resolve-a-checkout), or select **Mark as resolved** on the checkout in the dashboard. Its status becomes `resolved` and a `checkout.resolved` event is sent. * **Return the payment.** Send the customer a refund from your own wallet. CoinStack does not send refunds. ```bash theme={null} curl -X POST https://coinstack.net/api/v1/checkouts/8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53/resolve \ -H "Authorization: Bearer $COINSTACK_API_KEY" ``` `resolved` is final. Treat it as paid in your own system. ## Overpayments If the customer pays more than 2% over the full amount, the checkout is `completed` with `overpaid` set to `true`. All of it is settled to your wallet. Compare `received` with what you expected and refund the difference from your own wallet if you choose to. ## Late payments A payment that arrives after `expires_at` is still recorded against the checkout. * If it brings the total to the full amount, the checkout changes from `expired` to `completed`, `late` is set to `true`, and a `checkout.completed` event is sent. * If it does not, the checkout stays `expired` with `underpaid` set to `true`. You can resolve it or refund the customer. Decide in advance how your system handles a `checkout.completed` event for an order you already cancelled. ### Payments after the price lock When a customer chooses a token, the amount is fixed at the price at that moment. That price is held for a limited time: | Token | Price held for | | - | - | | Stablecoins | No limit while the token holds its peg | | BTC | 60 minutes | | All others | 20 minutes | A payment sent after that time, in a token that is not a stablecoin, is counted at the market price when it arrived. If the price has fallen, the payment may no longer cover the full amount and the checkout becomes `partial`. ## Returned payments Sometimes a payment cannot be processed. It is returned to the sender, and the payment's `status` becomes `refunded` with the reason in `fail_reason`. A `payment.refunded` event is sent. A returned payment does not count towards the checkout. ## Summary | What you see | What it means | What to do | | - | - | - | | `completed` | Paid in full, or short by less than your allowance. | Fulfil the order. | | `completed`, `overpaid` | Paid more than 2% over. | Fulfil the order. Refund the extra if you choose to. | | `completed`, `late` | Paid in full after the checkout expired. | Fulfil the order, or refund it if the order is no longer available. | | `partial` | Part of the amount has arrived and the checkout is still open. | Wait for the rest. | | `expired`, `underpaid` | Part of the amount arrived and the checkout closed. | Resolve it or refund the customer. | | `expired` | Nothing was paid. | Nothing. Create a new checkout if the customer wants to try again. | | `resolved` | You accepted an underpayment. | Fulfil the order. | # Webhooks Source: https://docs.coinstack.net/guides/webhooks Get a signed request on your server when a checkout or payment changes. A webhook is a URL on your server. When a checkout or payment changes, CoinStack sends a signed `POST` request to it, so your system learns about the change without asking. ## Add a webhook In the dashboard, open **Developers**, select **Add webhook**, and enter the URL. Or use the API: ```bash theme={null} curl https://coinstack.net/api/v1/webhooks \ -H "Authorization: Bearer $COINSTACK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/webhooks/coinstack", "events": ["checkout.completed", "checkout.expired"] }' ``` The response includes the signing secret. It starts with `whsec_` and is shown only once, so store it now. * The URL must start with `https://` and use a domain name, not an IP address. * Leave `events` out to receive every event. * An account can have up to 10 webhooks. ## Events | Event | Sent when | | - | - | | `checkout.confirming` | A payment was detected and is being processed. | | `checkout.partial` | Less than the full amount has been paid and the checkout is still open. | | `checkout.completed` | The checkout was paid in full. | | `checkout.expired` | The checkout closed before it was paid in full. | | `checkout.resolved` | You marked an underpaid checkout as settled. | | `payment.pending` | A payment was detected. | | `payment.completed` | A payment's USDC reached your wallet. | | `payment.refunded` | A payment could not be processed and was returned to the sender. | Most integrations only need `checkout.completed`. Add `checkout.expired` if you release stock or cancel orders when a checkout closes unpaid. ## The request Every event is a `POST` with a JSON body and a `CoinStack-Signature` header. ```json theme={null} { "event_id": "e41b7c92-3a5d-4f8e-b1c6-9d2a7f4e0b85", "kind": "checkout.completed", "data": { "checkout": { "checkout_id": "8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53", "quote_id": "0x5c1d9a7e3b6f48021e9d7c4a5b3f6e8d1a2c4b6e8f0a1c3e5d7f9b2a4c6e8d0f", "email": "customer@example.com", "reference": "order-1042", "description": "Order #1042", "success_url": "https://example.com/orders/1042/thanks", "cancel_url": "https://example.com/cart", "currency": "USD", "status": "completed", "amount": "25.00000000", "value": "25.00000000", "received": "24.77643200", "fee": "0.20000000", "underpaid": false, "overpaid": false, "late": false, "metadata": { "order_id": "1042" }, "created_at": "2026-12-02T16:20:11.482913Z", "updated_at": "2026-12-02T16:24:37.905218Z", "expires_at": "2026-12-03T16:20:11.482501Z", "completed_at": "2026-12-02T16:24:37.905218Z", "url": "https://coinstack.net/checkout/8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53" } }, "created_at": "2026-12-02T16:24:37.905218Z" } ``` | Field | Description | | - | - | | `event_id` | The event's ID. It stays the same when an event is retried or resent. | | `kind` | The event name. | | `data` | `checkout` for `checkout.*` events and `payment` for `payment.*` events. | | `created_at` | When the event happened. | `data` holds the checkout or payment as it was when the event happened. The fields are the same as in the [API reference](/api-reference/webhook-events/checkout-event). ## Verify the signature Anyone can send a request to your URL, so check that each one came from CoinStack before you act on it. The `CoinStack-Signature` header looks like this: ``` CoinStack-Signature: t=1796228678,v1=0e6494f309fc69039d6469d87098d20bf41703c430fb059d36e057beeb6ce6a4 ``` `t` is the time the request was signed, in Unix seconds. `v1` is the signature. To check it: 1. Read `t` and `v1` from the header. 2. Join `t`, a full stop and the raw request body into one string: `t.body`. 3. Compute the HMAC-SHA256 of that string, using your signing secret as the key, and write it as lowercase hex. 4. Compare the result with `v1` using a constant-time comparison. 5. Reject the request if `t` is more than five minutes old. Use the body exactly as it arrived. If your framework parses the JSON and you turn it back into text, the bytes can differ and the signature will not match. ```javascript Node.js theme={null} import crypto from "node:crypto"; import express from "express"; const app = express(); const secret = process.env.COINSTACK_WEBHOOK_SECRET; function verify(header, body) { const parts = Object.fromEntries( String(header).split(",").map((part) => part.split("=")), ); const expected = Buffer.from( crypto.createHmac("sha256", secret).update(`${parts.t}.${body}`).digest("hex"), ); const given = Buffer.from(String(parts.v1)); return ( given.length === expected.length && crypto.timingSafeEqual(given, expected) && Math.abs(Date.now() / 1000 - Number(parts.t)) <= 300 ); } app.post( "/webhooks/coinstack", express.raw({ type: "application/json" }), (request, response) => { const body = request.body.toString("utf8"); if (!verify(request.get("CoinStack-Signature"), body)) { return response.status(400).send("Invalid signature"); } const event = JSON.parse(body); if (event.kind === "checkout.completed") { // Mark the order for event.data.checkout.checkout_id as paid. } response.sendStatus(200); }, ); app.listen(3000); ``` ```python Python theme={null} import hashlib import hmac import json import os import time from flask import Flask, request app = Flask(__name__) secret = os.environ["COINSTACK_WEBHOOK_SECRET"] def verify(header, body): parts = dict(part.split("=", 1) for part in header.split(",") if "=" in part) timestamp = parts.get("t", "") signed = timestamp.encode() + b"." + body expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest() return ( hmac.compare_digest(parts.get("v1", "").encode(), expected.encode()) and timestamp.isdigit() and abs(time.time() - int(timestamp)) <= 300 ) @app.post("/webhooks/coinstack") def coinstack_webhook(): body = request.get_data() if not verify(request.headers.get("CoinStack-Signature", ""), body): return "Invalid signature", 400 event = json.loads(body) if event["kind"] == "checkout.completed": # Mark the order for event["data"]["checkout"]["checkout_id"] as paid. pass return "", 200 ``` ```php PHP theme={null} 300) { http_response_code(400); exit('Invalid signature'); } $event = json_decode($body, true); if ($event['kind'] === 'checkout.completed') { // Mark the order for $event['data']['checkout']['checkout_id'] as paid. } http_response_code(200); ``` The signing secret is the whole string, including the `whsec_` prefix. ## Respond to an event Answer with any `2xx` status within 10 seconds. Anything else, including a redirect, counts as a failure. Do slow work after you respond. Save the event, return `200`, and process it in the background. ## Retries If a delivery fails, CoinStack tries again after 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 8 hours and 8 hours. That is 8 attempts over about a day. After the last one, the event is not sent again unless you resend it. ## Handle events safely * **Expect duplicates.** The same event can arrive more than once. Record each `event_id` you have handled and skip repeats, or make your handler safe to run twice. * **Do not rely on order.** Events can arrive out of order, and a retried event can arrive after a newer one. If the order matters, [get the checkout](/api-reference/checkouts/get-a-checkout) when an event arrives and act on its current `status`. * **Check that the checkout is yours.** Match `checkout_id` to an order you created before you fulfil anything. ## Test and resend **Send test** on a webhook in the dashboard sends a sample `checkout.completed` event and shows whether your server accepted it. [Send a test event](/api-reference/webhooks/send-a-test-event) does the same through the API. The sample checkout is for 10 US dollars and has the reference `test`. Under **Recent events** in the dashboard you can see each event, whether it was delivered, and send it again. [List events](/api-reference/events/list-events) and [Resend an event](/api-reference/events/resend-an-event) do the same through the API. ## Rotate the secret If a signing secret may have leaked, select **Rotate secret** on the webhook in the dashboard, or call [Rotate a webhook secret](/api-reference/webhooks/rotate-a-webhook-secret). The old secret stops working straight away, so update your server as soon as you have the new one. # Introduction Source: https://docs.coinstack.net/index Accept crypto payments in your store or app. CoinStack lets your customers pay with crypto and settles every payment to you in USDC. You create a checkout for an amount, and the customer pays it with the token and network they choose. The payment is converted to USDC and settled to your wallet. ## How a payment works **1. You create a checkout** Your server asks the API for a checkout, priced in any of [146 currencies](/reference/currencies). **2. The customer pays** The customer opens the checkout page, picks a [token and network](/reference/tokens), and sends the payment from any wallet. **3. The payment settles** The payment is converted to USDC and settled to your wallet. **4. You get notified** CoinStack sends your server a [webhook](/guides/webhooks) when the checkout is completed, so you can fulfil the order. ## Ways to integrate > [card] [Checkout page](/quickstart) > > Create a checkout and send the customer to its page. This is the fastest way to start. > [card] [Your own interface](/guides/custom-checkout) > > Show the address and amount inside your own site or app. > [card] [WHMCS](/integrations/whmcs) > > Accept crypto payments on your WHMCS invoices. > [card] [WooCommerce](/integrations/woocommerce) > > Accept crypto payments in your WooCommerce store. > [card] [Blesta](/integrations/blesta) > > Accept crypto payments on your Blesta invoices. > [card] [PrestaShop](/integrations/prestashop) > > Accept crypto payments in your PrestaShop store. ## Before you start You need a CoinStack account and an API key. Sign in at [coinstack.net/dashboard](https://coinstack.net/dashboard), then create a key under **Developers**. The [quickstart](/quickstart) walks through it. The API lives at `https://coinstack.net/api/v1`. The [API reference](/api-reference/introduction) covers every endpoint. # Blesta Source: https://docs.coinstack.net/integrations/blesta Accept crypto payments on your Blesta invoices. The CoinStack gateway adds crypto as a payment method on your Blesta invoices. Customers pay on the CoinStack checkout page, and the payment is applied to their invoices once it completes, so new orders and renewals activate as they do with any other gateway. ## Requirements * Blesta 6 or newer * The PHP cURL extension * A Blesta address that starts with `https://` ## Install **1. Create an API key** In the [CoinStack dashboard](https://coinstack.net/dashboard), open **Developers** and create an API key with **Read and write** access. **2. Upload the gateway** [Download the gateway](https://coinstack.net/downloads/coinstack-blesta.zip) and unzip it. Copy its `components` folder into your Blesta root. **3. Install it** In Blesta, go to **Settings > Payment Gateways > Available** and install Crypto (CoinStack). **4. Paste the key** Paste the API key, choose the currencies to accept, and save. CoinStack connects when you save. The gateway registers its own webhook, so there are no URLs or secrets to copy. If it cannot connect, the settings are not saved and the page shows why. ## How it works * When a customer chooses to pay with crypto, the gateway creates a checkout for the amount they are paying and shows a **Pay with crypto** button that takes them to it. A customer can pay several invoices with one checkout. * When the checkout is completed, the payment is recorded as a transaction and applied to the invoices. * While a payment is confirming, the transaction shows as pending. If the customer leaves and comes back to pay the same amount, they are sent to the checkout they already have, as long as it is still open. ### Currencies CoinStack accepts invoices in [146 currencies](/reference/currencies). You choose which of them the gateway is offered for in its settings. ### Partial payments If a checkout expires partly paid, what arrived is recorded and applied to the invoices, and the customer can pay the rest from the client area. If you [mark the checkout as resolved](/guides/underpayments#resolving-an-underpaid-checkout) in the CoinStack dashboard, the remainder is recorded and applied as well. ### Refunds Refunds are sent from your own wallet, not from Blesta. ## Troubleshooting If you change the address of your Blesta installation, save the gateway settings again so CoinStack sends payment updates to the new address. If invoices are not being marked paid: * Your Blesta address must start with `https://` and have a valid certificate. * Your firewall or security plugin must allow `POST` requests from outside to `callback/gw/`. Payments and errors are recorded in the gateway log, under **Tools > Logs > Gateway**. # PrestaShop Source: https://docs.coinstack.net/integrations/prestashop Accept crypto payments in your PrestaShop store. The CoinStack module adds crypto as a payment method at checkout. Customers pay on the CoinStack checkout page, and the order is marked paid once the payment completes, so it moves to Payment accepted as it does with any other payment method. ## Requirements * PrestaShop 8 or 9 * The PHP cURL extension * A shop address that starts with `https://` ## Install **1. Create an API key** In the [CoinStack dashboard](https://coinstack.net/dashboard), open **Developers** and create an API key with **Read and write** access. **2. Upload the module** [Download the module](https://coinstack.net/downloads/coinstack-prestashop.zip). In PrestaShop, go to **Modules > Module Manager**, select **Upload a module** and choose the zip file. **3. Paste the key** Open **Configure**, paste the API key and save. The page shows **Connected** once CoinStack is set up. The module registers its own webhook, so there are no URLs or secrets to copy. If it cannot connect, the page shows why. ## How it works * When a customer chooses **Pay with crypto** and places the order, the module creates a checkout for the cart total and sends the customer to it. * When a payment is detected, the order is created with the status Awaiting crypto payment. * When the checkout is completed, the payment is recorded on the order and it moves to Payment accepted. No order exists until a payment is detected. A customer who leaves the checkout without paying keeps their cart and can choose another payment method. They get no order email, and no stock is held. ### Currencies CoinStack accepts orders in [146 currencies](/reference/currencies). You choose which of your shop's currencies it is offered for under **Payment > Preferences**. For a currency CoinStack does not accept, it is not shown at checkout. ### Partial payments If a customer pays less than the order total, the order stays at Awaiting crypto payment and its page gives them a link to pay the rest. If the checkout expires before they do, the order moves to Payment error with a note in its messages. [Mark the checkout as resolved](/guides/underpayments#resolving-an-underpaid-checkout) in your CoinStack dashboard to mark the order paid, or refund the customer. ### Orders that need a look The module leaves a note in the order's messages instead of marking it paid when: * The cart changed after the checkout was opened, so the amount paid does not match the order total. The order moves to Payment error. * The customer paid with crypto after already placing the same order with another payment method. The note is left on that order. ### Refunds Refunds are sent from your own wallet, not from PrestaShop. ## Troubleshooting If orders are not being created or marked paid: * Your shop address must start with `https://` and have a valid certificate. SSL is turned on under **Shop Parameters > General**. * Your firewall or security module must allow `POST` requests from outside to `index.php?fc=module&module=coinstack&controller=webhook`, or to `module/coinstack/webhook` if friendly URLs are on. Errors are recorded under **Advanced Parameters > Logs**. # WHMCS Source: https://docs.coinstack.net/integrations/whmcs Accept crypto payments on your WHMCS invoices. The CoinStack gateway module adds crypto as a payment method on your WHMCS invoices. Customers pay on the CoinStack checkout page, and the invoice is marked paid once the payment completes, so new orders and renewals activate as they do with any other gateway. ## Requirements * WHMCS 8 or 9 * The PHP cURL extension * A System URL that starts with `https://` ## Install **1. Create an API key** In the [CoinStack dashboard](https://coinstack.net/dashboard), open **Developers** and create an API key with **Read and write** access. **2. Upload the module** [Download the module](https://coinstack.net/downloads/coinstack-whmcs.zip) and unzip it. Copy its `modules` and `includes` folders into your WHMCS root. **3. Activate the gateway** In WHMCS, go to **Configuration > System Settings > Payment Gateways** and activate CoinStack. **4. Paste the key** Paste the API key into the gateway settings and save. CoinStack connects within a few minutes. The module registers its own webhook, so there are no URLs or secrets to copy. The **Connection** line in the gateway settings shows whether it is connected and, if not, why. Reload the page to see the latest result. ## How it works * When a customer pays an invoice with CoinStack, the module creates a checkout for the invoice balance and sends the customer to it. * When the checkout is completed, the payment is recorded on the invoice and the invoice is marked paid. * While a payment is confirming, the invoice shows as Payment Pending. ### Currencies CoinStack accepts invoices in [146 currencies](/reference/currencies). For a currency it does not accept, set **Convert To For Processing** on the gateway to one it does, such as USD. ### Partial payments If a checkout expires partly paid, what arrived is recorded on the invoice and the customer can pay the rest from the invoice page. If you [mark the checkout as resolved](/guides/underpayments#resolving-an-underpaid-checkout) in the CoinStack dashboard, the remainder is recorded and the invoice is marked paid. ### Refunds Refunds are sent from your own wallet, not from WHMCS. ## Troubleshooting If invoices are not being marked paid: * Your System URL, under **Configuration > System Settings > General Settings**, must start with `https://` and have a valid certificate. * Your firewall or security plugin must allow `POST` requests from outside to `modules/gateways/callback/coinstack.php`. * The WHMCS cron must be running. The module also uses it to catch up on any payment updates it missed. Payments and errors are recorded in the Gateway Log, under **Billing > Gateway Log**. Anything that needs your attention is noted in the Activity Log, under **Configuration > System Logs**. # WooCommerce Source: https://docs.coinstack.net/integrations/woocommerce Accept crypto payments in your WooCommerce store. CoinStack for WooCommerce adds crypto as a payment method at checkout. Customers pay on the CoinStack checkout page, and the order is marked paid once the payment completes, so it moves to Processing as it does with any other payment method. It works with both the block checkout and the classic checkout. ## Requirements * WordPress 6.5 or newer * WooCommerce 8.3 or newer * PHP 7.4 or newer * A site address that starts with `https://` ## Install **1. Create an API key** In the [CoinStack dashboard](https://coinstack.net/dashboard), open **Developers** and create an API key with **Read and write** access. **2. Install the plugin** In WordPress, go to **Plugins > Add New Plugin**, search for **CoinStack for WooCommerce**, then select **Install Now** and **Activate**. The plugin is also on [WordPress.org](https://wordpress.org/plugins/coinstack-for-woocommerce/). To install it by hand, [download the zip](https://coinstack.net/downloads/coinstack-woocommerce.zip) and upload it under **Plugins > Add New Plugin > Upload Plugin**. **3. Enable it** Go to **WooCommerce > Settings > Payments > CoinStack**, tick **Enable CoinStack**, paste the API key and save. The settings page shows **Connected** once CoinStack is set up. The plugin registers its own webhook, so there are no URLs or secrets to copy. You can change the name and description customers see at checkout on the same settings page. ## How it works * When a customer places an order with CoinStack, the plugin creates a checkout for the order total and sends the customer to it. * When the checkout is completed, the order is marked paid and moves to Processing. * While a payment is confirming, the order is put on hold with a note. * When an unpaid order is cancelled, the plugin closes its checkout. Every payment update is added to the order as a note. ### Currencies CoinStack accepts stores in [146 currencies](/reference/currencies). If your store uses a currency CoinStack does not accept, CoinStack is not shown at checkout. ### Partial payments If a customer pays less than the order total, the order is put on hold with a note while the customer pays the rest. If the checkout expires before they do, [mark it as resolved](/guides/underpayments#resolving-an-underpaid-checkout) in your CoinStack dashboard to mark the order paid, or refund the customer. ### Refunds Refunds are sent from your own wallet, not from WooCommerce. ## Troubleshooting If orders are not being marked paid: * Your site address, under **Settings > General**, must start with `https://` and have a valid certificate. * Your firewall or security plugin must allow `POST` requests from outside to `/wc-api/coinstack/`. Errors are recorded under **WooCommerce > Status > Logs**, with the source `coinstack`. ## Data sent to CoinStack The plugin connects to the CoinStack API at `https://coinstack.net/api/v1`. * When a customer places an order with CoinStack, it sends the order total, currency, order number, the customer's email address, links back to your store, the order ID, the customer ID and your site's domain. * When you save the settings, and every few minutes after that, it checks that CoinStack knows where to send payment updates for your store. * When CoinStack sends a payment update, when a customer returns from the checkout, and every few minutes for recent unpaid orders, it looks up the checkout's status. # Quickstart Source: https://docs.coinstack.net/quickstart Create a checkout, send your customer to it, and confirm the payment. This guide walks through accepting a payment with the checkout page. It needs a CoinStack account and a server that can make HTTPS requests. ## 1. Create an API key 1. Sign in to the [dashboard](https://coinstack.net/dashboard) and open **Developers**. 2. Select **New API key**, give it a name, and set **Access** to **Read and write**. 3. Copy the key. It starts with `sk_` and is shown only once. Keep the key on your server. Anyone who has it can create checkouts on your account. ## 2. Create a checkout Send the amount and currency from your server. The other fields are optional. ```bash cURL theme={null} curl https://coinstack.net/api/v1/checkouts \ -H "Authorization: Bearer $COINSTACK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": "25.00", "currency": "USD", "reference": "order-1042", "success_url": "https://example.com/orders/1042/thanks", "cancel_url": "https://example.com/cart" }' ``` ```javascript Node.js theme={null} const response = await fetch("https://coinstack.net/api/v1/checkouts", { method: "POST", headers: { Authorization: `Bearer ${process.env.COINSTACK_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ amount: "25.00", currency: "USD", reference: "order-1042", success_url: "https://example.com/orders/1042/thanks", cancel_url: "https://example.com/cart", }), }); const body = await response.json(); if (!body.success) { throw new Error(body.response); } console.log(body.response.checkout.url); ``` ```python Python theme={null} import os import requests response = requests.post( "https://coinstack.net/api/v1/checkouts", headers={"Authorization": f"Bearer {os.environ['COINSTACK_API_KEY']}"}, json={ "amount": "25.00", "currency": "USD", "reference": "order-1042", "success_url": "https://example.com/orders/1042/thanks", "cancel_url": "https://example.com/cart", }, timeout=30, ) body = response.json() if not body["success"]: raise RuntimeError(body["response"]) print(body["response"]["checkout"]["url"]) ``` ```php PHP theme={null} true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('COINSTACK_API_KEY'), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => json_encode([ 'amount' => '25.00', 'currency' => 'USD', 'reference' => 'order-1042', 'success_url' => 'https://example.com/orders/1042/thanks', 'cancel_url' => 'https://example.com/cart', ]), ]); $body = json_decode(curl_exec($curl), true); if (!$body['success']) { throw new RuntimeException($body['response']); } echo $body['response']['checkout']['url']; ``` The response holds the new checkout: ```json theme={null} { "success": true, "response": { "checkout": { "checkout_id": "8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53", "quote_id": "", "email": "", "reference": "order-1042", "description": "", "success_url": "https://example.com/orders/1042/thanks", "cancel_url": "https://example.com/cart", "currency": "USD", "status": "pending", "amount": "25.00000000", "value": "25.00000000", "received": "0", "fee": "0.20000000", "underpaid": false, "overpaid": false, "late": false, "metadata": {}, "created_at": "2026-12-02T16:20:11.482913Z", "updated_at": "2026-12-02T16:20:11.482913Z", "expires_at": "2026-12-03T16:20:11.482501Z", "completed_at": null, "url": "https://coinstack.net/checkout/8f3b2c1e-5d47-4a9b-b6e0-2c7f1a9d4e53" } } } ``` Save `checkout_id` with your order so you can match the payment to it later. ## 3. Send the customer to the checkout page Redirect the customer to `url`. On that page they choose a token and network, see the address and amount, and watch the payment confirm. When the checkout is completed, the page shows a **Return to merchant** button that links to your `success_url`. A checkout stays open for 24 hours unless you set `expires_at`. ## 4. Confirm the payment Do not rely on the customer returning to your site. Use a webhook to learn that the checkout was paid. 1. In the dashboard, open **Developers** and select **Add webhook**. 2. Enter an `https://` URL on your server and save. 3. Copy the signing secret. It starts with `whsec_` and is shown only once. CoinStack sends a `checkout.completed` event to that URL when the checkout is paid in full. [Verify the signature](/guides/webhooks#verify-the-signature), then fulfil the order whose `checkout_id` matches. You can also check at any time by [getting the checkout](/api-reference/checkouts/get-a-checkout) and reading its `status`. ## Try it CoinStack has no test mode. Every checkout takes a real payment. * To see the checkout page without paying, open the [demo checkout](https://coinstack.net/checkout/demo). * To check that your server receives webhooks, use **Send test** on the webhook in the dashboard, or call [Send a test event](/api-reference/webhooks/send-a-test-event). * To run the whole flow, create a checkout for a small amount and pay it. The smallest checkout is worth 1 US dollar. ## Next steps > [card] [Checkouts](/guides/checkouts) > > The fields you can set and the statuses a checkout moves through. > [card] [Webhooks](/guides/webhooks) > > The events, the signature, and what happens when a delivery fails. # Currencies Source: https://docs.coinstack.net/reference/currencies The 146 currencies a checkout can be priced in. Set a checkout's `currency` to any code on this page. The amount is converted to US dollars when the checkout is created, and the checkout must be worth between 1 and 1,000,000 US dollars. An `amount` can use up to the number of decimal places its currency has. Sending more returns `Invalid amount`. ## Two decimal places 111 currencies. `"25.00"` and `"25"` are valid. `"25.001"` is not. `AED`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `BTN`, `BWP`, `BZD`, `CAD`, `CDF`, `CHF`, `CNY`, `CRC`, `CVE`, `CZK`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `ILS`, `INR`, `JMD`, `KES`, `KGS`, `KHR`, `KYD`, `KZT`, `LKR`, `LRD`, `LSL`, `MAD`, `MDL`, `MKD`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `PAB`, `PEN`, `PGK`, `PHP`, `PLN`, `QAR`, `RON`, `RSD`, `RUB`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SRD`, `SSP`, `SVC`, `SZL`, `THB`, `TJS`, `TMT`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `USD`, `UYU`, `UZS`, `WST`, `XCD`, `ZAR`, `ZMW` ## No decimal places 29 currencies. `"2500"` is valid. `"2500.5"` is not. `AFN`, `ALL`, `BIF`, `CLP`, `COP`, `DJF`, `GNF`, `HUF`, `IDR`, `IQD`, `ISK`, `JPY`, `KMF`, `KRW`, `LAK`, `LBP`, `MGA`, `MMK`, `PKR`, `PYG`, `RWF`, `SOS`, `UGX`, `VND`, `VUV`, `XAF`, `XOF`, `XPF`, `YER` ## Three decimal places 6 currencies. `"25.125"` is valid. `"25.1255"` is not. `BHD`, `JOD`, `KWD`, `LYD`, `OMR`, `TND` # Tokens and networks Source: https://docs.coinstack.net/reference/tokens What customers can pay with. Customers can pay with 10 tokens across 11 networks. Whatever they choose, you receive USDC. ## Networks Use the identifier in the first column wherever the API takes a `network`. | Network | Name | Tokens | | - | - | - | | `bitcoin` | Bitcoin | BTC | | `ethereum` | Ethereum | ETH, USDC, USDT, PYUSD, USDG | | `solana` | Solana | SOL, USDC, USDT, PYUSD, USDG | | `base` | Base | ETH, USDC, USDT | | `arbitrum` | Arbitrum | ETH, USDC, USDT | | `optimism` | Optimism | ETH, USDC, USDT | | `polygon` | Polygon | USDC, USDT | | `avalanche` | Avalanche | USDC | | `bnb` | BNB Smart Chain | BNB, USDC, USDT | | `hyperevm` | HyperEVM | HYPE, USDC | | `tron` | TRON | TRX, USDT | This table can fall behind. [List tokens](/api-reference/tokens/list-tokens) always returns what is available right now, and is the list to build against. ## Tokens Use the symbol wherever the API takes a `token`. | Token | Name | Stablecoin | | - | - | - | | `USDC` | USD Coin | Yes | | `USDT` | Tether | Yes | | `PYUSD` | PayPal USD | Yes | | `USDG` | Global Dollar | Yes | | `BTC` | Bitcoin | No | | `ETH` | Ethereum | No | | `SOL` | Solana | No | | `BNB` | BNB | No | | `TRX` | TRON | No | | `HYPE` | Hyperliquid | No | ## Minimums Each token on each network has a `minimum`: the smallest checkout value, in US dollars, that can be paid with it. It is 1 US dollar on most networks and higher where the network cost is high, such as Bitcoin and TRON. A checkout worth less than a token's minimum does not offer that token. ## Choosing what you accept By default your checkout offers every token on every network. To narrow it down, open **Settings** in the dashboard and change **Payment methods**. A token is offered on every selected network that supports it.