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-payments

Get online payments status

Scope: settings.read

state 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://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-payments

Switch online payments on or off

Scope: settings.update

Only 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

FieldTypeRequiredConstraints
enabledbooleanRequired—

Example request

curl -X PATCH "https://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