GithubHelp home page GithubHelp logo

farayaz / larapay Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 3.0 147 KB

Larapay is a Laravel package for integrating Iranian payment gateways.

Home Page: https://farayaz.com

License: MIT License

Blade 0.76% PHP 99.24%
payment

larapay's Introduction

Larapay | لاراپِی

GitHub Repo stars Total Downloads Latest Stable Version License

Larapay is a Laravel package for integrating Iranian payment gateways.

لاراپی یک پکیج لاراول برای اتصال به درگاه‌های پرداختی ایرانی است.

Gateways | درگاه‌ها

Class Name (en) Name (fa) Requirements
Azkivam Azkivam ازکی وام merchant_id,api_key
BehPardakht Beh Pardakht Mellat به‌پرداخت ملت terminalId, username, password
Digipay Digipay دیجی‌پی username, password, client_id, client_secret
IdPay IdPay آیدی‌پی apiKey, sandbox
IranKish Iran Kish ایران کیش terminalId, password, acceptorId, pubKey
IsipaymentSamin Isipayment Samin ایزایران ثمین merchant_code, merchant_password, terminal_code
Keepa Keepa - Kipaa کیپا token
MehrIran MehrIran بانک مهر ایران terminal_id, merchant_nid, encrypt_key
Omidpay Omidpay - Sayan Card امید پی (سایان کارت) user_id, password
PardakhtNovin Pardakht Novin پرداخت نوین userId, password, terminalId
Payir Pay.ir پی.آی‌آر api
PayPing PayPing پی پینگ token
Polam Polam(Poolam) پولام api_key
RefahBeta Refah Beta بانک رفاه بتا client_id , client_secret, api_key, number_of_installments
Sadad Sadad پرداخت الکترونیک سداد (ملی) terminal_id, merchant_id, key
Sep Saman Electronic Payment پرداخت الکترونیک سامان (سپ) terminalId
SepehrPay Sepehr Pay پرداخت الکترونیک سپهر (مبنا) terminalId
SnappPay SnappPay اسنپ‌پی username, password, client_id, client_secret
TejaratBajet Tejarat Bajet بانک تجارت - باجت client_id, client_secret, sandbox
ZarinPal Zarin Pal زرین پال merchant_id
Zibal Zibal زیبال merchant

If you don't find the gateway you want, let us know or contribute to add it


اگر درگاه مورد نظر خود را پیدا نکردید، به ما اطلاع دهید یا در اضافه کردن آن مشارکت کنید

Benefits | مزایا

  • Simple | ساده
  • Flexibility | انعطاف‌پذیری
  • Fee Calculation | محاسبه هزینه تراکنش

Install | نصب

You can install the package via composer:

شما می‌توانید با استفاده از composer پکیج را نصب کنید

composer require farayaz/larapay

Usage | استفاده

To make the payment, 3 steps must be done:

برای انجام پرداخت ۳ مرحله می‌بایست انجام شود:

Step 1: get token | مرحله ۱: دریافت توکن

use Farayaz\Larapay\Exceptions\LarapayException;
use Larapay;

$gatewayClass = 'ZarinPal';
$gatewayConfig = [ // gateway config | تنظیمات درگاه
    'merchant_id' => 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
];

$amount = 10000;
$id = 1230; // transaction id | شماره تراکنش
$callbackUrl = route('api.transactions.verify', $id);
$nationalId = '1234567890';
$mobile = '09131234567';

try {
    $result = Larapay::gateway($gatewayClass, $gatewayConfig)
        ->request(
            id: $id,
            amount: $amount,
            callbackUrl: $callbackUrl,
            nationalId: $nationalId,
            mobile: $mobile
        );
} catch (LarapayException $e) {
    throw $e;
}

// store token in db | ذخیره توکن در دیتابیس
$result['token'];
$result['fee'];

Step 2: redirect | مرحله ۲: ریدایرکت

Transfer the user to gateway with the received token:

انتقال کاربر به درگاه با توکن دریافت شده:

try {
    return Larapay::gateway($gatewayClass, $gatewayConfig)
        ->redirect($id, $token, $callbackUrl);
} catch (LarapayException $e) {
    throw $e;
}

Step 3: verify | مرحله ۳: تایید

Checking the payment status after the user returns from the gateway:

بررسی وضعیت پرداخت پس از بازگشت کاربر از درگاه:

$params = $request->all();
try {
    $result = Larapay::gateway($gatewayClass, $gatewayConfig)
        ->verify(
            id: $id,
            amount: $amount,
            token: $token,
            params: $params
        );
} catch (LarapayException $e) {
    // transaction failed | تراکنش ناموفق
    throw $e;
}

// transaction verified | تراکنش موفق
$result['result'];
$result['reference_id'];
$result['tracking_code'];
$result['card'];
$result['fee'];

larapay's People

Contributors

mehrdadx10 avatar rezakhademix avatar

Stargazers

Taha Moghaddam avatar  avatar masoud fesahat avatar Mohammad Sina MalekPour avatar Relax Dev avatar Hadi avatar Alireza Fadaei avatar Parsa Kafi avatar  avatar Amir Sadeghi avatar

Watchers

 avatar

larapay's Issues

fix irankish validation errors

array:5 [
"type" => "https://tools.ietf.org/html/rfc7231#section-6.5.1"
"title" => "One or more validation errors occurred."
"status" => 400
"traceId" => "|."
"errors" => array:1 [
"$.request.paymentId" => array:1 [
0 => "The JSON value could not be converted to System.String. Path: $.request.paymentId | LineNumber: 0 | BytePositionInLine: 84."
]
]
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.