VibeFox Midtrans for OpenCart — Help
Requirements
OpenCart: 3.0.x (tested on 3.0.5.0) or 4.0.2 and later (tested on 4.1.0.3).
PHP: 8.0 or later.
Currency: Indonesian Rupiah (IDR). Midtrans charges in IDR only, so the payment method is offered only when the checkout currency is IDR. There is no currency conversion. Add the IDR currency in System > Localisation > Currencies if your store does not have it.
Midtrans account: you need the Server Key from Midtrans Dashboard > Settings > Access Keys, in the sandbox dashboard and in the production dashboard. Only the Server Key is used. The Client Key is not needed for Snap Redirect. The payment methods themselves (GoPay, QRIS, virtual accounts and others) are enabled in your Midtrans account.
VibeFox license key: bought on vibefox.net. One key works on one domain.
Installation
The download is one zip file with the packages for both OpenCart versions. Unpack it on your computer. It contains README.txt, the OpenCart 3 package wcp_midtrans_payment_gateway-oc3-(version).ocmod.zip and the OpenCart 4 package wcp_midtrans_payment_gateway.ocmod.zip. Install only the package for your OpenCart version. The license key is the same for both versions.
OpenCart 3
1. In the admin go to Extensions > Installer, click Upload and choose the file wcp_midtrans_payment_gateway-oc3-(version).ocmod.zip. The extension has no OCMOD modifications, so Extensions > Modifications does not need a refresh. Instead of the installer you can copy the contents of the upload folder of this package into the root folder of your store.
2. Go to Extensions > Extensions and choose the type Payments. Find VibeFox Midtrans Payment Gateway and click Install (the green + button). Your admin user needs the right to modify the payment extensions list.
3. Click Edit (the pencil button) to open the settings page. Paste your VibeFox license key into License key in the license block at the top of the page and click Activate (see License key).
4. Enter the Server Keys and copy the payment notification URL into the Midtrans dashboard (see Configuration).
5. Turn on Enable/Disable and click Save. Test in Sandbox, then switch Environment to Production.
OpenCart 4
1. In the admin go to Extensions > Installer, click Upload and choose the file wcp_midtrans_payment_gateway.ocmod.zip. Do not rename the file: OpenCart 4 takes the extension code from the file name, and a renamed package does not work.
2. The package appears in the list of installed extensions on the same page. Click Install (the green + button) next to it.
3. Go to Extensions > Extensions and choose the type Payments. Find VibeFox Midtrans Payment Gateway, click Install (the green + button), then Edit (the pencil button).
4. Enter the license key, the Server Keys and the notification URL as in steps 3 to 5 for OpenCart 3. The settings page and its fields are the same in both versions. Only the notification URL is different (see Configuration).
A new install starts with the payment method turned off and the Sandbox environment selected.
Configuration
All settings are on the extension page: Extensions > Extensions > Payments > VibeFox Midtrans Payment Gateway > Edit. The sections are listed on the left; the Save button under the list saves the whole page. Above the settings the page warns you when the Server Key of the selected environment is missing (the payment method is then hidden at checkout) and when the default store currency is not IDR, and shows Sandbox mode: payments are simulated, no real money is charged. while Sandbox is selected. Without the right to modify the extension the page shows the settings but cannot save them.
When you save, Title must have 1 to 128 characters, Sort Order must be a whole number, Total must be a number of 0 or greater and Payment page expiry (minutes) must be a whole number. If a value is wrong, the page shows the error and nothing is saved.
Midtrans
Enable/Disable: Enable Midtrans payments turns the payment method on or off. Default: off.
Title: the payment method title shown to customers at checkout. It is also the payment method name stored in the order. Default: Midtrans. Required.
Description: the text shown to the customer at the Confirm Order step, above the confirm button. Default: Pay securely via Midtrans — GoPay, QRIS, ShopeePay, cards, bank transfer and more. In Sandbox the line SANDBOX MODE: no real money is charged. is shown above it.
Sort Order: the position of Midtrans among the payment methods at checkout. Leave it empty or enter a whole number.
Geo Zone: offer Midtrans only for payment addresses in the selected geo zone. Default: All zones. Geo zones are set up in System > Localisation > Geo Zones.
Total: the checkout total, in the default currency of the store, that an order must reach before Midtrans is offered. Leave it empty to offer Midtrans for any total.
API credentials
Copy the Server Key from Midtrans Dashboard > Settings > Access Keys. The section has links to the production and the sandbox dashboard.
Environment: which Midtrans environment new payments use. Switching uses the key and the API of the selected environment. Orders keep the environment they were paid in, for refunds and notifications. Default: Sandbox.
Production Server Key: starts with Mid-server-. Keep it secret.
Sandbox Server Key: starts with SB-Mid-server-.
Saved keys are never shown again. The field stays empty and shows Saved — leave empty to keep it. Type a new value only to change it. To remove a saved key, tick Clear the saved key on save under the field and click Save.
Payment notification URL
The notification tells your store that a payment has been made. The Notification URL field shows the URL to use. On OpenCart 3 it looks like https://your-store/index.php?route=extension/payment/wcp_midtrans_payment_gateway/webhook, on OpenCart 4 like https://your-store/index.php?route=extension/wcp_midtrans_payment_gateway/payment/wcp_midtrans_payment_gateway.webhook. It is built from the storefront address of your OpenCart installation. Copy the URL exactly as the settings show it and paste it into Midtrans Dashboard > Settings > Payment > Notification URL, in the sandbox dashboard and in the production dashboard you use. The URL must be reachable from the internet. If you open it in a browser, it shows a short explanation, so you can check that it is reachable. The Test notification URL button in the Midtrans dashboard is answered as well.
Each notification must carry a valid signature made with one of your Server Keys, and the environment of the key must match the environment of the payment. Notifications without a valid signature are rejected. The status is then read again from the Midtrans status API before the order changes. The extension handles these Midtrans transaction statuses:
Without the notification URL, an order is confirmed only when the customer returns to the store after paying, and a delayed payment made later is not seen until the customer comes back.
Payment settings
Midtrans charges in IDR only, and amounts are sent in whole rupiah. If the order lines do not add up to the rounded total, a Rounding adjustment line is sent to Midtrans.
Payment page expiry (minutes): how long the customer can pay (Snap page, virtual account and so on). Leave empty or 0 for the Midtrans default.
Order ID prefix: added to the number sent to Midtrans, so several stores can share one Midtrans account. The number is the OpenCart order ID with a time stamp, for example OC-123-1700000000. Letters, digits and - _ . ~ only, up to 20 characters; other characters are removed on save. Notifications of other stores are ignored. Default: OC-.
Orders
OpenCart creates the order at the Confirm Order step without a status (a missing order). The order gets a status only after Midtrans has confirmed the transaction. Each field below lists your OpenCart order statuses.
Status after payment: the status after a confirmed payment. Default: Processing. Choose a completed status to mark paid orders completed, or your own review status to check every paid order manually.
Awaiting Midtrans payment status: Midtrans reports pending: a virtual account, convenience store or QRIS code was issued, or a card 3-D Secure check is not finished. Default: Pending.
Midtrans payment on hold status: the payment needs your review (see Order statuses). Default: Pending, because OpenCart has no On hold status. You can create your own status in System > Localisation > Order Statuses and select it here.
Payment failed status: Midtrans reports deny or failure for a waiting order. Default: Failed.
Payment expired / cancelled status: the pending transaction of a waiting order expired or was cancelled. When you set an unpaid Midtrans order to this status yourself, its pending Midtrans transaction (for example an issued virtual account) is expired so it can no longer be paid. Default: Canceled.
Refunded status: the payment was fully refunded from the order page or in the Midtrans dashboard. Default: Refunded.
Advanced
Debug log: writes API calls and notifications to midtrans_p_debug.log.php in the OpenCart logs folder (storage/logs). The file cannot be opened from the web. Errors are always logged. Keys and customer data are never logged. Default: off.
Log: shows the size and the latest entries of the log. Click Clear log to empty it.
Delete data on uninstall: when on, uninstalling the extension removes the gateway settings and the log. The Midtrans payment references and refunds of orders always stay, so old orders can still be refunded after a re-install. Default: off.
Import / Export
Export: Download JSON saves the settings as a JSON file. Server Keys are not exported.
Import: paste previously exported JSON and click Import to restore the settings. Saved Server Keys are kept.
Checkout
At the Payment Method step the customer chooses the payment method (by default Midtrans). At the Confirm Order step the customer sees your description and the note You will be redirected to the Midtrans payment page (GoPay, QRIS, ShopeePay, cards, bank transfer and more). OpenCart creates the order at this step, still without a status. When the customer clicks Confirm Order, the extension creates a Midtrans Snap transaction for the order total in whole rupiah, with the order lines, shipping, discounts, tax and the customer's billing and shipping details, and sends the customer to the Midtrans payment page. There the customer chooses any method enabled in your Midtrans account. On OpenCart 4 the customer picks the payment method with the Choose button of the payment method block, in the window Payment method options, and clicks Confirm Order at the bottom of the checkout page.
After paying, the customer returns to your store. The return link itself never marks an order paid: the order is marked paid only after Midtrans confirms it, by the signed notification or by a request to the Midtrans status API when the customer comes back. The order then gets its status the standard OpenCart way, with the usual order e-mails and stock update, and the customer sees the OpenCart order success page. For a delayed payment the page also shows We are waiting for Midtrans to confirm your payment. If you chose a bank transfer, virtual account or convenience store, please complete the payment using the instructions from Midtrans. You will receive an e-mail once the payment is confirmed. If Midtrans cannot be reached when the customer comes back, a Payment confirmation page shows We are confirming your payment with Midtrans. The order will be updated automatically — please do not pay again. with a Check again button and a Back to checkout button.
If the customer left the Snap page without paying, the customer is back at checkout with The Midtrans payment was not completed. You can try again below. If the payment was declined or has expired, the message is Your Midtrans payment was declined or has expired. Please try again or choose another payment method. On OpenCart 4 these messages are shown above the checkout page. The cart is kept. OpenCart 3 creates a new order every time the Confirm Order step is shown, OpenCart 4 keeps one order for the checkout and pays the same order again. Either way the extension treats all orders of one cart as one payment: when the customer pays again, an unused or pending Snap of the same amount is reused (an issued virtual account stays valid); if the amount changed, the pending transaction is expired at Midtrans first; if a previous Snap was paid meanwhile, that payment is confirmed and the customer goes to the success page without a new transaction.
OpenCart 4 keeps the order in the checkout until the success page is shown. If that order was closed without a payment meanwhile (for example the payment was declined or has expired, or you cancelled the order), the customer is sent back to the checkout with Your previous order was cancelled without a payment. Please confirm the order again to pay with a new order., and the next Confirm Order pays a new order. If that order is already placed and the cart has changed since, the message is Your previous order #(number) has already been placed. Your cart has changed: please confirm the new order to pay for it. A change of the cart, including a new quantity, counts as a new cart that needs its own payment. If the payment of an order was declined or has expired after the cart was already emptied (for example after a virtual account payment), the customer sees The Midtrans payment of order #(number) was declined or has expired, so the order will not be shipped. To buy these items, please place a new order.
If Midtrans cannot start the payment, the customer stays at the Confirm Order step with a short message above the button: Could not connect to Midtrans. Please try again in a moment., Midtrans payments are temporarily unavailable. Please choose another payment method or contact us. (for example with a wrong Server Key) or the reason from Midtrans. The technical reason is written to the log.
The notification also works while the store is in maintenance mode, because OpenCart 3 lets payment extension requests through and on OpenCart 4 the extension adds a startup action for it, which also lets the customer return from Midtrans.
The extension uses Snap Redirect only. It has no Snap pop-up, no card form on your site, no saved cards or one-click payments, no installment or promo settings (configure payment methods in the Midtrans dashboard) and no subscriptions. Card payments are captured immediately, with no separate authorize and capture.
Orders and refunds
Order statuses
No status (missing order): the customer was sent to Midtrans and has not paid, or Midtrans has not confirmed the payment yet. In Sales > Orders such orders are shown only with the filter Order Status set to Missing Orders.
Awaiting Midtrans payment status (default Pending): the customer chose a delayed method or started a card payment that is not finished. When Midtrans reports the payment, the order moves to Status after payment.
Status after payment (default Processing): the payment was confirmed. A note shows the payment method, the Midtrans order ID and the transaction.
Midtrans payment on hold status (default Pending): a card payment is under fraud review (challenge, no money recorded yet), the paid amount or currency did not match the order (the order is not marked paid), or a payment arrived for a cancelled order (the order is not re-opened automatically). The note explains it. Check the order, then fulfil it or refund the payment.
Payment expired / cancelled status (default Canceled): the unpaid transaction of a waiting order expired or was cancelled.
Payment failed status (default Failed): the payment failed, or a challenged card payment was denied.
Refunded status (default Refunded): the payment was fully refunded.
OpenCart notifies the customer of these status changes the usual way. If a second payment arrives for the same cart, the order is not changed. A note on the paid order asks you to refund the second payment in the Midtrans dashboard. A payment for a refunded order adds a note only.
Notes are entries in the order History that the customer does not see.
VibeFox Midtrans Payment Gateway tab
In Sales > Orders open an order paid with Midtrans. At the bottom of the order page, next to History and Additional, the VibeFox Midtrans Payment Gateway tab shows the Midtrans order ID, the Transaction ID (linked to the transaction in the Midtrans dashboard of the payment's environment) with a Sandbox label for sandbox payments, the Payment method, the Status, the amounts Paid / refunded, the refund form, the refund history and the Midtrans notes of the order. The tab is shown to users who have access to the extension.
Refunds
In the VibeFox Midtrans Payment Gateway tab enter the Amount (the amount not refunded yet is filled in), optionally a Reason (optional), and click Refund via Midtrans. Confirm the question Refund this amount through Midtrans? This cannot be undone. Full and partial refunds are supported in whole rupiah; an amount with decimals is refused. You need the right to modify the extension (set in System > Users > User Groups). You can refund up to the amount Midtrans actually charged, even if the order was edited later. The refund is sent in the environment the payment was made in, so that environment's Server Key must be set. Midtrans allows API refunds only for some payment methods and settled transactions. If Midtrans does not accept the refund, the tab shows the error and no refund is recorded; then refund in the Midtrans dashboard. A successful refund is added to the refund history and the notes. A full refund sets the order to Refunded status without notifying the customer and without returning products to stock, like a manual status change. A partial refund does not change the status. Refunds are available once Midtrans has reported the payment settled.
Product returns in Sales > Returns do not send money back through Midtrans.
Refunds made in the Midtrans dashboard arrive by the notification and are added to the refund history automatically, with the reason Refunded in the Midtrans dashboard. When the whole payment is refunded there, the order gets the Refunded status.
License key
The extension works with a VibeFox license key from vibefox.net. The license block License — VibeFox Midtrans Payment Gateway is the first block on Extensions > Extensions > Payments > VibeFox Midtrans Payment Gateway > Edit, above the settings. Paste the key into License key and click Activate. After that the block shows the key masked, the status (for example the date the license is active until and your domain) and the buttons Check now to check the status again, Change key to enter another key and Remove key to remove the key from this store. Below them are the line Product: opencart-payment-midtrans and the link Manage licenses and domains in your account, which opens your vibefox.net account. Only admin users with the Modify permission for the extension can change the key. The texts of the block follow the admin language (English and Russian are included).
If the key is not accepted, the block says why, for example Key not found, This key belongs to another product, Domain limit reached or License expired on a date. After the store address changes, or after you free a domain slot in your account, click Check now. If the license server cannot be reached, the extension keeps working on the last known status.
One key works on one domain: the store address from the OpenCart configuration. Removing the key from the store does not free its domain slot. Free the slot in your vibefox.net account.
Without an active key, Midtrans is not shown to customers at checkout. If a payment is started anyway, the customer sees This payment method is not available. Please choose another one. An admin user who is logged in to the admin in the same browser still sees the payment method in the store, marked (unlicensed — visible to admins only), so you can set up and test the extension before you buy a key. On OpenCart 4 this preview is not available: the store does not see the admin login, so without an active key the payment method is hidden for everybody. After you have opened the Edit page once, a reminder appears on the admin Dashboard. Close it with × to hide it for 7 days. Existing orders are not affected: payments already started are still confirmed, and refunds work.
When a license expires, the extension keeps working, but updates and support need a renewal. The status is checked again automatically when you open the admin Dashboard or the Edit page: once a day for the first 14 days after the key is entered, then once a week. No cron job is needed. Uninstalling the extension always removes the license key and license status.
Troubleshooting
Midtrans does not appear at checkout: check that the license is active, Enable/Disable is on and the selected Environment has its Server Key. Check that the checkout currency is IDR, that the payment address is in the selected Geo Zone and that the order reaches the Total set in the settings. The settings page shows a warning when the key is missing or the store currency is not IDR.
The payment went through, but the order stays without a status: the notification is not working. Check that the payment notification URL is set in the Midtrans dashboard of the environment you use (sandbox or production), that it is exactly the URL shown in Notification URL and that it is reachable: open it in a browser, it shows a short explanation. Turn on Debug log to see the notifications. The order also gets its status when the customer returns to the store after paying.
Notification answers Invalid signature: the notification was not signed with your Sandbox or Production Server Key. Check that the keys in the settings belong to the same Midtrans account as the dashboard that sends the notifications.
Notification answers Server key not configured: no Server Key is set. Enter it in the settings; Midtrans retries the notification.
Notification answers Order not found — ignored: the Midtrans order ID was not issued by this store, for example by another store on the same Midtrans account. Give each store a different Order ID prefix.
Notification answers Environment mismatch — ignored: the notification was signed with the key of the other environment than the payment was made in.
Notification answers Verification failed, please retry: the Midtrans status API could not be reached. Midtrans retries the notification.
Notification answers Busy, please retry: the cart was being updated by another request at the same moment, or the order status could not be set. Midtrans retries the notification. Look at the log for the reason.
The order is in the review status: read the Midtrans notes in the tab. The card payment is under fraud review, the paid amount or currency did not match the order, or the payment arrived after the order was cancelled.
The customer sees an error after Confirm Order: look at the Log field on the extension page; errors are always logged. A wrong Server Key gives the message that Midtrans payments are temporarily unavailable. Midtrans only supports payments in IDR (Indonesian Rupiah). Please choose another payment method. means the order is not in IDR. This payment method is not available. means the checkout session no longer matches the order, or the payment method was turned off meanwhile: the customer reloads the checkout.
The customer is back at checkout with Payment verification failed.: the return link was incomplete or does not belong to the order. The order still gets its status from the notification.
No refund form in the tab: the tab says why: the payment is not settled yet, it is fully refunded, your user group has no right to modify the extension, or no Server Key is set for the environment the order was paid in.
Refund fails: the payment method or transaction state does not allow API refunds; refund in the Midtrans dashboard, and the refund is recorded on the order automatically.
For developers: before the Snap transaction is created, the extension triggers the OpenCart event midtrans_p_snap_payload with the request data and the order; the order ID and the amount cannot be changed.
Uninstall
Go to Extensions > Extensions, choose the type Payments and click Uninstall (the red − button) next to VibeFox Midtrans Payment Gateway. The license key and license status of this extension are always removed. OpenCart always removes its own settings of the extension: Enable/Disable, Sort Order, Geo Zone, Total and the order statuses of the Orders section, which return to their defaults on a re-install. The OpenCart events of the extension are removed too (on OpenCart 4 also its startup action, which lets the notifications through in maintenance mode). If Delete data on uninstall is on, the other gateway settings (title, description, environment, Server Keys, payment settings, logging) and the log are removed. If it is off, they are kept for a later re-install. The Midtrans payment references and refunds of orders are always kept, so orders paid before can still be refunded after a re-install. Existing orders keep their payment notes.
On OpenCart 4, to remove the files of the extension as well, go to Extensions > Installer after the uninstall and click Uninstall (the orange − button) next to VibeFox Midtrans Payment Gateway in the list of installed extensions, then Delete (the red bin button) to remove the uploaded package.
Midtrans is a trademark of its respective owner. This extension is not affiliated with or endorsed by Midtrans.
