Developer guide
VEX Pay siteAPI reference
Browse documentation

Magento and Adobe Commerce module

The VEX Pay payment module for Magento Open Source and Adobe Commerce 2.4.7 to 2.4.9: hosted checkout, automatic invoices, credit-memo refunds and a cron re-check.

What the module does

Download (version 0.1.0, beta)

Magento Open Source and Adobe Commerce 2.4.7–2.4.9: vexpay-magento-0.1.0.zip. The module is new: try it with a Test key before you take live payments. Installing with Composer from Packagist (vexpay/module-payment) is coming soon; until then install the zip (see "Install").

For stores on Magento Open Source or Adobe Commerce that want to take VEX Pay without building on the API. The module adds one payment method, VEX Pay. The buyer places the order, pays on VEX Pay’s hosted checkout with any method enabled on your account (Pago Móvil, débito inmediato, USDT, Colombian pesos), and comes back to the store. No bank details touch your store.

  • The order waits in Pending payment and is invoiced by itself when VEX Pay reports the payment.
  • Failed or expired payments cancel the order and return its stock.
  • Credit memos reverse the payment in VEX Pay when VEX Pay can refund it in full.
  • Settings per website: each website can use its own VEX Pay account.
  • It works with the standard Luma checkout and with Hyvä, because it adds no checkout JavaScript: the buyer is sent to VEX Pay after the order is placed.

For business owners: a short overview of the Magento integration, in Spanish, at vexpay.app/magento-venezuela.

Versions and requirements

Magento / Adobe CommercePHP
2.4.78.2, 8.3
2.4.88.3, 8.4
2.4.98.3, 8.4, 8.5

It is not supported on 2.4.6 or older. You also need:

  • A VEX Pay account. Use a Test key to try it; Live keys work once VEX Pay has approved your account for live payments (see Going live).
  • An API key from the portal (Claves y webhooks).
  • The payment methods you want enabled on your account (portal → Métodos y tarifas).
  • Magento cron running (bin/magento cron:run every minute, as Magento requires anyway).
  • A public HTTPS address for the store, so VEX Pay can send payment updates.
  • Orders in US dollars (USD) or bolívares (VES). VEX Pay is not offered for other currencies.

Install

  1. Download and unzip

    Download vexpay-magento-0.1.0.zip and unzip it into app/code/VexPay/Payment (create the folders; the module files go straight in it, registration.php included).

  2. Add the PHP SDK

    The module uses the VEX Pay PHP SDK. From the Magento root: composer require vexpay/vexpay-php:^0.25.

  3. Enable the module

    bin/magento module:enable VexPay_Payment, then bin/magento setup:upgrade.

  4. Compile and deploy (production mode)

    bin/magento setup:di:compile and bin/magento setup:static-content:deploy.

  5. Clear the cache

    bin/magento cache:flush. VEX Pay now appears under Stores → Configuration → Sales → Payment Methods.

Installbash
curl -LO https://vexpay.app/descargar/magento/0.1.0/vexpay-magento-0.1.0.zip
mkdir -p app/code/VexPay/Payment
unzip vexpay-magento-0.1.0.zip -d app/code/VexPay/Payment
composer require vexpay/vexpay-php:^0.25
bin/magento module:enable VexPay_Payment
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

Configuration

Go to Stores → Configuration → Sales → Payment Methods → VEX Pay and pick the website in the scope switcher. Keys, mode and the webhook belong to a website; the title can also be set per store view.

SettingWhat it does
EnabledShows VEX Pay at checkout for this website.
TitleThe name buyers see at checkout (default “VEX Pay”). Can differ per store view.
ModeTest or Live. Decides which of the two keys is used.
Test API key / Live API keyYour VEX Pay keys. Checked with VEX Pay when you save; an invalid key is not saved. Stored encrypted and never shown again.
Offer VEX Pay for orders inUSD, VES or both. Orders in another currency don’t see VEX Pay.
Minimum / Maximum Order TotalHide VEX Pay outside this range. Empty maximum = no limit.
Sort OrderPosition among the payment methods.
The webhook is registered for you

When you save a valid key, the module registers https://<your store>/vexpay/webhook with VEX Pay for that website (or updates it on a later save) and keeps its signing secret encrypted. Two websites with two VEX Pay accounts each get their own endpoint and secret. On a local address (localhost, .test, a private IP) nothing is registered and the admin shows a notice: payments still update through the cron re-check, and the webhook is registered once you save the settings on a public address.

How a payment flows

  1. The buyer places the order

    The order is created in Pending payment. No confirmation e-mail is sent yet.

  2. The buyer pays on VEX Pay

    The module creates one checkout session for the order total, in the order currency, with the reference mg_<website id>-<order number>. Placing again (double click, back button) reuses the same session.

  3. The buyer comes back

    The return page reads the payment from VEX Pay once and shows the order as it is. It never marks the order paid on its own: only VEX Pay’s signed update or the re-check can.

  4. VEX Pay reports the payment

    A signed webhook updates the order: invoiced and Processing when paid. The order confirmation e-mail goes out then.

VEX Pay statusMagento order
PENDINGStays in Pending payment, with a comment.
COMPLETEDInvoice created (transaction = VEX Pay payment id), state Processing.
COMPLETED, underpaidPayment review, not invoiced, with a comment giving the amount received. Check it in VEX Pay before shipping.
FAILED or CANCELED while the buyer can still payNo change: the buyer can try another method on the same page.
FAILED or CANCELED with the checkout closed, or the checkout expiredCanceled, stock returned.
COMPLETED after the order was canceledNot invoiced; a comment asks you to decide by hand (fulfil or return the money).
REVERSED in VEX Pay (not from Magento)An offline credit memo, with a comment.

Every change adds an order comment with the VEX Pay payment id and method. A status only moves forward: a late or repeated update (for example a PENDING after the order was invoiced) never moves an order back, and a repeated COMPLETED never creates a second invoice. Updates run under a lock on the order, so the webhook and the re-check can’t both invoice. These rules are the same in every VEX Pay store plugin (see Webhooks for the events and signatures).

The 10-minute re-check

VEX Pay retries webhooks, but a store can still miss one (downtime, a firewall). The cron job vexpay_reconcile runs every 10 minutes in Magento’s default group: it reads up to 50 VEX Pay orders that are still in Pending payment and have been quiet for 10 minutes, oldest first, and applies what VEX Pay reports, exactly like a webhook.

Magento cron must run

Install Magento’s crontab (bin/magento cron:install) or run bin/magento cron:run every minute. When VEX Pay is enabled and the re-check has not run for over an hour, the admin shows a warning.

Refunds

  • Refund (online) on a credit memo from the invoice is offered only for payments VEX Pay can refund through the API, and only for the whole invoice. VEX Pay reverses the payment; if VEX Pay refuses, the credit memo is not saved and the admin sees why.
  • Partial refunds and the other methods are Refund Offline only: Magento records the credit memo, the order gets a comment that VEX Pay did not move the money, and you return it to the buyer yourself.
  • A payment reversed in VEX Pay outside Magento gets an offline credit memo automatically.

Which methods VEX Pay can refund, and how: Refunds & chargebacks.

Troubleshooting

ProblemWhat to check
“The VEX Pay key is not valid” on saveCopy the key again from the portal; a Test key with Mode = Live (or the reverse) is the usual cause. A Live key works only after live approval.
VEX Pay is not shown at checkoutEnabled = Yes and a key saved for this website; the order currency is one you chose (USD or VES); the total is within the minimum and maximum.
Webhook not arrivingThe store must be on a public HTTPS address. Save the settings again to re-register the endpoint, then check its deliveries in the portal (Claves y webhooks). A firewall or WAF must let VEX Pay POST to /vexpay/webhook.
Order stuck in Pending paymentCheck that Magento cron runs (the admin warns after an hour). The re-check picks up quiet orders within 10 minutes; an open checkout stays pending until the buyer pays or it expires.
Cron not runningbin/magento cron:install, or a system cron calling bin/magento cron:run every minute. The job is vexpay_reconcile.
Logsvar/log/vexpay.log. Keys and secrets are never written to it.

Uninstall

Uninstallbash
bin/magento module:disable VexPay_Payment
rm -rf app/code/VexPay/Payment
bin/magento setup:upgrade
bin/magento cache:flush

Past orders keep their invoices, credit memos and comments, and the payments stay in your VEX Pay portal. Orders still in Pending payment are no longer updated: check them in the portal and finish them by hand. Delete the store’s endpoint in the portal (Claves y webhooks) so VEX Pay stops sending updates to it.