Download the PHP package otobul/epaybg-bundle without Composer
On this page you can find all versions of the php package otobul/epaybg-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download otobul/epaybg-bundle
More information about otobul/epaybg-bundle
Files in otobul/epaybg-bundle
Package epaybg-bundle
Short Description Symfony bundle for the ePay.bg communication package for merchants.
License MIT
Informations about the package epaybg-bundle
Symfony bundle for ePay.bg
OtobulEpaybgBundle is symfony bundle to help working with ePay.bg communication package for merchants.
1. Installation
Install the package with:
If you're not using Symfony Flex, you'll also
need to enable the Otobul\EpaybgBundle\OtobulEpaybgBundle
in your config/bundles.php
file and configure the bundle.
2. Configuration
2.1 Configure the bundle
Configure the bundle in packages/otobul_epaybg.yaml
The default values can be listed with:
To work properly you need also to configure dev env files. If you don`t have access to ePay.bg demo system you can visit https://demo.epay.bg/ and make registration to get demo merchant number and secret keys.
2.2 Configure webhook notification
To use webhook notification you need to add webhook notification route to your config. Configure the route in config/routes/otobul_epaybg.yaml
The new notification URL will be something like: https://your-domain.com/webhook/epaybg/
, add the notification URL in your ePay.bg account.
3. Usage
This bundle provides:
- controller to handle ePay.bg webhook notification;
- service that can be used in you console command or custom controller;
- template functions to generate "Pay" button and Easypay payment code directly in your template.
3.1 Template
3.1.1 Generate "Pay" button for WEB_LOGIN form
To generate simple web_login "Pay" button in your template you can use epayWebLoginForm
twig function. Example:
Required parameters:
- invoice: Your unique invoice number;
- amount: Total sum in BGN. This is the default currency.
Advanced configuration of web_login "Pay" button allow you to configure other optional parameters:
Optional parameters:
- returnUrl: Your success route. ePay.bg will redirect the user after successful payment;
- cancelUrl: Your cancel route. ePay.bg will redirect the user after cancel payment;
- expDate: Expiration date. Variable need to be in \DateTime. Default is +7 days;
- currency: ISO three-letter currency code. Accepted value are BGN|EUR|USD;
- description: Extra description max to 100 symbols;
- encoding: Accepted value are utf-8 or CP1251;
- button: Label of the pay button.
3.1.2 Generate "Pay" button for CREDIT_CARD form
To generate simple credit_card "Pay" button in your template you can use epayCreditCardForm
twig function. Example:
For advanced configuration you can use the same optional parameter from above.
3.1.3 Generate "Easypay code" in template
To generate Easypay code in your template you can use epayEasypayCode
twig function. Example:
Please note that this will make HTTP request to Easypay server to retrieve the code. Use this careful! Recommended way is to generate the code in your controller and store it for later use.
3.2 Controller
3.2.1 Generate "Easypay code" in controller
Example usages of EpayManager service in controller to retrieve Easypay payment code.
3.2.2 Generate "Pay" button for WEB_LOGIN form in controller
Example usages of EpayManager service in controller to generate "Pay" button form.
To generate CREDIT_CARD form use createCreditCardForm
function.
3.3 Events
- NOTIFICATION_RECEIVED: Called directly after the webhook notification is received. Listeners have the opportunity to get the raw content.
- NOTIFICATION_ERROR: Called if webhook notification has not valid checksum or data. Listeners have the opportunity to get the error message.
- NOTIFICATION_RESPONSE: Called directly before the webhook notification response to be sent. Listeners have the opportunity to get the raw response content.
- INVOICE_NOTIFICATION_RECEIVED: Called directly after the invoice notification is received. Listeners have the opportunity to process the invoice data.
- EASYPAY_CODE_CREATED: Called directly after the Easypay code is received. Listeners have the opportunity to get the code and payment data.
Example event subscriber for INVOICE_NOTIFICATION_RECEIVED this event is called directly after the invoice notification is received. Listeners have the opportunity to process the invoice data.
Example for advanced event subscriber.
All versions of epaybg-bundle with dependencies
symfony/framework-bundle Version ^4.4 || ^5.0 || ^6.0 || ^7.0
symfony/string Version ^5.0 || ^6.0 || ^7.0
symfony/validator Version ^4.4 || ^5.0 || ^6.0 || ^7.0
symfony/form Version ^4.4 || ^5.0 || ^6.0 || ^7.0
symfony/http-client Version ^4.4 || ^5.0 || ^6.0 || ^7.0
twig/twig Version ^2.13 || ^3.0