Home › Developers
Developers · REST API v1

Go live in an afternoon

One order API, one Checkout, six ready-to-copy integrations. Pick your stack below and follow the steps: create an order, collect the payment, verify the signature, then confirm with webhooks.

Base URL https://api.risepayx.com/v1Auth HTTP Basic (key_id : key_secret)Amounts integer paise

How an integration works

The same four steps apply on every platform. Your key secret stays on your server; apps and browsers only ever see the public key id.

1Server

Create an order

POST /orders with amount, currency and receipt. Send order_id to the client.

2Client

Open Checkout

Web, Android or Flutter opens Checkout with order_id and your public key id.

3Customer

Pays

UPI, card, wallet, Pay Later, EMI or net banking. Risepay handles 3-D Secure and bank redirects.

4Server

Verify and fulfil

Check the signature, then rely on the payment.captured webhook as the source of truth.

Sandbox and live keysKeys starting rp_sandbox_ never move money. Switch to rp_live_ after KYC approval.
IdempotencySend an Idempotency-Key header on every POST so retries never create duplicate orders.
SignaturesCheckout: HMAC-SHA256 of order_id|payment_id with your key secret. Webhooks: HMAC of the raw body.

Choose your SDK

Each tab holds a complete flow with install, configuration, order creation, Checkout, verification, webhooks and refunds where they apply.

Node.js integration

Create orders and verify payments on your Express server, then open Risepay Checkout in the browser.

JavaScriptExpress 4Node 18+
1

Install

Terminal
npm install risepay express dotenv
# .env
RP_KEY_ID=rp_sandbox_XXXXXXXXXXXX
RP_KEY_SECRET=your_key_secret
RP_WEBHOOK_SECRET=your_webhook_secret
2

Configure the client

server.js
require('dotenv').config();
const express = require('express');
const crypto  = require('crypto');
const Risepay = require('risepay');

const rp = new Risepay({
  keyId:     process.env.RP_KEY_ID,
  keySecret: process.env.RP_KEY_SECRET,
  // baseUrl: 'https://api.risepayx.com/v1'   // default
});

const app = express();
3

Create an order (server)

server.js
app.post('/api/orders', express.json(), async (req, res) => {
  try {
    const order = await rp.orders.create({
      amount:   249900,                 // paise (INR 2,499.00)
      currency: 'INR',
      receipt:  'INV-2026-1042',
      methods:  ['upi', 'card', 'wallet', 'paylater', 'emi', 'netbanking'],
      notes:    { customer_id: 'C-8841' },
    }, { idempotencyKey: req.body.cartId });   // safe to retry

    res.json({ order_id: order.id, amount: order.amount, key_id: process.env.RP_KEY_ID });
  } catch (e) {
    res.status(e.status || 500).json({ error: e.code, message: e.message });
  }
});
4

Open Checkout (browser)

checkout.html
<script src="https://checkout.risepayx.com/v1/checkout.js"></script>
<script>
  async function pay() {
    const o = await (await fetch('/api/orders', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ cartId: 'cart_9021' })
    })).json();

    const checkout = new RisepayCheckout({
      key: o.key_id,
      order_id: o.order_id,
      name: 'Chai & Co.',
      prefill: { email: '[email protected]', contact: '9876543210' },
      theme: { color: '#FF8A00' },
      handler: async (r) => {           // r = { order_id, payment_id, signature }
        const v = await fetch('/api/payments/verify', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify(r)
        });
        location.href = v.ok ? '/thank-you' : '/payment-failed';
      },
      onDismiss: () => console.log('Checkout closed')
    });
    checkout.open();
  }
</script>
<button onclick="pay()">Pay now</button>
5

Verify the payment signature

server.js
app.post('/api/payments/verify', express.json(), (req, res) => {
  const { order_id, payment_id, signature } = req.body;

  const expected = crypto
    .createHmac('sha256', process.env.RP_KEY_SECRET)
    .update(order_id + '|' + payment_id)
    .digest('hex');

  const ok = signature && signature.length === expected.length &&
             crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));

  if (!ok) return res.status(400).json({ status: 'invalid_signature' });
  // Mark the order as paid in your database here
  res.json({ status: 'verified' });
});
6

Handle webhooks

server.js
// IMPORTANT: use the raw body for signature checks
app.post('/webhooks/risepay', express.raw({ type: 'application/json' }), (req, res) => {
  const sig = req.get('X-Risepay-Signature');
  const expected = crypto.createHmac('sha256', process.env.RP_WEBHOOK_SECRET)
                         .update(req.body).digest('hex');
  if (sig !== expected) return res.sendStatus(400);

  const event = JSON.parse(req.body);
  switch (event.type) {
    case 'payment.captured': /* fulfil the order */ break;
    case 'payment.failed':   /* notify the customer */ break;
    case 'refund.processed': /* update ledger */ break;
  }
  res.sendStatus(200);            // any 2xx stops retries
});

app.listen(3000);
7

Refund a payment

server.js
const refund = await rp.refunds.create({
  payment_id: 'pay_Hk29sLq0Zt',
  amount: 50000,                    // partial refund, paise
  reason: 'customer_request'
});
console.log(refund.id, refund.status);   // rfnd_..., processing
Code. Package names, hosts and keys in these examples are placeholders. Replace them with your own. Never commit key secrets, and always verify payments on your server before fulfilling an order.

API reference at a glance

Every endpoint is under the base URL and returns JSON.

MethodPathPurpose
POST/ordersCreate an order. Amount in paise, currency INR.
GET/orders/{order_id}Fetch an order and its payment attempts.
GET/payments/{payment_id}Fetch one payment: method, status, fees, bank reference.
POST/payments/{payment_id}/captureCapture an authorised payment (manual capture mode).
POST/refundsFull or partial refund against a captured payment.
GET/refunds/{refund_id}Refund status and expected credit date.
GET/settlementsList settlements with UTR, fees, tax and net amount.
POST/payment-linksCreate a shareable payment link or UPI QR.

Raw request

curl https://api.risepayx.com/v1/orders \
  -u rp_sandbox_XXXXXXXXXXXX:your_key_secret \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: cart_9021" \
  -d '{
    "amount": 249900,
    "currency": "INR",
    "receipt": "INV-2026-1042",
    "methods": ["upi","card","wallet","paylater","emi","netbanking"]
  }'

Response

{
  "id": "order_Nq4Zt81LpA",
  "entity": "order",
  "amount": 249900,
  "amount_paid": 0,
  "currency": "INR",
  "receipt": "INV-2026-1042",
  "status": "created",          // created | attempted | paid
  "created_at": 1792480000
}

Webhooks and errors

Risepay retries failed webhook deliveries with exponential back-off for up to 24 hours. Respond with any 2xx once you have stored the event, and de-duplicate on the event id.

Payload

POST https://your-site.example/webhooks/risepay
X-Risepay-Signature: 9b1c...e07a        // HMAC-SHA256(raw body, webhook secret)
Content-Type: application/json

{
  "id": "evt_Pw02xQmK8s",
  "type": "payment.captured",
  "created_at": 1792480123,
  "data": {
    "payment": {
      "id": "pay_Hk29sLq0Zt",
      "order_id": "order_Nq4Zt81LpA",
      "amount": 249900,
      "currency": "INR",
      "method": "upi",
      "status": "captured",
      "bank_reference": "428817620331"
    }
  }
}

Error format

HTTP/1.1 400 Bad Request
{
  "error": {
    "code": "BAD_REQUEST_ERROR",
    "description": "amount must be at least 100 (paise)",
    "field": "amount",
    "request_id": "req_7Gd1aVx"
  }
}
EventWhen
payment.authorizedCustomer paid; funds not yet captured.
payment.capturedPayment captured. Safe to fulfil the order.
payment.failedAttempt failed. Payload carries a reason code.
refund.processedRefund sent to the customer bank.
settlement.processedSettlement paid to your bank account with UTR.
order.paidOrder fully paid across attempts.
HTTPCodeMeaning
400BAD_REQUEST_ERRORMissing or invalid parameter. Fix the request.
401AUTHENTICATION_ERRORWrong key id or secret.
404NOT_FOUNDUnknown order, payment or refund id.
409IDEMPOTENCY_CONFLICTSame Idempotency-Key reused with a different body.
429RATE_LIMITEDSlow down. Honour the Retry-After header.
5xxSERVER_ERRORRetry with the same Idempotency-Key and back-off.

Go-live checklist

Before you switch to live keys.

  • Merchant KYC approved
  • Signatures verified server-side
  • Webhook endpoint on HTTPS and de-duplicating events
  • Idempotency keys on all POST calls
  • Key secret in environment variables only
  • Refund and failed-payment flows verified

Ready to accept payments?

Create a free account and go live in an afternoon.

Sign Up