shabayek/laravel-payment is a Laravel package for laravel package for payment methods.
It currently has 3 GitHub stars and 14 downloads on Packagist (latest version v0.8.0).
Install it with composer require shabayek/laravel-payment.
Discover more Laravel packages by shabayek
or browse all Laravel packages to compare alternatives.
Last updated
This is a Laravel Package for Payment Gateway Integration. It has a clear and consistent API, is fully unit tested, and even comes with an example application to get you started.
Note this package under development Don't use it in production.
composer require shabayek/laravel-payment
php artisan vendor:publish --provider="Shabayek\Payment\PaymentServiceProvider" --tag=config
$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;
}
if you want to change the column name you can do add public methods on your model with convention name CamelCase like firstName + Column FirstNameColumn
/**
* Get the first name.
*
* @return string|null
*/
public function firstNameColumn()
{
return $this->name; // OR $this->first_name;
}
The default relation is address if you want change the relation name you can do add public methods on your user model
/**
* Get the billable billing relations.
*
* @return Model
*/
public function billingRelation()
{
return $this->address_relation; // OR $this->address;
}
$payment->customer($user);
$items = [
[
"name" => "item1",
"price" => 100,
"quantity" => 2,
"description" => "item1 description",
],
[
"name" => "item2",
"price" => 200,
"quantity" => 1,
"description" => "item2 description",
],
];
$payment->items($items);
// OR By One
$name = "item1";
$price = 100;
$quantity = 2; // Default 1
$description = "item1 description"; // Default null
$payment->addItem($name, $price, $quantity, $description);
$payment->transaction($transaction_id);
if ($payment->isOnline()) {
$url = $payment->purchase();
}
pass the transaction model will update successIndicator and return view with checkout form
$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);
Please see CHANGELOG for more information on what has been changed recently.
Please see CONTRIBUTING for details.
If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.
The Laravel payment methods package is open-sourced software licensed under the MIT license.