Barion
yui/craft-barion adds Barion as an online payment
method to checkout on a store running yui/craft-plugin. Barion is a Hungarian
electronic money institution popular with merchants in Hungary and neighboring
countries; the plugin drives Barion's hosted card payment page through the
official barion/barion-web-php SDK.
Use it when you want to accept bank card payments (Visa, Mastercard) routed through Barion instead of, or alongside, other yStore payment methods.
What it does
- Registers itself with the yStore payment method registry
(
PaymentMethodRegistryInterface) so it appears as a selectable payment option at checkout, next to any other configured payment method. - Builds a Barion payment request from the current order (transaction totals, line items, payer email, locale) and redirects the customer to Barion's hosted payment page to enter card details.
- Reads back the payment result from Barion after the customer returns to the store and reports success/paid amount to yStore's checkout flow.
- Adds a License page under the plugin's CP navigation, consistent with other YUI plugins.
- Ships Slovak and Hungarian translations of every settings label and error message; unlisted languages fall back to English.
Where admins work with this plugin
In Craft CP, open Settings → Plugins → Barion:
- Settings (
barion/settings) — merchant credentials, checkout display, and currency/language. See Settings (including a note on the Restrictions tab's current limitation). - License (
barion/license) — activate, redeem, or revoke the plugin license, and copy the entitlement token. Same license flow used across YUI plugins.
There is no dedicated payments/transactions list in this plugin version — Barion is the merchant of record, so payment status and transaction history are viewed in the Barion merchant dashboard, not in Craft CP.
How the checkout payment flow works
- The customer selects Barion (or the configured Select button name) as their payment method at checkout.
- yStore calls the plugin's
placeOrder(), which builds a BarionPreparePaymentRequestModelfrom the order (payee email, total, currency, line items, locale, callback/redirect URL) and sends it to Barion viaApiService. - If Barion accepts the request, the customer is redirected to
PaymentRedirectUrl— Barion's hosted page — to complete the card payment. - Barion redirects the customer back to the store's checkout callback URL
with a
paymentIdquery parameter. The plugin'spostValidate()calls Barion'sGetPaymentStatefor thatpaymentIdand reports the order as paid once the payment status isSucceeded. - Any Barion API error (invalid request, declined card, expired session) is
logged through the shared yStore error log
(
barion-plugin:placeOrder/postValidate) instead of surfacing raw Barion error payloads to the customer.
Amounts and item prices are rounded to zero decimal places when the
Default currency is HUF, since Barion (and HUF itself) doesn't support
sub-unit amounts for that currency; all other supported currencies (CZK,
EUR, USD) use two decimal places.
Requirements
- Craft CMS 5 project.
yui/craft-coreversion 1,yui/craft-plugin(yStore) version 2+.barion/barion-web-php^1.4.10 (installed automatically as a Composer dependency).- A Barion merchant account with a Barion Wallet email and an API key (POSKey equivalent), available in both Test (sandbox) and Live environments.
- Composer access to
https://packages.yui.sk/.
Installation
composer config repositories.yui composer https://packages.yui.sk/
composer require yui/craft-barion
php craft plugin/install barion
Then open Settings → Plugins → Barion → Credentials and enter the Barion account email and API key (see Settings).
Security notes
- The API key is stored as plain settings data — do not commit it to version control; set it through the CP settings form on each environment instead.
- Enable SandboxMode talks to Barion's test environment and never moves real money; keep it on until a full test payment (success and failure case) has been verified.
sandboxMode,email,apiKey,selectedLanguage, anddefaultCurrencyare site-overridable settings — a multi-site install can use different Barion credentials, environment, or currency per site.
Developer / API reference
See Developer for the Plugin and ApiService methods,
Barion payment status values, and CP routes.
Frequently asked questions
Which currencies does Barion support in this plugin?
The settings form offers CZK, EUR, HUF, and USD as Default
currency. HUF amounts are rounded to whole units before being sent to
Barion; the others use two decimal places.
Can I restrict Barion to specific countries or a date/time window?
The Restrictions tab has Visible From / Visible To and Available
in countries fields, but as of v1.2.1 these values are saved with the
plugin's settings and are not read by yStore's checkout payment method
registry — setting them has no effect on whether Barion appears at checkout.
Treat this tab as not yet functional; do not rely on it to hide Barion for
specific countries or time windows.
How do I test a payment before going live? Turn on Enable SandboxMode and use one of the Barion test card numbers listed on the Credentials tab (see Settings), covering both a successful and a declined payment.
Where do I see completed Barion transactions? In the Barion merchant dashboard, not in Craft CP — this plugin version does not keep its own payment/transaction list.