Preview: SendMock has no stable release yet. These docs follow develop.

API reference

Payment gateways

POST/api/v1/payments/gateways

Add a custom gateway.

CLI
sendmock payments gateways create
MCP tool
sendmock_payment_gateway_create
In the app
Payments > Gateways > Add gateway

Request body (application/json)

PaymentGatewayCreateRequest : Body of POST /api/v1/payments/gateways.

FieldTypeDescription
namestring
The new gateway's name.Example: Upay
keystring
Its key in the API and in /providers/<key>/... paths; lowercase, fixed after creation.Example: upay
start_fromstring | null
A gateway to copy (methods, redirect and notification), or null for blank.Example: bkash

Answer

201 PaymentGatewayDefinition

Errors: 400, as { error: { code, message } }

Try it in Demo mode

PATCH/api/v1/payments/gateways/{gatewayKey}

Change a gateway; secret credentials stay masked.

CLI
sendmock payments gateways update <gatewayKey>
MCP tool
sendmock_payment_gateway_update
In the app
Payments > Gateways > gateway > Save gateway

Request body (application/json)

PaymentGatewayInput : Body of PATCH /api/v1/payments/gateways/{gatewayKey}; the key is fixed.

FieldTypeDescription
keystring
The provider value in the API and in /providers/<key>/... paths.Example: upay
namestring
The gateway's name, shown on checkout pages.Example: Upay
accentstring
#rrggbb, used on its checkout pages.Example: #e2136e
is_enabledboolean
Off gateways reject new checkouts.Example: true
method_keysstring[]
The methods its checkout offers, in order.
credentialsGatewayCredential[]
The merchant credentials your app is configured with.
notification_endpoint_idUlid | null
The webhook endpoint its IPN or webhook deliveries go to.Example: 01JB7T9Q2R5W8X3Y6Z1A4B7C9D
redirect_method"GET" | "POST"
How the browser returns to your app: GET (query string) or POST (form).One of: GET, POSTExample: POST
redirect_fieldsGatewayRedirectField[]
The parameters sent to your app on redirect.
notification_content_type"json" | "form"
How the IPN or webhook body is sent: json or form.One of: json, formExample: json
event_namesobject
The gateway's name for each native event; blank sends nothing.
notification_bodystring
The notification body, a template over the payment and the event.Example: {"status": "{{ event.name }}", "txn_id": "{{ payment.reference }}"}
notification_headersGatewayHeaderTemplate[]
Headers sent with each notification.

Answer

200 PaymentGatewayDefinition

Errors: 400, 404, as { error: { code, message } }

Try it in Demo mode

POST/api/v1/payments/gateways/{gatewayKey}/preview

Render a gateway's redirect and notification for a payment.

CLI
sendmock payments gateways preview <gatewayKey>
MCP tool
sendmock_payment_gateway_preview
In the app
Payments > Gateways > gateway > Redirect, Notification preview

Request body (application/json)

PaymentGatewayPreviewRequest : Body of POST /api/v1/payments/gateways/{gatewayKey}/preview.

FieldTypeDescription
gatewayPaymentGatewayInput
The gateway settings to render, saved or not.
payment_id?Ulid
The payment to render against; the newest one when left out.Example: 01JB7T9Q2R5W8X3Y6Z1A4B7C9D
event_typePaymentEventType
The native event to render the notification for.One of: payment.created, payment.authorized, payment.succeeded, payment.failed, payment.canceled, payment.refunded, payment.partially_refunded, payment.dispute_opened, payment.dispute_updated, payment.dispute_closed, checkout.completed, checkout.expiredExample: payment.succeeded
redirect_outcome"success" | "fail" | "cancel"
The redirect to render: success, fail or cancel.One of: success, fail, cancelExample: success

Answer

200 PaymentGatewayPreview

Try it in Demo mode

GET/api/v1/payments/gateways/{gatewayKey}/credentials/{credentialName}

Reveal one secret credential (asked for after a confirmation).

CLI
sendmock payments gateways credential <gatewayKey> <credentialName> --reveal
MCP tool
None: Agents may set secrets but never read them back; the CLI and UI reveal them after a confirmation.
In the app
Payments > Gateways > gateway > Merchant > Reveal

Answer

200 GatewayCredentialReveal

Errors: 404, as { error: { code, message } }

Try it in Demo mode