Resend a webhook through SePay MCP

The only write action of SePay MCP: the AI app asks to resend one failed webhook delivery and you approve it on my.sepay.vn within 5 minutes. Permissions, how you confirm, how to check afterwards.

||

Resending a failed webhook is the only write action of SePay MCP. Read-only by default. Write actions run only when you grant access and confirm each one. The AI app can't send on its own: every resend needs you to click Duyệt (Approve) on my.sepay.vn.

SePay MCP has no write actions for the payment gateway or e-invoices yet.

ToolPermission groupSample question
replay_webhookGửi lại webhook (có xác nhận) (resend webhooks, with approval)"Resend the failed webhook for order DH00012."

replay_webhook resends one failed webhook delivery of a transaction, so your website receives it again and confirms the order. The first call sends nothing; it only returns an approval link, and the webhook is sent only after you click Duyệt (Approve).

Permission needed

  • The Gửi lại webhook (có xác nhận) (resend webhooks, with approval) group (mcp:webhook-log:write). On the access screen this group sits apart and is not switched on by default: you turn it on yourself.
  • Permission to edit WebHooks logs on SePay, the same permission the Phát lại (Replay) button on the web needs. The user permissions page has no checkbox for this edit permission, so today only SuperAdmin and Admin have it. A Người dùng bình thường (regular user) account doesn't see the group when granting access, even with the Xem nhật ký WebHooks (view webhook logs) permission. If you are demoted from Admin, all your MCP connections are revoked. If your account no longer has permission to resend webhooks, the AI app gets the error "Tài khoản của bạn không có quyền dùng dữ liệu này." (your account has no permission for this data).
  • Bank account and virtual account permissions: only transactions of the bank accounts and virtual accounts assigned to you can be resent. SePay checks this again when you click Approve. A transaction outside that scope comes back as not found.
  • If you switch this group off after connecting, the AI app gets the error "Quyền cho công cụ này hiện đang tắt. Hãy bật lại trong SePay → AI Agent → Ứng dụng đã kết nối → Chỉnh quyền, rồi hỏi lại." (this tool's permission is off; turn it back on in SePay → AI Agent → Connected apps → Edit permissions, then ask again).
  • It runs on production only, and your company must have the webhook resend feature turned on. If it isn't, the AI app gets the message "Công ty của bạn chưa được kích hoạt tính năng gửi lại webhook…" (your company does not have webhook resending turned on).

How you confirm

  1. You ask the AI app to resend the webhook. The AI app calls replay_webhook the first time, gets an approval link like https://my.sepay.vn/ai-agent/approve/… and gives it to you.
  2. You open the link on my.sepay.vn (signed in as the account that connected the AI app). The page shows the action, the environment, the transaction (amount, payment code, date) and the webhook (name, domain). Click Duyệt (Approve) or Từ chối (Reject) within 5 minutes.
  3. You tell the AI app you approved. The AI app calls replay_webhook a second time with approval_id, within 10 minutes of your approval, and reports the result.

Only the user who connected the AI app can approve; a colleague who opens the link is told they cannot approve it. Each link works once. Results the AI app can get:

ResultMeaning
deliveredResent, your website received it successfully
not_deliveredResent, your website still returned an error (HTTP code in log.response_status_code)
pendingYou haven't clicked Approve or Reject yet
rejectedYou clicked Reject; nothing sent
expiredNot approved within 5 minutes, or the second call came more than 10 minutes after approval; nothing sent
already_usedThis link was already used to send; not sent again
request_mismatchThe second call's parameters or user differ from the first; nothing sent
already_deliveredYour website already received this transaction successfully; nothing sent. If you still need to resend it, use the Phát lại (Replay) button in the webhook delivery history on my.sepay.vn
webhook_inactiveThe webhook is paused; turn it back on on the Webhooks page and make a new request
filter_skipped, filter_mismatchThe transaction doesn't match the webhook's filters; nothing sent
limit_reachedToo many resends for this transaction; try again after retry_after_seconds seconds
busyAnother resend for this transaction is running; try again in a few minutes

How to undo and check

  • Before approving: click Từ chối (Reject), or let the link expire after 5 minutes. Nothing is sent.
  • After it was sent: a sent webhook cannot be taken back. SePay blocks duplicates: it doesn't resend a transaction your website already received successfully, and it limits resends per transaction (at most 3 within 60 minutes). Your website should still guard against processing the same transaction id twice, so an order is never credited twice.
  • To stop the AI app from resending webhooks: switch off the Gửi lại webhook (có xác nhận) group or revoke the AI app's connection on the AI Agent page (details).
  • To check afterwards: open the Nhật ký hoạt động (Activity log) tab on the AI Agent page. Each resend request shows as one row of its own, apart from data reads, with the action (for example "Gửi lại webhook … cho giao dịch …", resend webhook … for transaction …), whether you approved or rejected it, and the send result.

Next steps