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

Create a gateway with AI

A complete worked example. One prompt, every step the agent takes, what you check, and how to keep the result.

Uses the MCP payments tools and the add-payment-gateway prompt. See AI to set up.

This is the Create a payment gateway walkthrough, done by an agent. The provider is Upay, a mobile wallet (account number, OTP, PIN) that SendMock does not ship.

The prompt

Add the Upay payment gateway to SendMock so I can test my checkout. Upay's API docs are at <link to the docs>. Customers pay with their Upay wallet: account number, then an OTP, then a PIN. The IPN is JSON, signed with HMAC-SHA256 of the body in the X-Upay-Signature header, using the merchant's API secret. Run a test checkout when done, show me the redirect and the IPN, and export the seed file.

What the agent does

Each step is one or more MCP tool calls (or CLI commands for agents without MCP):

StepThe agentTool
1checks SendMock is runningsendmock_status
2reads the step catalogue and the existing flows; Wallet already matches "account number, OTP, PIN"sendmock_payment_step_type_list, sendmock_payment_flow_list
3creates the Upay method on the Wallet flow with test numbers, OTP and PINsendmock_payment_method_create
4creates the Upay gateway from blanksendmock_payment_gateway_create
5fills it from the docs: methods offered, credentials (the API secret as a secret), redirect method and fields, event names, the JSON body template and the X-Upay-Signature header templatesendmock_payment_gateway_update
6renders the redirect and IPN for success, fail and cancel, and fixes any template problemssendmock_payment_gateway_preview
7creates a test checkout and pays it with a test numbersendmock_payment_create_checkout
8waits for the payment and reads its redirect and notificationsendmock_payment_wait, sendmock_payment_get
9exports the seed file into your repositorysendmock_seed_export

If a call is refused (a template error, a PIN of the wrong length), the agent reads the error and corrects it, just as you would in the UI.

What you check

  1. Payments > Gateways lists Upay as Custom, with the agent badge, offering the Upay method.
  2. Payments > Methods lists Upay on the Wallet flow, offered by Upay.
  3. Open the gateway: the Redirect and Notification previews show the fields and signature header from Upay's docs. Compare them with the docs yourself; this is where a wrong field name would show.
  4. Payments has the test payment, Succeeded, with the redirect and IPN in its timeline; the IPN is in Webhooks > Deliveries.
  5. Run a checkout yourself from your app.

Fixing what is wrong

Change it in the gateway sheet (it is an ordinary custom gateway), or tell the agent: "the IPN amount should be a string with two decimals", "send status only on success". Ask it to run the test checkout again afterwards.

Keeping it

The agent exported sendmock.seed.toml; commit it. Teammates and CI get Upay too, with the API secret as an ${ENV_VAR} reference.

The same for other things

  • "Make a QR wallet flow" composes a flow step by step (Create a payment flow).
  • "Add Nagad to Stripe's checkout" edits a built-in gateway; Reset to default undoes it.
  • More prompts: Build it with AI.

On this page