Skip to main content

V2 API authentication

Requests to /api/v2/ use HTTP Basic Auth. Use your API key as the username and your API secret as the password.
Encode the complete API_KEY:API_SECRET string as Base64. Use the Basic prefix, not Bearer. With cURL, --user creates this header for you:
V2 does not require key or hash in the request body. Omit both fields. You do not need to calculate a request hash or send "hash": "none".
Make authenticated requests from your backend over HTTPS. Base64 is encoding, not encryption. Do not expose your API secret or Authorization header in browser code, mobile apps, URLs, or logs.

Migrating collection requests from V1

For these methods, change the endpoint version, add Basic Auth, and remove the body key and hash. The business parameters and success response formats stay the same.
  • Create an order with receipt_id. Fetch that order by sending the same receipt ID as id.
  • Amounts remain integer minor units, such as paise for INR. The create response’s url remains Base64-encoded. Decode it before redirecting the customer.
  • Existing V1 orders can be fetched through V2 for the same business account and environment. Use the matching test or live credentials.
  • Existing active API credentials and valid pg_pool_id values can be reused. Migrating to V2 does not require regenerating them or changing gateway configuration.

Collection webhooks

Changing the order API version does not itself change your configured collection webhooks. Keep webhook verification separate from API request authentication. Basic Auth does not replace webhook signature verification, and the V1 request-hashing example below is not a webhook-verification recipe. Collection senders can use different payload and hash inputs, including variants with order_id. Confirm the payload and signing contract for your configured collection sender with support before changing your webhook handler. A payout webhook contract does not establish the collection webhook format. Use an authenticated order fetch to confirm order_status, the receipt ID, amount, and currency against your records before marking a payment successful. Receiving a webhook alone does not establish payment success.

V1 request hashing

V1 requests still send key and hash in the JSON body. The following algorithm applies to V1 API requests, not V2 requests or webhook payloads.
  1. Exclude hash and sort the request parameters by key.
  2. Exclude nested objects and arrays from the hash input.
  3. Convert scalar values to strings. Represent true as 1, and false or null as an empty string.
  4. Join those values with |, then append | and the API secret.
  5. Compute the SHA-512 digest as lowercase hexadecimal and send it as hash.
This Node.js example hashes a V1 collection request on your backend: