Back to docs

Docs

CLI API mode

Call official provider endpoints directly from rutebayar for debugging, experiments, and operations that do not have dedicated adapters yet.

rutebayar api <provider> is raw API mode. It calls official provider endpoints from the same CLI surface and uses credentials already onboarded into Rute Bayar.

Use this mode when you need to:

  • inspect provider responses before adding adapter features;
  • debug a specific payload, header, or query;
  • call an official endpoint that does not have a dedicated command like pay create/status;
  • compare sandbox and production behavior with stored credentials.

Prerequisites

Onboard the provider first so auth headers can be filled automatically:

rutebayar onboard midtrans --merchant-id "$MIDTRANS_MERCHANT_ID" --client-key "$MIDTRANS_CLIENT_KEY" --server-key "$MIDTRANS_SERVER_KEY" --environment sandbox
rutebayar onboard xendit --secret-key "$XENDIT_SECRET_KEY" --environment sandbox
rutebayar onboard doku --client-id "$DOKU_CLIENT_ID" --secret-key "$DOKU_SECRET_KEY" --environment sandbox
rutebayar onboard ipaymu --va "$IPAYMU_VA" --api-key "$IPAYMU_API_KEY" --environment sandbox
rutebayar provider accounts

Use the same environment as the stored credential:

rutebayar api midtrans --environment sandbox --operation status --path-param order_id=rb-demo-001

Command Shape

rutebayar api <provider> \
  --operation <alias> \
  --method <GET|POST|PATCH|DELETE> \
  --path-param key=value \
  --query key=value \
  --header "X-Debug=1" \
  --body '<json>'

Use --operation for aliases mapped from manual commands or provider specs. Use --path when an endpoint does not have an alias yet.

rutebayar api doku --operation order-status --path-param invoice_number_or_request_id=INV-001
rutebayar api doku --method GET --path /orders/v1/status/INV-001

View available operations:

rutebayar api --help
rutebayar api midtrans --help
rutebayar api xendit --help
rutebayar api doku --help
rutebayar api ipaymu --help

For a QA checklist and safe MCP/AI Agent tool mapping, see API mode QA and MCP mapping.

Provider Examples

Midtrans status and Snap:

rutebayar api midtrans --operation status --path-param order_id=rb-demo-001
rutebayar api midtrans --operation snap-transaction --method POST --body '<midtrans_snap_payload_json>'

Xendit balance and Payment Sessions:

rutebayar api xendit --operation auth-balance
rutebayar api xendit --operation session-status --path-param session_id=ps-123

DOKU Checkout and order status:

rutebayar api doku --operation checkout-payment --method POST --body '<doku_checkout_payload_json>'
rutebayar api doku --operation order-status --path-param invoice_number_or_request_id=INV-001
rutebayar api doku --operation post-direct-debit-v1-token --method POST --body '<doku_direct_debit_payload_json>'

iPaymu channels and transaction:

rutebayar api ipaymu --operation payment-channels --method GET
rutebayar api ipaymu --operation transaction --method POST --body '<ipaymu_transaction_payload_json>'

Quick Mapping

ProviderOperationMethodPath
midtransstatus / check-statusGET/v2/{order_id}/status
midtranscharge / createPOST/v2/charge
midtranssnap / snap-transactionPOST/snap/v1/transactions
xenditauth-balance / balanceGET/balance
xenditsession-create / createPOST/sessions
xenditsession-status / statusGET/sessions/{session_id}
dokucheckout / checkout-paymentPOST/checkout/v1/payment
dokuorder-status / statusGET/orders/v1/status/{invoice_number_or_request_id}
dokudirect-debit-v1-token / post-direct-debit-v1-tokenPOST/direct-debit/v1/token
ipaymupayment-channels / channelsGET/api/v2/payment-channels
ipaymutransactionPOST/api/v2/transaction

Troubleshooting

  • 401 or 403: check credentials, environment, and base URL.
  • 400: the payload does not match the provider schema yet.
  • invalid_signature or invalid_client_id: usually DOKU credentials, timestamp, base URL, or JSON body mismatch.
  • Operation not found: run rutebayar api <provider> --help, or use --path.
  • Endpoint succeeds but transaction status does not change: check the provider lifecycle; API mode calls the official endpoint but does not force local payment state.

For normal payment flows, keep using rutebayar pay create, rutebayar pay status, and rutebayar reconcile. API mode is the raw path for inspection and additional provider endpoints.