1. Go to this page and download the library: Download beziworld/laravel-autopay 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/ */
beziworld / laravel-autopay example snippets
use Beziworld\Autopay\Data\TransactionRequest;
use Beziworld\Autopay\Facades\Autopay;
$request = new TransactionRequest(
orderId: $order->number, // 1-32 characters: letters, digits, "-" and "_"; unique per service
amount: $order->total, // "123.45", 123.45 or 123
description: "Order {$order->number}",
customerEmail: $order->email,
gatewayId: null, // or a channel id from Autopay::gateways()
);
// a) background start (recommended): parameters never pass through the browser
return redirect()->away(Autopay::startTransaction($request));
// b) redirect with signed parameters
return redirect()->away(Autopay::redirectUrl($request));
// c) your own auto-submitted form
return view('pay', ['action' => Autopay::paymentUrl(), 'fields' => Autopay::parameters($request)]);
Route::get('/payment/return', function (Request $request) {
abort_unless(Autopay::verifyReturn($request->query()), 403);
// The return only means the buyer came back; the status arrives with the ITN.
return view('payment.thank-you', ['order' => $request->query('OrderID')]);
});
Autopay::gateways('PLN', 'PL'); // list<Gateway>: id, name, iconUrl, available, currencies; cache it for at least a minute
Autopay::refund($remoteId); // full refund
Autopay::refund($remoteId, '20.00', 'PLN', $messageId); // partial; $messageId (32 chars) makes it idempotent
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.