Graphrt

Midtrans

Snap payment pages (agent use capped by amount) and Core API transaction status, cancel, expire, refund, approve/deny and capture node only

Beta v0.1.0 Node.js 11 actions
Use in Graphrt Desktop

About

A Graphrt plugin for Midtrans, the Indonesian payment gateway: create Snap payment pages (a token and a redirect_url to send to the payer) and read transaction status through the Core API, plus cancel, expire, refund, approve/deny and capture as workflow nodes. It is built with the declarative REST layer (definition.mjs) plus small wrappers in lib/.

What it can do

  • Snap: create_snap_transaction (order id, IDR amount, items, customer, payment methods, expiry)
  • Status: get_transaction_status, get_b2b_transaction_status
  • Node only: cancel_transaction, expire_transaction, refund_transaction, direct_refund_transaction, approve_transaction, deny_transaction (fraud challenge), capture_transaction (card pre-auth)
  • api_request: any other Core API endpoint on api(.sandbox).midtrans.com (agents: GET status paths only)

Actions

Each action is a step you can add to a workflow. Agents can also use most of them as tools.

  • Create Snap transaction midtrans.create_snap_transaction
  • Get transaction status midtrans.get_transaction_status
  • Get B2B transaction status midtrans.get_b2b_transaction_status
  • Cancel transaction midtrans.cancel_transaction
  • Expire transaction midtrans.expire_transaction
  • Refund transaction midtrans.refund_transaction
  • Direct refund transaction midtrans.direct_refund_transaction
  • Approve transaction midtrans.approve_transaction
  • Deny transaction midtrans.deny_transaction
  • Capture transaction midtrans.capture_transaction
Show all 11 actions
  • Midtrans Core API request midtrans.api_request

Settings

Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.

  • MIDTRANS_SERVER_KEY Required
    Server key (SB-Mid-server-... in the sandbox), sent as the Basic auth user with an empty password
  • MIDTRANS_ENV Optional
    sandbox (default: app.sandbox.midtrans.com, api.sandbox.midtrans.com) or production (app.midtrans.com, api.midtrans.com)
  • MIDTRANS_TOOL_ALLOW_PAYMENTS Optional
    1 lets agent tools create Snap transactions, within the cap below
  • MIDTRANS_TOOL_MAX_AMOUNT For agent Snap transactions
    Maximum gross_amount (IDR) per agent-created transaction. Unset or 0 refuses every one
  • MIDTRANS_TOOL_API_EXTRA_PATHS Optional
    More GET paths agents may reach with api_request, comma-separated, * = one segment

How to use it

In Graphrt Desktop

  1. Open Plugins and search for Midtrans.
  2. Click Install and approve it.
  3. Follow the setup steps on the plugin's page, then paste the settings it needs.
  4. Describe a job that needs it, and the builder adds the steps.
Plugins in Graphrt Desktop

With the CLI

terminal
$ graphrt plugin install midtrans
workflow.yaml
- id: pay
  type: midtrans.create_snap_transaction
  order_id: "INV-{{#start.invoice_id#}}"
  gross_amount: 150000
  item_details: [{ id: "sku-1", name: "Kopi 1kg", price: 150000, quantity: 1 }]
  customer_details: { first_name: "Ana", email: "ana@example.com" }
  expiry_duration: 1
  expiry_unit: day
- id: link
  type: answer
  answer: "Pay here: {{#pay.data.redirect_url#}}"
Plugins in the docs