Skip to main content
Documentation v2.0
Midtrans payments/docs/billing/midtrans

Billing

Beta

Midtrans payments

Enable production checkout, the notification webhook, signature checks, and transaction statuses.

On this page5 sections

Environment configuration

DOTENV .env
MIDTRANS_MERCHANT_ID=
MIDTRANS_CLIENT_KEY=
MIDTRANS_SERVER_KEY=
MIDTRANS_IS_PRODUCTION=false

Payment notification webhook

Payment statuses must be updated through an HTTPS endpoint that accepts POST requests from Midtrans. The endpoint must verify the signature and process events idempotently.

Transaction statuses

Status Typical action
pending Wait for the payment.
capture/settlement Activate the tokens or transaction benefits exactly once.
expire/cancel/deny Don't add any tokens.
refund/chargeback Reconcile and audit.

Security

Testing

  • Test invalid signatures.
  • Test resent webhooks.
  • Test the finish, unfinish, and failed redirects.
  • Match the order ID, amount, and user.

Documentation feedback

Was this article helpful?

Documentation search

What do you want to learn?

Type at least two characters to search the documentation.
Code copied.