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

# Quickstart

> Create your first CHIP Collect test purchase in under 5 minutes.

This walkthrough creates a real test purchase against the CHIP Collect sandbox
and returns a working checkout URL. By the end you'll have a complete
end-to-end payment flow you can copy into your own application.

<Info>
  Use a **test mode** API key for the entire quickstart. Live keys are not
  required and should not be used here. You can generate a test key from the
  [CHIP merchant portal](https://portal.chip-in.asia/collect/developers/api-keys).
</Info>

## Prerequisites

* A CHIP merchant account
* A test mode **Secret Key** and **Brand ID** from the merchant portal
* `curl` (or any HTTP client)

## 1. Create a test purchase

Send a `POST` request to the CHIP Collect API to create a purchase. The
response includes a `checkout_url` that you can open in a browser to complete
a fake payment.

```bash theme={null}
curl -X POST "https://gate.chip-in.asia/api/v1/purchases/" \
  -H "Authorization: Bearer <your_secret_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "brand_id": "<your_brand_id>",
    "client": {
      "email": "buyer@example.com"
    },
    "purchase": {
      "products": [
        {
          "name": "Test Product",
          "price": 100
        }
      ]
    },
    "success_redirect": "https://example.com/success",
    "failure_redirect": "https://example.com/failure"
  }'
```

A successful response looks like:

```json theme={null}
{
  "id": "8c3a2f4e-6b1d-4a5e-9c8b-2d3f1e4a5b6c",
  "status": "created",
  "checkout_url": "https://gate.chip-in.asia/p/8c3a2f4e-6b1d-4a5e-9c8b-2d3f1e4a5b6c/",
  "company_id": "...",
  "brand_id": "...",
  "client": { "email": "buyer@example.com" },
  "purchase": { "products": [{ "name": "Test Product", "price": 100 }] }
}
```

<Note>
  The `price` field is in the smallest currency unit. `100` equals RM 1.00
  (or MYR 1.00).
</Note>

## 2. Open the checkout URL

Copy the `checkout_url` from the response and open it in your browser. In
test mode, the hosted payment page lets you simulate a successful payment
without redirecting to a real bank.

## 3. Check the purchase status

After the test payment completes, query the purchase to confirm its status:

```bash theme={null}
curl "https://gate.chip-in.asia/api/v1/purchases/8c3a2f4e-6b1d-4a5e-9c8b-2d3f1e4a5b6c/" \
  -H "Authorization: Bearer <your_secret_key>"
```

The `status` field will move from `created` to `paid` once the test
payment succeeds.

## 4. Receive a server-side notification with `success_callback`

`success_redirect` only fires when the buyer reaches your site in a
browser. To know about payments that succeed without a redirect — for
example, when the buyer closes the tab, pays through an e-wallet, or
completes the payment asynchronously — pass a `success_callback` URL
when creating the purchase. CHIP will `POST` the full purchase object to
that URL the moment the payment is captured.

```json theme={null}
{
  "client": { "email": "buyer@example.com" },
  "purchase": { "products": [{ "name": "Test Product", "price": 100 }] },
  "success_redirect": "https://example.com/success",
  "failure_redirect": "https://example.com/failure",
  "success_callback": "https://example.com/webhooks/chip"
}
```

`success_callback` payloads are signed with an RSA signature in the
`X-Signature` header — see [Verifying webhook signatures](/chip-collect/overview/authentication#2-verifying-webhook-signatures)
for the verification algorithm and code samples.

<Info>
  Use [Webhooks](/chip-collect/api-reference/webhooks/create) when you
  need a single endpoint that listens for **multiple event types**
  across many purchases (e.g. `purchase.paid`, `purchase.payment_failure`,
  `purchase.refunded`). For a single purchase that just needs a
  "payment is done" notification, `success_callback` is the simpler
  choice.
</Info>

## Next steps

* [Authentication](/chip-collect/overview/authentication) — Bearer token
  and webhook signature verification
* [Online Purchases](/chip-collect/overview/online-purchases/payment-link) —
  payment links, subscriptions, and pre-auth
* [Direct Post & Skip payment page](/chip-collect/overview/direct-post/intro) —
  embed the checkout on your own site
* [Integrate with AI agents](/chip-collect/overview/vibe-coding-guide) —
  use the CHIP skill with Cursor, Codex, or any AI-powered IDE
* [Errors](/chip-collect/overview/errors) — common error codes and what to do
  about them
