TheWavlyDocs
DocsAPI reference

Payment tokens

A check that may proceed carries a single-use payment token: the permission to charge at most that amount, to that payee, until the hold ends. Payment providers and stores redeem it once with no TheWavly key, and give it back with the release key if the charge fails. See For payment providers.

Issue a new single-use payment token

POST/v1/checks/{id}/payment_tokenSecret key · scope checks:write

Parameters

NameInDescription
id requiredpathCheck idpattern ^chk_[\w-]{6,40}$

Returns

FieldTypeDescription
object"payment_token"
tokenstring
expires_atinteger
max_amount_paiseintegerAmount in paise (₹1 = 100 paise)min 1
payeestring or null

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl -X POST https://thewavly.com/v1/checks/chk_P1iENx01EDRJ/payment_token \
  -H "Authorization: Bearer $WAVLY_API_KEY"
Response
{
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
  "max_amount_paise": 200000,
  "payee": "freshcart@okhdfc"
}

Inspect a payment token (for payment providers, no key needed)

POST/v1/payment_tokens/inspectPublic · no key needed

Request body

FieldTypeDescription
token requiredstring

Returns

A JSON object.

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl -X POST https://thewavly.com/v1/payment_tokens/inspect \
  -H "Content-Type: application/json" \
  -d '{
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}'
Response
{}

Redeem a payment token once, just before charging

POST/v1/payment_tokens/redeemPublic · no key needed

Request body

FieldTypeDescription
token requiredstring
amount_paise requiredintegerAmount in paise (₹1 = 100 paise)min 1
payeestring
merchantstring
payment_reference requiredstring
currency"INR"

Returns

A JSON object.

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl -X POST https://thewavly.com/v1/payment_tokens/redeem \
  -H "Content-Type: application/json" \
  -d '{
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
  "amount_paise": 184500,
  "payee": "freshcart@okhdfc",
  "merchant": "FreshCart",
  "payment_reference": "UPI-RRN-430011",
  "currency": "INR"
}'
Response
{}

Report what happened to the order, as the redeemer (no key needed)

POST/v1/payment_tokens/fulfilmentPublic · no key needed

Request body

FieldTypeDescription
status required"delivered" | "partially_delivered" | "not_delivered" | "returned" | "refunded" | "cancelled"
itemsarray of object
amount_paiseintegerRequired for refunded: the amount refunded, at most the amount paidmin 1
occurred_atintegerUnix seconds; defaults to now
carrierstringup to 80 characters
tracking_referencestringup to 120 characters
notestringup to 1000 characters
token requiredstring
release_key requiredstringReturned once, by the redemption. Proves the caller redeemed the token.
party"merchant" | "payment_participant"

Returns

FieldTypeDescription
object"fulfilment"
idstring
checkstring
livemodeboolean
party"merchant" | "payment_participant" | "agent_operator" | "organisation"
via"payment_token" | "api"
statusstring
itemsarray or null
amount_paiseinteger or null
carrierstring or null
tracking_referencestring or null
occurred_atinteger
notestring or null
tokenstringSigned record (typ fulfilment), chained to the previous report for the check. See /spec section 2.4.
erasedboolean
created_atinteger

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl -X POST https://thewavly.com/v1/payment_tokens/fulfilment \
  -H "Content-Type: application/json" \
  -d '{
  "status": "paid",
  "items": [
    "Groceries"
  ],
  "amount_paise": 184500,
  "note": "The merchant substituted an item without consent.",
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
  "release_key": "rlk_9Hq…",
  "party": "customer"
}'
Response
{
  "id": "chk_P1iENx01EDRJ",
  "check": "chk_P1iENx01EDRJ",
  "party": "customer",
  "status": "paid",
  "items": [
    "Groceries"
  ],
  "amount_paise": 184500,
  "note": "The merchant substituted an item without consent.",
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}

Give an approval back when the charge failed after redemption (no key needed)

POST/v1/payment_tokens/releasePublic · no key needed

Request body

FieldTypeDescription
token requiredstring
release_key requiredstringReturned once, by the redemption
reasonstringup to 200 characters

Returns

A JSON object.

Errors

Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.

curl -X POST https://thewavly.com/v1/payment_tokens/release \
  -H "Content-Type: application/json" \
  -d '{
  "token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
  "release_key": "rlk_9Hq…",
  "reason": "not_as_ordered"
}'
Response
{}