Przez composera
composer require liteweb/laravel-dotpay
lub
Dodaj rezpozytorium do composer.json
"require": {
"liteweb/laravel-dotpay": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "[email protected]:liteweb-io/laravel-dotpay.git"
}
]
Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.
Liteweb\LaravelDotpay\ServiceProvider::class,
php artisan vendor:publish --provider="Liteweb\LaravelDotpay\ServiceProvider" --tag="config"
Predefiniowany routing
/dotpay/callback POST
Następnie edytuj plik konfiguracyjny i dodaj zmienne do .ENV
DOTPAY_USERNAME=
DOTPAY_PASSWORD=
DOTPAY_SHOP_ID=
DOTPAY_PIN=
DOTPAY_BASE_URL=
DOTPAY_URL=
DOTPAY_CURL=
DOTPAY_EXPIRATION_DATETIME=
Utwórz metodę która będzie kreowała płatność
Przykład
public function pay(Request $request)
{
$data = [
'amount' => '100',
'currency' => 'PLN',
'description' => 'Payment for internal_id order',
'control' => $transaction->id, //ID that dotpay will pong you in the answer
'language' => 'pl',
'payer' => [
'first_name' => 'John',
'last_name' => 'Smith',
'email' => '[email protected]',
'phone' => '+48123123123'
],
];
$response = $this->dotpayApi->createPayment(new Payment($data));
return $response->getPaymentUrl();
}
Dane do wysłania
{
"amount" : "100",
"currency" : "PLN",
"description" : "Payment for internal_id order",
"control" : "12345",
"language" : "pl",
"payer" : {
"first_name" : "John",
"last_name" : "Smith",
"email" : "[email protected]",
"phone" : "+48123123123"
}
}
Event na dotpay callback
DotpayCallbackEvent
I gotowe
If you discover any security related issues, please email instead of using the issue tracker.
This package is bootstrapped with the help of melihovv/laravel-package-generator.