Skip to content

Latest commit

 

History

History
155 lines (104 loc) · 3.59 KB

README.md

File metadata and controls

155 lines (104 loc) · 3.59 KB

Laravel Dotpay

Build Status styleci Scrutinizer Code Quality SensioLabsInsight Coverage Status

Packagist Packagist Packagist

Instalacja

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"
        }
    ]

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' => '[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

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.