Start here
One API for UPI pay-ins and bank payouts in India, across several payment providers. A first pay-in takes about five minutes; this page then covers what every request has in common.
Your first pay-in
- Sign in to the console, pick a test gateway account, and openDevelopers, API keys. Create a key. It is shown once, so store it.
- Run one of these with your key in
AQUAPAY_API_KEY.
curl -X POST https://api.bhimpay.online/api/v2/payins \
-H "Authorization: Bearer $AQUAPAY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"amount": "500",
"currency": "INR",
"reference": "order-1001",
"payer": {
"id": "customer-42",
"ip": "203.0.113.7"
},
"returnUrl": "https://example.com/paid"
}'const response = await fetch("https://api.bhimpay.online/api/v2/payins", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AQUAPAY_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"amount": "500",
"currency": "INR",
"reference": "order-1001",
"payer": {
"id": "customer-42",
"ip": "203.0.113.7"
},
"returnUrl": "https://example.com/paid"
}),
});
const data = await response.json();
if (!response.ok) throw new Error(`${data.code}: ${data.message}`);import os
import uuid
import requests
response = requests.post(
"https://api.bhimpay.online/api/v2/payins",
headers={
"Authorization": f"Bearer {os.environ['AQUAPAY_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"amount": "500",
"currency": "INR",
"reference": "order-1001",
"payer": {
"id": "customer-42",
"ip": "203.0.113.7",
},
"returnUrl": "https://example.com/paid",
},
timeout=30,
)
data = response.json()
if not response.ok:
raise RuntimeError(f"{data['code']}: {data['message']}")<?php
$ch = curl_init("https://api.bhimpay.online/api/v2/payins");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("AQUAPAY_API_KEY"),
"Idempotency-Key: " . bin2hex(random_bytes(16)),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"amount" => "500",
"currency" => "INR",
"reference" => "order-1001",
"payer" => [
"id" => "customer-42",
"ip" => "203.0.113.7",
],
"returnUrl" => "https://example.com/paid",
]),
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
throw new RuntimeException($data["code"] . ": " . $data["message"]);
}body := strings.NewReader(`{
"amount": "500",
"currency": "INR",
"reference": "order-1001",
"payer": {
"id": "customer-42",
"ip": "203.0.113.7"
},
"returnUrl": "https://example.com/paid"
}`)
req, err := http.NewRequest("POST", "https://api.bhimpay.online/api/v2/payins", body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("AQUAPAY_API_KEY"))
key := make([]byte, 16)
rand.Read(key) // crypto/rand
req.Header.Set("Idempotency-Key", hex.EncodeToString(key))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
answer, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(answer))HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.bhimpay.online/api/v2/payins"))
.header("Authorization", "Bearer " + System.getenv("AQUAPAY_API_KEY"))
.header("Idempotency-Key", UUID.randomUUID().toString())
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"amount": "500",
"currency": "INR",
"reference": "order-1001",
"payer": {
"id": "customer-42",
"ip": "203.0.113.7"
},
"returnUrl": "https://example.com/paid"
}"""))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());The answer is the pay-in, pending. Send the payer to nextAction.redirectUrl; whereupiUri is set, open it on a phone or draw it as a QR code.
{
"id": "payin_7h2kq9w3m1zt4",
"reference": "DEP-20261203-0042",
"status": "pending",
"amount": "500.00",
"paidAmount": null,
"currency": "INR",
"fee": "12.50",
"net": "487.50",
"utr": null,
"orderId": "AQD2612030915000042",
"providerOrderId": "CP88123409",
"nextAction": {
"redirectUrl": "https://pay.cowpay.example/c/CP88123409",
"upiUri": "upi://pay?pa=cowpay.col@ybl&pn=COWPAY&am=500.00&tr=CP88123409&cu=INR"
},
"expiresAt": "2026-12-03T11:15:00Z",
"failure": null,
"version": 1,
"createdAt": "2026-12-03T09:15:00Z",
"updatedAt": "2026-12-03T09:15:00Z"
}- Watch it arrive in the console under Developers, Request logs, with Follow live on. In the sandbox it succeeds about five seconds later, and AquaPay posts
payin.succeededto yourwebhook endpoint. No server yet? Poll the eventsinstead: it needs no public address.
The console's Developers overview shows the same sample filled in for your account, and a checklist of what is left before you go live.
Base URL
Requests and answers are JSON over HTTPS. The version is in the URL only: inside /api/v2 AquaPay adds fields, enum values, event types and endpoints, and nothing else, so ignore what you do not know. Live and test use the same address; the key decides which.
Keys
A key belongs to one gateway account: your organization's account on one payment gateway. The key therefore decides the provider, and no path names one. Send it as Authorization: Bearer aqk_…, from your server only.
- Its shape tells you what it is.
aqk_live_oraqk_test_, then 32 characters, then a 6-character checksum of the rest. Your code can refuse a mistyped key before it sends anything, and secret scanners recognise a real key. - It is shown once. AquaPay stores a hash and the last four characters. A lost key is replaced, not recovered.
- It has scopes. Give each server only what it needs.
| Scope | Allows |
|---|---|
read | Read the account, balance, ledger, pay-ins, payouts and events, and refresh a payment from the provider. |
payins:write | Open pay-ins and bind UTRs. |
payouts:write | Send payouts and close payout attempts. Every payout still needs the payment password. |
webhooks:write | Add, delete and rotate webhook endpoints through the API, with the payment password. |
- It can be tied to addresses. With an allowlist of up to 16 addresses or CIDRs, a request from anywhere else answers
403 ip_not_allowed. - It can be rolled without downtime. Rolling makes a new key and keeps the old one working for 1 hour, 24 hours or 7 days. For a leaked key, "Roll now" stops the old one at once.
- Keys are made, changed, rolled and revoked in the console only, behind the payment password. The API cannot mint a key, so a leaked key cannot make its successor.
Idempotency
Every POST needs an Idempotency-Key: 8 to 64 characters of letters, digits,_ and -. Use a UUID, or better, your own id for the thing you are creating.
- The same key with the same request replays the first answer, marked
AquaPay-Idempotent-Replay: true. A lost answer is therefore safe to ask for again. - The same key with a different request is
409 idempotency_conflict. - Answers are kept for 24 hours. Errors from authentication, validation and rate limits are never stored, so the same key can be sent again once the request is fixed.
- A payout's key is also its attempt key, and is never forgotten: it reaches a provider at most once, ever. If a create call is lost for good, look the attempt up before you decide anything.
Money
An amount is a decimal string, never a JSON number: "500", "500.50". Requests take up to two decimals. Answers use one canonical form, so equal strings are equal amounts. Every amount comes with itscurrency, and a request must name the account's own. PAYME and COWPAY take whole amounts only;GET /account says so in wholeUnitsOnly, along with the limits, fees and payout methods of the account.
The payment password
Creating a payout, and adding, deleting or rotating a webhook endpoint, need the account's payment password in theAquaPay-Payment-Password header. It is a person's approval, typed for each action; do not store it. Five wrong passwords in a row lock that key and address for 15 minutes (423 payment_password_locked).
Statuses
A pay-in or a payout is always in exactly one status, and each change of a final kind sends a webhook.
- Pay-in:
pending, thensucceeded,failed,expiredorneeds_review. A pay-in unpaid after two hours expires. A late payment on a failed or expired pay-in still turns itsucceeded, so treatpayin.succeededas the last word. - Payout:
processing, thensucceeded,failedorneeds_review; a succeeded payout can becomereversed. The amount and fee are held while it is processing or in review. needs_reviewmeans the evidence does not settle it. AquaPay staff resolve it; nothing is credited or released meanwhile.
Lists and limits
- Lists answer
{"items": […], "nextCursor": "…"}. PassnextCursorback ascursor; it is null on the last page.limitis 1 to 100. - An account may send 25 requests a second, and 5 a second of the operations that call a provider. Beyond that,
429 too_many_requestswithRetry-After. - A request body is at most 16 KiB, and an unknown field is refused.
Clients
The API is plain HTTP and JSON, so any language can call it with what it already has. Every operation in theAPI reference shows its request in curl, Node, Python, PHP, Go and Java; pick a language once and every sample on this site follows. To generate a typed client instead, download theOpenAPI contract.