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.
/v1/checks/{id}/payment_tokenPOST/v1/payment_tokens/inspectPOST/v1/payment_tokens/redeemPOST/v1/payment_tokens/fulfilmentPOST/v1/payment_tokens/releaseIssue a new single-use payment token
POST/v1/checks/{id}/payment_tokenSecret key · scope checks:write
Parameters
| Name | In | Description |
|---|---|---|
id required | path | Check idpattern ^chk_[\w-]{6,40}$ |
Returns
| Field | Type | Description |
|---|---|---|
object | "payment_token" | |
token | string | |
expires_at | integer | |
max_amount_paise | integer | Amount in paise (₹1 = 100 paise)min 1 |
payee | string 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"import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("POST", "/v1/checks/chk_P1iENx01EDRJ/payment_token");from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("POST", "/v1/checks/chk_P1iENx01EDRJ/payment_token"){
"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
| Field | Type | Description |
|---|---|---|
token required | string |
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…"
}'import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("POST", "/v1/payment_tokens/inspect", {
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
});from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("POST", "/v1/payment_tokens/inspect", {
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}){}Redeem a payment token once, just before charging
POST/v1/payment_tokens/redeemPublic · no key needed
Request body
| Field | Type | Description |
|---|---|---|
token required | string | |
amount_paise required | integer | Amount in paise (₹1 = 100 paise)min 1 |
payee | string | |
merchant | string | |
payment_reference required | string | |
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"
}'import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("POST", "/v1/payment_tokens/redeem", {
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
"amount_paise": 184500,
"payee": "freshcart@okhdfc",
"merchant": "FreshCart",
"payment_reference": "UPI-RRN-430011",
"currency": "INR"
});from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("POST", "/v1/payment_tokens/redeem", {
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
"amount_paise": 184500,
"payee": "freshcart@okhdfc",
"merchant": "FreshCart",
"payment_reference": "UPI-RRN-430011",
"currency": "INR"
}){}Report what happened to the order, as the redeemer (no key needed)
POST/v1/payment_tokens/fulfilmentPublic · no key needed
Request body
| Field | Type | Description |
|---|---|---|
status required | "delivered" | "partially_delivered" | "not_delivered" | "returned" | "refunded" | "cancelled" | |
items | array of object | |
amount_paise | integer | Required for refunded: the amount refunded, at most the amount paidmin 1 |
occurred_at | integer | Unix seconds; defaults to now |
carrier | string | up to 80 characters |
tracking_reference | string | up to 120 characters |
note | string | up to 1000 characters |
token required | string | |
release_key required | string | Returned once, by the redemption. Proves the caller redeemed the token. |
party | "merchant" | "payment_participant" |
Returns
| Field | Type | Description |
|---|---|---|
object | "fulfilment" | |
id | string | |
check | string | |
livemode | boolean | |
party | "merchant" | "payment_participant" | "agent_operator" | "organisation" | |
via | "payment_token" | "api" | |
status | string | |
items | array or null | |
amount_paise | integer or null | |
carrier | string or null | |
tracking_reference | string or null | |
occurred_at | integer | |
note | string or null | |
token | string | Signed record (typ fulfilment), chained to the previous report for the check. See /spec section 2.4. |
erased | boolean | |
created_at | integer |
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"
}'import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("POST", "/v1/payment_tokens/fulfilment", {
"status": "paid",
"items": [
"Groceries"
],
"amount_paise": 184500,
"note": "The merchant substituted an item without consent.",
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
"release_key": "rlk_9Hq…",
"party": "customer"
});from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("POST", "/v1/payment_tokens/fulfilment", {
"status": "paid",
"items": [
"Groceries"
],
"amount_paise": 184500,
"note": "The merchant substituted an item without consent.",
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
"release_key": "rlk_9Hq…",
"party": "customer"
}){
"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
| Field | Type | Description |
|---|---|---|
token required | string | |
release_key required | string | Returned once, by the redemption |
reason | string | up 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"
}'import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("POST", "/v1/payment_tokens/release", {
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
"release_key": "rlk_9Hq…",
"reason": "not_as_ordered"
});from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("POST", "/v1/payment_tokens/release", {
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…",
"release_key": "rlk_9Hq…",
"reason": "not_as_ordered"
}){}