# Quickstart

Accept your first crypto payment in about 30 minutes. You will create a payment on your server, send the
customer to checkout, and fulfil the order when our webhook arrives.

## 1. Create an account and a test app
1. [Sign up](/signup) and verify your email.
2. Switch the dashboard to **Test** mode (top bar).
3. **Wallets → Add wallet**: add any address on BNB Smart Chain (test wallets activate instantly).
4. **API apps → New app**: copy the **secret key** (`sk_test_…`) — it is shown once.
5. In the app, set your **webhook URL** and copy the **signing secret** (`whsec_…`).

Keep both secrets on your server (environment variables), never in browser code.

## 2. Create a payment (server)
```bash
curl https://razcryptogateway.com/v1/payments \
  -H "Authorization: Bearer $RAZCRYPTO_SECRET_KEY" \
  -H "Idempotency-Key: order_1042" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "25.00",
    "currency": "USD",
    "reference_id": "order_1042",
    "redirect_url": "https://shop.example/thanks"
  }'
```
The response contains `id` (`pay_…`) and `checkout_url`. Save the `id` with your order.

- `amount` + `currency` can be fiat (`USD`, `INR`, `EUR`…) — we convert at a locked rate — or a coin
  (`USDT`) for an exact crypto amount.
- `Idempotency-Key` makes retries safe: the same key never creates a second payment.

## 3. Send the customer to checkout
**Option A — redirect** to `checkout_url`. After paying, the customer returns to your `redirect_url`
with `payment_id`, `reference_id`, `status` and a `signature`.

**Option B — popup on your page** with `checkout.js`:
```html
<script src="https://razcryptogateway.com/v1/checkout.js"></script>
<script>
  RazCrypto.open({
    key: "pk_test_…",
    payment_id: "pay_…",
    onSuccess: (res) => fetch("/verify-payment", { method: "POST", body: JSON.stringify(res) }),
  });
</script>
```
See [Checkout](/docs/checkout) for every option and how to verify the `signature`.

## 4. Fulfil the order from the webhook
We `POST` a signed event to your webhook URL:
```json
{ "type": "payment.paid", "data": { "object": { "id": "pay_…", "reference_id": "order_1042", "status": "paid" } } }
```
Verify the `webhook-signature` header with your signing secret (code for Node, PHP and Python in
[Webhooks](/docs/webhooks)), then mark the order paid. Respond `2xx` quickly; we retry failures for
3 days.

## 5. Test every outcome
In test mode, call `POST /v1/payments/{id}/simulate` with `paid`, `underpaid`, `overpaid`, `expired`
or `cancelled` (or use the buttons on the payment page in the dashboard). Real webhooks are sent.
See [Test mode](/docs/test-mode).

## 6. Go live
Switch to **Live**, add your real wallets (confirmed with your password or 2FA), create a live app, and
replace the test keys with `sk_live_…` / `pk_live_…`. Read [Going live](/docs/going-live).
