Skip to content

Languages and samples

There are no SDKs. You don’t need one.

ZopPay has no SDKs, client libraries or OpenAPI file today. The API is JSON over HTTPS, so every sample on this site is a complete program that uses the language’s own HTTP client.

cURL and six languages

What each sample needs. Little or nothing to install.

HTTP client, version and webhook receiver per language
LanguageHTTP clientVersionWebhook receiver uses
cURLcurlAny recent curlopenssl to sign a test event
Node.jsfetch (built in)Node.js 18 or laternode:http and node:crypto (built in)
PythonrequestsPython 3.8 or laterFlask 2.2 or later
PHPcURL extensionPHP 7.4 or laterPlain PHP
Gonet/http (standard library)Go 1.21 or laterStandard library
RubyNet::HTTP (standard library)Ruby 2.6 or later; the receiver needs 3.0Sinatra
Javajava.net.http (built in)Java 17 or laterJDK HTTP server (built in)
Python: install
pip install requests   # API calls
pip install flask      # the webhook receiver sample
Ruby: install
# API calls: nothing to install (net/http and json are standard).
gem install sinatra rackup puma   # the webhook receiver sample

The other languages need nothing beyond what ships with them.

Every sample

Four programs. cURL and six languages each.

The language you pick is used by every sample on these pages and remembered on this device.

POST /v1/payments

Create a payment and get its checkout link.

POST /v1/payments
# Create a payment. Needs: export ZOPPAY_SECRET_KEY=sk_test_…
curl https://api.zoppay.in/v1/payments \
  -H "Authorization: Bearer $ZOPPAY_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_1042" \
  -d '{
    "amount": 49900,
    "currency": "INR",
    "reference": "order_1042",
    "return_url": "https://shop.example.com/orders/1042/complete",
    "customer": {
      "name": "Asha Rao",
      "email": "asha@example.com",
      "phone": "+919876543210"
    }
  }'

# The answer is 201 Created, with the payment under "data".
# Send the shopper's browser to data.checkout_url.

GET /v1/payments/{id}

Confirm a payment from your server.

GET /v1/payments/{id}
# Get a payment. Use the data.id that create returned.
curl https://api.zoppay.in/v1/payments/pay_01JD3V8Q4M6Y2C9T7K5W1R0BNA \
  -H "Authorization: Bearer $ZOPPAY_SECRET_KEY"

# The answer is 200 OK, with the payment under "data".
# Fulfil the order when data.status is "captured".

POST /v1/refunds

Refund part or all of a payment.

POST /v1/refunds
# Refund ₹100.00 of a payment. Leave out "amount" to refund everything that is left.
curl https://api.zoppay.in/v1/refunds \
  -H "Authorization: Bearer $ZOPPAY_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: refund_order_1042_1" \
  -d '{
    "payment_id": "pay_01JD3V8Q4M6Y2C9T7K5W1R0BNA",
    "amount": 10000,
    "reason": "Item returned"
  }'

# The answer is 201 Created, with the refund under "data".
# data.status is "succeeded", or "pending" until the gateway confirms.

Receive and verify a webhook

A small server that checks X-PP-Signature-V2. The cURL tab sends it a signed test event.

Receive and verify a webhook
# Send a correctly signed test event to your own receiver, the way ZopPay signs it.
SECRET='whsec_…'   # your endpoint's signing secret: the whole value, whsec_ included
URL='http://localhost:3000/webhooks/zoppay'
BODY='{"id":"whe_01JD3VC4R7T9W2Y5A8C1E3G6J9","type":"payment.captured","created_at":"2026-10-19T10:21:03.512Z","organisation_id":"org_01JD2Q0X8M4N6P1R3S5T7V9W2Y","data":{"amount":49900,"currency":"INR","gateway_transaction_id":"test_txn_pay_01JD3V8Q4M6Y2C9T7K5W1R0BNA_1760869263512345678","mode":"test","order_id":"ord_01JD3V8Q2K5N7Q9S1V3W5Y7A0C","payment_id":"pay_01JD3V8Q4M6Y2C9T7K5W1R0BNA","reference":"order_1042"}}'
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)

# X-PP-Signature-V2 = "sha256=" + hex(HMAC-SHA256(secret, timestamp + "." + raw body))
SIG="sha256=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -r | cut -d' ' -f1)"

curl -i "$URL" \
  -H "Content-Type: application/json" \
  -H "X-PP-Event: payment.captured" \
  -H "X-PP-Timestamp: $TS" \
  -H "X-PP-Signature-V2: $SIG" \
  -d "$BODY"

Want an SDK for your language?

Tell us which language you use. There is no SDK today and no date for one, but requests help us decide.