Back

VibeFox Pagar.me 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: Brazilian Real (BRL). The store must have the currency BRL (System > Localisation > Currencies), and the payment method is shown only when the customer checks out in BRL and the order total is greater than zero.

Pagar.me account: you need the secret keys of your Pagar.me account: the test key (sk_test_...) and, to go live, the live key (sk_...). They are in the Pagar.me dashboard under Development > Keys. Only the secret keys are used; the public key (pk_...) is not needed. Only the payment methods enabled in your Pagar.me account can be offered.

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_pagarme_gateway-oc3-(version).ocmod.zip and the OpenCart 4 package wcp_pagarme_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_pagarme_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 Pagar.me 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 test secret key and, when you go live, the live secret key.

5. Create the webhook in the Pagar.me dashboard with the URL shown in the settings (see Configuration).

6. Turn on Enable / Disable and click Save. Make test payments with Test mode on, then turn it off to take real payments.

OpenCart 4

1. In the admin go to Extensions > Installer, click Upload and choose the file wcp_pagarme_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 Pagar.me Gateway, click Install (the green + button), then Edit (the pencil button).

4. Enter the license key, the secret keys and the webhook as in steps 3 to 6 for OpenCart 3. The settings page and its fields are the same in both versions. Only the webhook URL is different (see Payment notifications (webhook)).

A new install starts with the payment method turned off and test mode on.

Configuration

All settings are on the extension page: Extensions > Extensions > Payments > VibeFox Pagar.me Gateway > Edit. The sections are listed on the left; the Save button under the list saves the whole page. Above the settings the page shows the current mode: TEST MODE (payments are created with the test secret key, no real charges) or LIVE. It warns you when the secret key of the current mode is missing (the payment method is then hidden at checkout), when the test key does not start with sk_test_, when the live key does not start with sk_ or is a test key, and when the default currency of the store is not BRL. Without the right to modify the extension the page shows the settings but cannot save them.

When you save, Title must not be empty (up to 128 characters), Boleto due in (days) must be a whole number from 1 to 30, Sort Order must be a whole number (negative numbers are allowed), Total a number of 0 or more, and the geo zone and order statuses must exist. If a value is wrong, an error names it and nothing is saved.

Pagar.me

Enable / Disable: Enable Pagar.me payments turns the payment method on or off. Default: off.

Title: the payment method name customers see at checkout. It is also the payment method name stored in the order. Default: Pagar.me. Required, up to 128 characters.

Description: the text shown to the customer at the Confirm Order step, above the confirm button. Default: Pay securely via Pagar.me (credit card, PIX or boleto). You will be redirected to complete your payment.

Sort Order: the position of Pagar.me among the payment methods at checkout. Leave it empty or enter a whole number.

Geo Zone: offer Pagar.me only for payment addresses in the selected geo zone. Default: All zones. Geo zones are set up in System > Localisation > Geo Zones. On OpenCart 4, when the store asks for no payment address, the shipping address is used.

Total: the checkout total, in the default currency of the store, that an order must reach before Pagar.me is offered. Leave it empty to offer Pagar.me for any total.

API keys

Copy the secret keys from the Pagar.me dashboard (the section links to it): Development > Keys. Pagar.me uses one API address for test and live payments; the key decides whether a payment is a test or real.

Test mode: uses the test secret key, no real charges. While it is on, customers see TEST MODE — Use test credentials. No real charges. at the Confirm Order step. Status checks and refunds of an order always use the key of the mode in which its payment was created. Default: on.

Test secret key: the Pagar.me test secret key (sk_test_...). Used while test mode is on.

Live secret key: the Pagar.me live secret key (sk_...). Used when test mode is off. Keep it secret.

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 page

The methods offered on the Pagar.me payment page, each with its own switch. Only choose methods enabled in your Pagar.me account. If none is selected, credit card, PIX and boleto are offered. Default: Credit card, PIX and Boleto.

Credit card: authorized and captured at once.
PIX: the order waits in the awaiting status until Pagar.me confirms the PIX payment.
Boleto: the order waits in the awaiting status until Pagar.me confirms the boleto payment.
Debit card: debit card on the Pagar.me page.

Boleto due in (days): the number of days until the boleto is due, from 1 to 30. Default: 3. Another value is refused on save with Boleto due in (days): enter a number from 1 to 30.

Payment notifications (webhook)

In the Pagar.me dashboard open Settings > Webhooks and create a webhook with the URL shown in Webhook URL in this section. On OpenCart 3 it looks like https://your-store/index.php?route=extension/payment/wcp_pagarme_gateway/webhook, on OpenCart 4 like https://your-store/index.php?route=extension/wcp_pagarme_gateway/payment/wcp_pagarme_gateway.webhook. It is built from the storefront address of your OpenCart installation. Copy it exactly as the settings show it. The URL must be reachable from the Internet.

Select these events (they are also listed in this section):

order.paid: the Pagar.me order was paid.
order.payment_failed: the payment failed.
order.canceled: the Pagar.me order was canceled or expired.
charge.paid: a charge was paid, for example a PIX or boleto paid later.
charge.pending: a charge is waiting for payment, for example an issued boleto.
charge.refunded: a charge was refunded.
charge.chargedback: the card holder disputed a payment.

The webhook needs no password or signature. Its content is never trusted: the store takes only the Pagar.me order ID from it and reads that order from the Pagar.me API with the key of the mode it was created in. Notifications for Pagar.me orders that were not created by this store are ignored. Without the webhook, PIX and boleto payments made later are only confirmed when the customer returns to the store.

Orders

OpenCart creates the order at the Confirm Order step without a status (a missing order). The order gets a status only after Pagar.me has reported the payment by the webhook or on the customer's return; the Pagar.me order is always read back from the API. Each field below lists your OpenCart order statuses.

Order Status After Payment: the status set after a verified Pagar.me payment. Default: Processing.

Awaiting Pagar.me Payment Status: a PIX code or boleto was issued, or a card payment is in analysis; Pagar.me confirms the money later. Default: Pending.

Pagar.me 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: the payment of a waiting order failed, was canceled or expired. If Pagar.me still reports it paid later, the order gets the status after payment. Default: Failed.

Cancelled Order Status: the status your store uses for cancelled orders. The extension does not set it: a Pagar.me payment arriving after it puts the order in the review status. Default: Canceled.

Refunded Status: set after the payment is fully refunded from the order page or in the Pagar.me dashboard. Default: Refunded.

Advanced

Debug log: writes API requests and notifications to wc_pgm_debug.log.php in the OpenCart logs folder (storage/logs). The file cannot be opened from the web. Errors and warnings are always logged. Keys and customer data (e-mail, phone, CPF) are not 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. Orders and their Pagar.me payment data (needed for refunds) are always kept. Default: off.

Import / Export

Export: Download JSON saves the settings as a JSON file. Secret keys are not exported.

Import: paste previously exported JSON and click Import to restore the settings. Saved secret keys are kept.

Checkout

At the Payment Method step the customer chooses the payment method (by default Pagar.me). At the Confirm Order step the customer sees your description and the note You will be redirected to the Pagar.me payment page to pay by credit card, PIX, boleto or debit card. OpenCart creates the order at this step, still without a status. 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. When the customer clicks Confirm Order, the extension creates a Pagar.me order for the order total in BRL and sends the customer to the Pagar.me payment page. The order lines with tax, shipping and other surcharges are sent as items; when the order has a discount (coupon, voucher, reward points) or the lines do not add up to the total, one line Order # with the order number is sent for the total. A valid e-mail is required.

The customer's name and e-mail are passed to Pagar.me. CPF or CNPJ (11 or 14 digits) is taken from a custom field of the customer or the payment address whose name contains CPF or CNPJ; OpenCart has no such field by default, so add it in Customers > Custom Fields if you want to pass it. On OpenCart 4, when the store asks for no payment address, the shipping address and its custom fields are used. A Brazilian mobile number is passed as well. The billing address is passed only for a Brazilian address with an 8-digit CEP and a state. Without a CPF or CNPJ the customer enters it on the Pagar.me page.

After paying, the customer returns to your store. The order is marked paid only after Pagar.me confirms it: the store reads the Pagar.me order from the API, and the paid amount and currency must match the order. 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. An issued PIX or boleto that is not paid yet puts the order in the awaiting status, and the page also shows Your Pagar.me payment is awaiting confirmation (PIX / boleto). The order will be confirmed as soon as Pagar.me reports the payment. For an order in the review status it shows We are confirming your payment with Pagar.me. The order will be updated automatically — please do not pay again. Each later return reads the Pagar.me order again, so a PIX or boleto paid in the meantime is applied even when the webhook did not arrive.

If the customer comes back without paying, the customer is back at checkout with The Pagar.me payment was not completed. You can try again or choose another payment method. If the payment was declined or canceled, the message is The Pagar.me payment was declined or canceled. You can try again or choose another payment method. The cart is kept. On OpenCart 4 these messages are shown above the checkout page. If the order already has a status and its payment failed or expired, the message is The Pagar.me payment of your order was declined, canceled or has expired. Please place a new order or contact us. If the cart is already empty (for example, the order had reached the success page before its PIX or boleto expired), there is nothing to pay at checkout: a Payment confirmation page says The Pagar.me payment of order #N was not completed (declined, canceled or expired), so the order will not be shipped. To buy these items, please place a new order. with a Continue button. If Pagar.me could not be reached, a Payment confirmation page asks the customer not to pay again and offers Check again and Back to checkout.

OpenCart 3 creates a new order every time the Confirm Order step is shown. OpenCart 4 keeps one order for the checkout and updates it, so after an unfinished or declined payment the customer pays the same order again. Before a new payment the extension checks the earlier attempts of the same cart: if one is paid, or its PIX or boleto is waiting, the customer goes to the success page without a new payment. An open Pagar.me payment page of the same order is reused if the amount and mode are the same; other open pages are closed at Pagar.me first. If a second Pagar.me order of the cart is paid anyway, it is not applied, and a note on the paid order asks you to refund the duplicate.

OpenCart 4 keeps the order in the checkout until the success page is shown. If that order was closed meanwhile (for example its PIX or boleto expired, its payment failed or you cancelled or refunded it), Confirm Order sends the customer back to the checkout with Your previous order was cancelled or its payment failed. Please confirm the order again., or, when the order had been paid before you closed it, This order was closed by the store, so it will not be shipped. Your cart is kept: confirm the order again to pay. The next Confirm Order pays a new order. When the customer comes back from Pagar.me to an order that was paid and then closed by you, the customer sees the same message at the checkout, or, if the cart is already empty, a page with Order #(number) was closed by the store, so it will not be shipped. To buy these items, please place a new order. If the order of the checkout already has a status and the cart now has other products or quantities, the customer is sent back to the checkout, and the new cart gets a new order.

If Pagar.me cannot start the payment, the customer stays at the Confirm Order step with a short message, for example Could not connect to Pagar.me. Please try again in a moment., or the Pagar.me message about invalid billing details. The technical reason is written to the log.

The webhook also works while the store is in maintenance mode: OpenCart 3 lets payment extension requests through, and on OpenCart 4 the extension adds a startup action that lets the webhook and the customer's return from Pagar.me through.

The extension has no card form inside your checkout, no saved cards, subscriptions or recurring payments, no installment rules, no split payments (marketplace) and no authorize-only card payments.

Orders and refunds

Order statuses

No status (missing order): the customer was sent to Pagar.me and has not paid or issued a PIX or boleto yet, or the payment was declined. In Sales > Orders such orders are shown only with the filter Order Status set to Missing Orders.

On OpenCart 4 an unpaid order of the checkout can get the status Voided, which OpenCart 4 sets when the customer comes back to the Confirm Order step. The extension treats such an order as an order without status, and a later payment still confirms it.

Order Status After Payment (default Processing): the payment was confirmed. A note shows the Pagar.me order ID (or_...) and the payment method.

Awaiting Pagar.me Payment Status (default Pending): a PIX or boleto was issued (or a card payment is in analysis) and is waiting for payment. The order moves to Order Status After Payment when Pagar.me confirms the payment.

Pagar.me Payment On Hold Status (default Pending): the boleto was paid only in part; or the paid amount or currency differs from the order; or the payment arrived after the order had been cancelled or refunded; or a chargeback was opened on a paid order. The note explains it. Check the order and fulfil it or refund the payment.

Payment Failed Status (default Failed): the payment of an awaiting or held order failed, or its Pagar.me order was canceled or expired (for example an unpaid boleto). If Pagar.me reports a payment later, the order still moves to Order Status After Payment.

Refunded Status (default Refunded): the payment was fully refunded through the extension, or refunded or canceled in Pagar.me.

Every Pagar.me status is applied once, so repeated webhooks or returns add no notes or payments. Notes are entries in the order History that the customer does not see.

VibeFox Pagar.me Gateway tab

In Sales > Orders open an order paid with Pagar.me. At the bottom of the order page, next to History and Additional, the VibeFox Pagar.me Gateway tab shows the Pagar.me order ID with a Test mode label for test payments, the Payment method, the Status, the amounts Paid / refunded, the refund form, the refund history and the Pagar.me notes of the order. The tab is shown to users who have access to the extension.

Refunds

In the VibeFox Pagar.me Gateway tab enter the Amount (the amount not refunded yet is filled in), optionally a Reason (optional), and click Refund via Pagar.me. Confirm the question Refund this amount through Pagar.me? This cannot be undone. Full and partial refunds of card and PIX payments are supported. You need the right to modify the extension (set in System > Users > User Groups). You can refund up to the amount Pagar.me actually took, so after an amount mismatch the limit is what the customer paid, not the order total. The refund is sent with the key of the mode the payment was made in, so that mode's secret key must be set. A refund is recorded only when Pagar.me confirms it; otherwise the tab shows the error, for example Pagar.me refused the refund: ... or Pagar.me did not confirm the refund, and no refund is recorded. A successful refund is added to the refund history and the notes with the charge ID. 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 Pagar.me has reported the payment.

Boleto payments can only be refunded to the customer's bank account. Refund them in the Pagar.me dashboard, then record the refund in OpenCart manually. Product returns in Sales > Returns do not send money back through Pagar.me.

A full refund or cancellation made in the Pagar.me dashboard arrives by webhook, sets the order to Refunded Status and adds a note. A chargeback adds a note and puts a paid order in the review status.

License key

The extension works with a VibeFox license key from vibefox.net. The license block License — VibeFox Pagar.me Gateway is the first block on Extensions > Extensions > Payments > VibeFox Pagar.me 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-pagarme 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, Pagar.me 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

Pagar.me does not appear at checkout: check that the license is active, Enable / Disable is on, the secret key of the current mode is set (Test secret key in test mode, Live secret key in live mode) and the customer checks out in BRL. The settings page shows a warning when the key is missing. Also check that the payment address is in the selected Geo Zone and that the order reaches the Total set in the settings.

The payment went through, but the order stays without a status or in the awaiting status: the webhook is not working. In the Pagar.me dashboard check that the webhook exists for the account and mode you use, that its URL is exactly the one shown in Webhook URL and that the events listed above are selected. The order is also checked each time the customer returns to the store.

The webhook answers verification failed, retry later: the store could not read the Pagar.me order from the API, for example because the key of that mode is missing or the API did not answer. Pagar.me retries the webhook.

The webhook answers busy: the cart was being processed by another request at the same moment, or the order status could not be set. Pagar.me retries the webhook. Turn on Debug log to see the reason.

The webhook answers unknown order: the Pagar.me order was not created by this store, for example an order of another store on the same account. Nothing is changed.

The webhook answers invalid payload or invalid order id: the request is not a Pagar.me notification. Nothing is changed.

The customer sees Pagar.me payments are not available right now: the secret key is wrong or missing. Check the key of the current mode.

The customer sees Pagar.me could not start the payment: Pagar.me rejected the billing details, for example the CPF in the custom field. The message names the problem; the full reason is in the log.

The customer sees A valid billing email is required for Pagar.me.: the e-mail of the order is not valid.

The customer sees Pagar.me only supports payments in Brazilian Real (BRL).: the checkout is in another currency.

The customer sees This order already has a Pagar.me payment that the store has to review: an earlier payment of the cart needs your review. Check the Pagar.me dashboard and the log.

Order is in the review status after payment: read the notes in the VibeFox Pagar.me Gateway tab (see Order statuses), then fulfil the order or refund the payment.

No refund form in the tab: the tab says why: the payment is not reported yet, it is fully refunded, your user group has no right to modify the extension, or the secret key of the payment's mode is not set.

Refund fails for a boleto: boleto payments cannot be refunded through the API. Refund in the Pagar.me dashboard and record the refund manually.

For developers: before the Pagar.me order is sent, the extension triggers the OpenCart event wc_pgm_order_data with the request body and the order. The payment amount must stay equal to the order total.

Uninstall

Go to Extensions > Extensions, choose the type Payments and click Uninstall (the red − button) next to VibeFox Pagar.me 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 event of the extension is removed too (on OpenCart 4 its events and its startup action, which lets the webhook and the customer's return through in maintenance mode). If Delete data on uninstall is on, the other gateway settings (title, description, test mode, secret keys, payment methods, boleto days, logging) and the log are removed. If it is off, they are kept for a later re-install. The Pagar.me payment and refund records 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 Pagar.me Gateway in the list of installed extensions, then Delete (the red bin button) to remove the uploaded package.

Pagar.me is a trademark of its respective owner. This extension is not affiliated with or endorsed by Pagar.me.