# Accept crypto payments with payitgo

payitgo is a crypto payment gateway. Your server creates a payment, your
customer pays it in stablecoins or crypto on a checkout page, and payitgo tells
your server, with a signed notification (IPN), when the money has arrived and
is final. The money is then sent to your own wallet, or kept in your payitgo
balance until you withdraw it.

**Base URL:** `https://api.payitgo.co`

## How a payment flows

```
 your server              payitgo                       your customer
     │                      │                               │
     │ 1. POST /v1/payments │                               │
     │─────────────────────▶│                               │
     │◀─ payment + checkout_url                             │
     │                      │                               │
     │ 2. redirect to checkout_url ────────────────────────▶│
     │                      │◀──── 3. pays to the address ──│
     │                      │  (watches the chain)          │
     │◀─ 4. webhook: payment.detecting                      │
     │◀─ 4. webhook: payment.confirmed                      │
     │ 5. verify signature, mark the order paid, answer 200 │
     │                      │                               │
     │◀─ 6. webhook: settlement.completed (money in your wallet)
```

1. **Your server creates a payment** with `POST /v1/payments`: your order id,
   the amount in [your currency](https://payitgo.co/docs/payments.md#your-currency) (US dollars
   unless you name another) and, if you like, the coin. payitgo returns a
   payment with a one-time deposit address, the exact crypto amount at a locked
   rate, and a `checkout_url`.
2. **You send the customer to `checkout_url`** (or show the address, amount and
   QR code on [your own page](https://payitgo.co/docs/checkout.md#your-own-payment-page)). They have 15 minutes to pay once the coin is set.
3. **The customer pays.** payitgo watches the chain: the payment becomes
   `detecting` as soon as the money is seen, and `confirmed` once the network
   has enough confirmations.
4. **payitgo notifies your server** with a webhook (IPN) at each step, signed
   with your webhook secret.
5. **Your server verifies the signature** and, on `payment.confirmed`, marks
   the order paid.
6. **The money is settled**, less payitgo's service fee and the network fee:
   sent to your wallet within minutes (direct settlement), or added to your
   balance (custody). By default the customer pays those fees on top of your
   price, so you receive the full price ([Fees and settlement](https://payitgo.co/docs/settlement.md)).

## Webhooks are payitgo's IPN

If you know them as IPNs: yes, payitgo has IPNs and a signing key.
payitgo's **webhooks** are its IPN, and the **webhook secret** is the
signing key. Every notification carries an `X-Webhook-Signature` header, an
HMAC-SHA256 you check with that secret. Each mode (test, live) has one webhook
URL and one secret, and each payment can name its own `webhook_url`, a
callback URL for that payment alone. See [Webhooks (IPN)](https://payitgo.co/docs/webhooks.md).

## Test mode and live mode

Every account has a test key and a live key:

| Key | Mode | Money | Webhook |
|---|---|---|---|
| Test key | Test | No coins: you simulate what the customer pays, nothing real moves | The test webhook URL and its own secret |
| Live key | Live | Real coins on mainnet | The live webhook URL and its own secret |

A key's text does not say its mode: the dashboard shows each key with a Test
or Live badge, and the key object's `livemode` says it
([Authentication](https://payitgo.co/docs/authentication.md#test-keys-and-live-keys)).

The API is the same in both: build and test your whole integration with the
test key, then swap in the live key and the live webhook secret. New accounts
start in test mode, once the owner has confirmed their email; the owner goes
live from the dashboard when ready. See [Test mode](https://payitgo.co/docs/testing.md).

## Supported coins

USDT (Tron, Ethereum, BNB Smart Chain), USDC (Ethereum, BNB Smart Chain), DAI
(Ethereum), TRX, ETH (Ethereum, BNB Smart Chain), BNB, BTC, LTC, DOGE and XRP,
in both modes, and SHIB and PEPE (Ethereum) once you turn them on. See
[Currencies](https://payitgo.co/docs/currencies.md) for minimums and confirmation times.

## Where to find what

| I want to… | Read |
|---|---|
| Take my first test payment, end to end | [Quickstart](https://payitgo.co/docs/quickstart.md) |
| Use a library (Node.js, Python, PHP, Go, Dart) | [Libraries](https://payitgo.co/docs/sdks.md) |
| Send my API key correctly, manage keys | [Authentication](https://payitgo.co/docs/authentication.md) |
| Know every field of a payment, every status, every error | [Payments](https://payitgo.co/docs/payments.md) |
| Send customers to the hosted page | [Checkout](https://payitgo.co/docs/checkout.md) |
| Show the checkout in a modal in my React app | [React checkout widget](https://payitgo.co/docs/sdk-react.md) |
| Show the amount, address and QR code on my own page, in my own design | [Your own payment page](https://payitgo.co/docs/checkout.md#your-own-payment-page) |
| Receive and verify IPN notifications | [Webhooks (IPN)](https://payitgo.co/docs/webhooks.md) |
| Know which coins and networks are supported | [Currencies](https://payitgo.co/docs/currencies.md) |
| Understand fees, minimums and where my money goes | [Fees and settlement](https://payitgo.co/docs/settlement.md) |
| Pay many recipients at once: payroll, prizes, withdrawals | [Mass payouts](https://payitgo.co/docs/payouts.md) |
| Keep my withdrawals in sync with every payout's outcome, and catch up on missed events | [Staying in sync](https://payitgo.co/docs/payouts.md#staying-in-sync), [Replay missed events](https://payitgo.co/docs/webhooks.md#replay-missed-events) |
| Test every scenario before going live | [Test mode](https://payitgo.co/docs/testing.md) |
| Manage my team, settings, balances and payouts | The dashboard at [payitgo.co](https://payitgo.co), where your team signs in |
| Handle errors, rate limits and retries | [Errors and limits](https://payitgo.co/docs/errors.md) |

Every page is also available as Markdown: add `.md` to its address, for
example [`/docs/payments.md`](https://payitgo.co/docs/payments.md).
