liteweb / laravel-dotpay
A laravel dotpay
1.1
2017-11-22 10:33 UTC
Requires
- php: >=7.0
- illuminate/support: ~5.5.0
- liteweb/dotpay: 1.1
Requires (Dev)
- orchestra/testbench: ~3.5.0
- phpunit/phpunit: ~6.0
This package is not auto-updated.
Last update: 2024-11-15 03:14:44 UTC
README
Instalacja
Przez composera
composer require liteweb/laravel-dotpay
lub
Dodaj rezpozytorium do composer.json
"require": { "liteweb/laravel-dotpay": "dev-master" }, "repositories": [ { "type": "vcs", "url": "git@github.com:liteweb-io/laravel-dotpay.git" } ]
Zarejestruj service provider
Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.
Liteweb\LaravelDotpay\ServiceProvider::class,
Opublikuj plik konfiguracyjny
php artisan vendor:publish --provider="Liteweb\LaravelDotpay\ServiceProvider" --tag="config"
Użycie
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' => 'john.smith@example.com', '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" : "john.smith@example.com",
"phone" : "+48123123123"
}
}
Event na dotpay callback
DotpayCallbackEvent
I gotowe
Security
If you discover any security related issues, please email instead of using the issue tracker.
Credits
This package is bootstrapped with the help of melihovv/laravel-package-generator.