Download the PHP package axcherednikov/laravel-bepaid without Composer
On this page you can find all versions of the php package axcherednikov/laravel-bepaid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download axcherednikov/laravel-bepaid
More information about axcherednikov/laravel-bepaid
Files in axcherednikov/laravel-bepaid
Package laravel-bepaid
Short Description A wrapper of https://github.com/begateway/begateway-api-php for Laravel
License MIT
Informations about the package laravel-bepaid
BePaid Laravel
A wrapper of BeGateway for Laravel (unofficial)
Documentation
Installation
-
Run:
- Publish config
Usage
Basics
All you need to do is to create a new DTO and fill out original object with provided values.
Here is a simple example:
The table bellow illustrates which object in BeGateway
equals to object in BePaid Laravel
.
All of these objects in BePaid Laravel
package, that listed below, have public field $operation
,
which gives you access to original object.
This is in case if package features are not enough to reach goal.
You can check original package to see all available methods.
BeGateway | BePaid Laravel | Facade | DTO |
---|---|---|---|
AuthorizationOperation | Authorization | Authorization | AuthorizationDto |
CardToken | CardToken | CardToken | CardTokenDto |
PaymentOperation | Payment | Payment | PaymentDto |
GetPaymentToken | PaymentToken | PaymentToken | PaymentTokenDto |
Product | Product | Product | ProductDto |
QueryByPaymentToken | StatusQuery | StatusQuery | StatusQueryByPaymentTokenDto |
QueryByTrackingId | StatusQuery | StatusQuery | StatusQueryByTrackingIdDto |
QueryByUid | StatusQuery | StatusQuery | StatusQueryByUidDto |
RefundOperation | Refund | Refund | RefundDto |
CreditOperation | Credit | Credit | CreditDto |
CaptureOperation | ChildTransaction | ChildTransaction | CaptureDto |
VoidOperation | ChildTransaction | ChildTransaction | VoidDto |
A few words about StatusQuery
and ChildTransaction
objects. They are also have $operation
public field,
but there are nuances. It depends on which DTO you will pass to fill()
or submit()
method. So let's say
you want to query for transaction by uid, in this case you'll create a new StatusQueryByUidDto([...])
, then $operation
field becomes instance of \BeGateway\QueryByUid
.
Subscribe to events
BePaid Laravel
provides preconfigured routes that can be used in requests. Below is the list of it:
Method | Path | Name | Middleware | Event | |
---|---|---|---|---|---|
POST | /bepaid/notifications | bepaid.notifications | bepaid.inject_basic_auth | bepaid.event.notification.success \ | bepaid.event.notification.fail |
GET | /bepaid/success | bepaid.success | - | bepaid.event.success | |
GET | /bepaid/decline | bepaid.decline | - | bepaid.event.fail | |
GET | /bepaid/fail | bepaid.fail | - | bepaid.event.return | |
GET | /bapaid/cancel | bepaid.cancel | - | bepaid.event.cancel | |
GET | /bepaid/return | bepaid.return | - | bepaid.event.decline |
The most important is notifications
. BePaid Laravel
already validates if the incoming request was sent by BePaid.
In success validation scenario it will fire bepaid.event.notification.success
and bepaid.event.notification.fail
if something
went wrong.
How to handle all this stuff?
BePaid Laravel
ships with abstract class BePaidSubscriber
which you need to extend.
Create and register a new Event Subscriber:
Now just extend BePaidSubscriber
and define all required methods. That's it.
All versions of laravel-bepaid with dependencies
laravel/framework Version ^8|^9
begateway/begateway-api-php Version ^4.5
myclabs/php-enum Version 1.8.*