PayBear.io integration with Craft Commerce.
- Install
- Create a PayBear payment method in Commerce
- Put the ID of the payment method in
craft/config/commercepaybear.php
(copy fromconfig.php
in the plugins folder). - Add the following code into your checkout payment page:
{{ craft.commercepaybear.embed({
button: '#idOfButton',
modal: true,
redirect: 'URL to redirect to on completion',
timer: 15 * 60,
}) }}
See https://github.com/Paybear/paybear-samples/tree/master/form#advanced-usage for more options.
Disable CSRF for the callback URL:
<?php
return [
// ...
'enableCsrfProtection' => (
!isset($_SERVER['REQUEST_URI']) ||
(
!strpos($_SERVER['REQUEST_URI'], 'CommercePayBear/callback')
)
),
];