Online Payments
Whether customers can pay invoices online through the organization's own Razorpay account, and the switch that turns it on or off. Keys and secrets are never returned; only a masked key id.
GET
/api/v1/online-paymentsGet online payments status
Scope:
settings.readstate is accepting, connected_off or not_connected. mode is live or test (null when not connected). webhookReady is whether a webhook secret is set, which is required before the switch can be turned on.
Example request
curl "https://pre-invoice.avscorp.in/api/v1/online-payments" \
-H "Authorization: Bearer YOUR_API_KEY"Example response
JSON
{
"state": "accepting",
"mode": "live",
"keyIdMasked": "rzp_live_…a91F",
"webhookReady": true,
"enabled": true
}Possible errors: unauthorized, insufficient_scope, forbidden
PATCH
/api/v1/online-paymentsSwitch online payments on or off
Scope:
settings.updateOnly the switch changes; the stored keys and webhook secret are kept. Turning on while not connected, or without a webhook secret, is a 400 with the reason. Returns the new status.
Request body
| Field | Type | Required | Constraints |
|---|---|---|---|
enabled | boolean | Required | — |
Example request
curl -X PATCH "https://pre-invoice.avscorp.in/api/v1/online-payments" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": true
}'Example response
JSON
{
"state": "accepting",
"mode": "live",
"keyIdMasked": "rzp_live_…a91F",
"webhookReady": true,
"enabled": true
}Possible errors: unauthorized, insufficient_scope, forbidden, invalid_request, validation_error