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

API reference

Payments

POST/api/v1/payments

Create a payment and pay it with a test card, as an app's server does without a checkout page.

CLI
sendmock payments create
MCP tool
sendmock_payment_create
In the app
Payments > New payment

Request body (application/json)

PaymentCreateRequest : Body of POST /api/v1/payments: a payment the app's server pays with a test card.

FieldTypeDescription
providerstring
The gateway key, e.g. stripe or sslcommerz.Example: stripe
amount_minornumber
The amount in the currency's minor unit (cents, paisa; JPY has none); 1999 is 19.99.Example: 1999
currency?string
Three letters, stored in capitals; Settings > Payments' default currency when left out.Example: USD
card_numberstring
A test card of the card method; its outcome in the test card table decides the payment. A number the table does not list is refused and kept nowhere.Example: 4242424242424242
customer_email?string
The customer's email.Example: [email protected]
line_items?object[]
What is being bought.
capture_method?PaymentCaptureMethod
manual authorizes the payment and waits for a capture or void; automatic when left out.One of: automatic, manualExample: automatic

Answer

201 PaymentDetail

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

Try it in Demo mode

GET/api/v1/payments/{paymentId}

One payment with line items, timeline, redirects and notifications.

CLI
sendmock payments show <paymentId>
MCP tool
sendmock_payment_get
In the app
Payments > open payment

Answer

200 PaymentDetail

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

Try it in Demo mode

POST/api/v1/payments/{paymentId}/notify

Send the payment's notification (IPN or webhook) again.

CLI
sendmock payments notify <paymentId>
MCP tool
sendmock_payment_notify
In the app
Payments > payment > Resend notification

Answer

200 PaymentDetail

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

Try it in Demo mode

POST/api/v1/payments/{paymentId}/simulate

Move the payment on: capture, refund, dispute, fail.

CLI
sendmock payments simulate <paymentId> <action>
MCP tool
sendmock_payment_simulate
In the app
Payments > payment > Simulate

Request body (application/json)

PaymentSimulateRequest : Body of POST /api/v1/payments/{paymentId}/simulate.

FieldTypeDescription
actionPaymentSimulateAction
What happens to the payment: succeed, decline, refund, dispute, answer_dispute, resolve_dispute, expire, capture or void.One of: succeed, decline, refund, dispute, answer_dispute, resolve_dispute, expire, capture, voidExample: refund
decline_reason?DeclineReason
For decline: why the bank declined.One of: insufficient_funds, expired_card, incorrect_cvc, generic_decline, fraudulent, authentication_failedExample: insufficient_funds
refund_amount_minor?number
For refund: the amount in minor units; the full amount when left out.Example: 500
dispute_outcome?"won" | "lost"
For resolve_dispute: won or lost.One of: won, lostExample: won
dispute_evidence?string
For answer_dispute: the evidence sent to the bank.Example: Signed delivery receipt attached.
webhook_endpoint_ids?Ulid[]
Send this action's webhooks to exactly these endpoints (IDs from GET /api/v1/webhooks/endpoints) instead of the ones the rules pick; an empty list sends none. Leave it out to let the rules decide.
webhook_requests?WebhookRequestEdit[]
Payloads edited for this action, by endpoint: each body is sent as written instead of the rendered one and signed over those bytes. Leave it out to send the rendered payloads.

Answer

200 PaymentDetail

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

Try it in Demo mode

POST/api/v1/payments/checkout

Start a hosted checkout on a gateway and get its payment page URL.

CLI
sendmock payments checkout create
MCP tool
sendmock_payment_create_checkout
In the app
Payments > Gateways > gateway > Checkout > Open a test checkout

Request body (application/json)

PaymentCheckoutCreateRequest : Body of POST /api/v1/payments/checkout: a hosted test checkout.

FieldTypeDescription
providerstring
The gateway key, e.g. stripe or sslcommerz.Example: stripe
amount_minornumber
The amount in the currency's minor unit (cents, paisa); 1999 is 19.99.Example: 1999
currency?string
Settings > Payments' default currency when left out.Example: USD
customer_email?string
The customer's email, shown on the checkout page.Example: [email protected]
line_items?object[]
What is being bought, shown on the checkout page.
capture_method?PaymentCaptureMethod
manual authorizes the payment and waits for a capture or void; automatic when left out.One of: automatic, manualExample: manual

Answer

201 PaymentDetail

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

Try it in Demo mode

POST/api/v1/payments/subscriptions

Start a subscription on a gateway, with an optional trial.

CLI
sendmock payments subscriptions create
MCP tool
sendmock_subscription_create
In the app
Payments > Subscriptions > New subscription

Request body (application/json)

PaymentSubscriptionCreateRequest : Body of POST /api/v1/payments/subscriptions.

FieldTypeDescription
providerstring
The gateway's key.Example: stripe
customer_emailstring
Who pays.Example: [email protected]
plan_namestring
The plan's name, shown on each renewal's payment.Example: Pro monthly
amount_minornumber
The amount of each renewal in minor units.Example: 1500
currency?string
ISO 4217 code; Settings > Payments' default currency when left out.Example: USD
intervalSubscriptionInterval
How often it renews: day, week, month or year.One of: day, week, month, yearExample: month
trial_days?number
Days before the first charge; none charges at once.Example: 7
card_number?string
The test card that pays each renewal; 4242424242424242 when left out.Example: 4000000000009995

Answer

201 PaymentSubscription

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

Try it in Demo mode

POST/api/v1/payments/subscriptions/{subscriptionId}/cancel

Cancel the subscription now or at the end of its period.

CLI
sendmock payments subscriptions cancel <subscriptionId>
MCP tool
sendmock_subscription_cancel
In the app
Payments > Subscriptions > Cancel

Request body (application/json)

PaymentSubscriptionCancelRequest : Body of POST /api/v1/payments/subscriptions/{subscriptionId}/cancel.

FieldTypeDescription
at_period_end?boolean
End at the next advance instead of now.Example: false

Answer

200 PaymentSubscription

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

Try it in Demo mode