1. Go to this page and download the library: Download evilnet/dotpay library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php
namespace App\Http\Controllers;
use Evilnet\Dotpay\DotpayManager;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class DotpayController extends Controller
{
private $dotpayManager;
public function __construct(DotpayManager $dotpayManager)
{
$this->dotpayManager = $dotpayManager;
}
// Tutaj uderzy Dotpay z danymi o tym w jakim stanie jest transakcja. Zwrócenie OK jest wymagane by dotpay przyjął, że serwer odpowiada poprawnie
public function callback(Request $request)
{
$response = $this->dotpayManager->callback($request->all());
//Do whatever you want with this
return new Response('OK');
}
public function pay()
{
$data = [
'amount' => '100',
'currency' => 'PLN',
'description' => 'Payment for internal_id order',
'control' => '12345', //ID that dotpay will pong you in the answer
'language' => 'pl',
'ch_lock' => '1',
'url' => config('dotpay.options.url'),
'urlc' => config('dotpay.options.curl'),
'expiration_datetime' => '2017-12-01T16:48:00',
'payer' => [
'first_name' => 'John',
'last_name' => 'Smith',
'email' => '[email protected]',
'phone' => '+48123123123'
],
'recipient' => config('dotpay.options.recipient')
];
return redirect()->to($this->dotpayManager->createPayment($data));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.