1. Go to this page and download the library: Download shabayek/laravel-payment 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/ */
shabayek / laravel-payment example snippets
$method_id = 1; // payment method id from the config file
$payment = Payment::via($method_id);
use Shabayek\Payment\Concerns\Billable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Billable, Notifiable;
}
/**
* Get the first name.
*
* @return string|null
*/
public function firstNameColumn()
{
return $this->name; // OR $this->first_name;
}
/**
* Get the billable billing relations.
*
* @return Model
*/
public function billingRelation()
{
return $this->address_relation; // OR $this->address;
}
if ($payment->isOnline()) {
$url = $payment->purchase();
}
$payment->checkoutForm(Transaction $transaction);
$payment->getErrors();
$payment->isSuccess();
$payment = $payment->pay($request);
// function array with payment status and message
// return [
// 'success' => $isSuccess,
// 'message' => $message,
// 'data' => []
// ];
$method_id = 1; // payment method id from the config file
$payment_order_id = 111; // payment order id
$payment_status = Payment::via($method_id)->verify($payment_order_id);