> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coinstack.net/llms.txt
> Use this file to discover all available pages before exploring further.

> ## 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.

# 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](https://docs.coinstack.net/guides/underpayments.md#small-shortfalls).

## Read payments

[Get a checkout](https://docs.coinstack.net/api-reference/checkouts/get-a-checkout.md) returns its payments along with the checkout. To get payments on their own, [list them](https://docs.coinstack.net/api-reference/payments/list-payments.md), 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](https://docs.coinstack.net/guides/fees-and-settlement.md#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](https://docs.coinstack.net/guides/webhooks.md#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`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.