Skip to main content
This guide walks you through setting up the Yativo Crypto Payment Gateway to accept payments. By the end, you’ll have a working payment flow: create a payment intent, share a link, and receive crypto.
1

Authenticate

Get a Bearer token using your API key:
curl -X POST 'https://crypto-api.yativo.com/api/v1/auth/token' \
  -H 'Content-Type: application/json' \
  -d '{
    "api_key": "yativo_...",
    "api_secret": "..."
  }'
Response
{
  "success": true,
  "data": {
    "access_token": "eyJhbGciOi...",
    "token_type": "Bearer",
    "expires_in": 86400
  }
}
2

Create a payment intent

Create a payment intent with the amount and currency:
curl -X POST 'https://crypto-api.yativo.com/api/v1/crypto-gateway/payments' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "amount": 49.99,
    "currency": "USD",
    "description": "Pro Plan - Monthly",
    "metadata": {
      "order_id": "ord_123"
    }
  }'
Response
{
  "success": true,
  "data": {
    "payment_id": "gw_01HX9KZMB3F7VNQP8R2WDGT4E5",
    "amount": 49.99,
    "currency": "USD",
    "status": "pending",
    "checkout_url": "https://pay.yativo.com/gw_01HX9KZMB3F7VNQP8R2WDGT4E5",
    "expires_at": "2026-03-25T11:00:00Z",
    "created_at": "2026-03-25T10:00:00Z"
  }
}
Redirect your customer to the checkout_url.
3

Share the checkout link

Redirect your customer to the checkout_url, or embed it in:
  • An email invoice
  • A QR code
  • A “Pay with Crypto” button on your site
  • A Telegram/Discord bot message
The hosted checkout page handles chain selection, wallet connection, and payment confirmation.
4

Listen for webhook

Set up a webhook to get notified when the payment is confirmed:
curl -X POST 'https://crypto-api.yativo.com/api/v1/webhook/create-webhook' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://your-server.com/webhooks/yativo",
    "events": ["gateway.payment.paid"]
  }'
Webhook Payload
{
  "event": "gateway.payment.paid",
  "data": {
    "payment_id": "gw_01HX9KZMB3F7VNQP8R2WDGT4E5",
    "amount": 49.99,
    "currency": "USD",
    "crypto_amount": "49.99",
    "crypto_currency": "USDC",
    "chain": "solana",
    "tx_hash": "5UxR7Kq...",
    "status": "paid",
    "metadata": {
      "order_id": "ord_123"
    },
    "paid_at": "2026-03-25T10:05:00Z"
  }
}
5

Verify and fulfill

When your webhook endpoint receives the gateway.payment.paid event, verify the payment amount and fulfill the order:
app.post('/webhooks/yativo', (req, res) => {
  const { event, data } = req.body;
  
  if (event === 'gateway.payment.paid') {
    const { payment_id, amount, metadata } = data;
    // Fulfill the order using metadata.order_id
    fulfillOrder(metadata.order_id);
  }
  
  res.status(200).send('ok');
});

Full Example (TypeScript)

import { YativoCrypto } from '@yativo/crypto-sdk';

const client = new YativoCrypto({
  apiKey: process.env.YATIVO_API_KEY!,
  apiSecret: process.env.YATIVO_API_SECRET!,
});

// Create a payment for a customer's order
async function createPayment(orderId: string, amount: number) {
  const payment = await client.gateway.createPayment({
    amount,
    currency: 'USD',
    description: `Order #${orderId}`,
    metadata: { order_id: orderId },
  });

  return payment.checkout_url; // Send this to your customer
}

Next Steps

Payment Gateway

Full Payment Gateway documentation.

Webhook Integration

Set up and verify webhooks.