easebuzz/pay-with-easebuzz-laravel

此包的最新版本(1.0.0)没有可用的许可证信息。

1.0.0 2023-09-12 14:35 UTC

This package is auto-updated.

Last update: 2024-09-12 17:39:09 UTC


README

此包将Easebuzz核心支付API作为Laravel包暴露。

安装

composer require easebuzz/pay-with-easebuzz-laravel

创建Easebuzz控制器

php artisan make:controller EasebuzzController

Easebuzz控制器

# EasebuzzController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\View\View;
use Easebuzz\PayWithEasebuzzLaravel\PayWithEasebuzzLib;


class EasebuzzController extends Controller
{
    //
    public function initiate_payment_show(): View
    {
        return view('initiate_payment', ['result' => '']);
    }
    public function initiate_payment_ebz(Request $request): View
    {
        $param = $request->post();
        $key = "YOUR_KEY_HERE";
        $salt = "YOUR_SALT_HERE";
        $env = "YOUR_ENV_HERE";
        $payebz = new PayWithEasebuzzLib($key, $salt, $env);
        $result = $payebz->initiatePaymentAPI($param, true);
        
        // var_dump($result);
        // die();

        return view('initiate_payment', ['result' => $result]);
    }
    public function ebz_response(Request $request): View
    {
        $param = $request->post();
        // $param will contain the response provided to you by Easebuzz. You can handle your success and failed scenarios based on the response.
        var_dump($param);
        die();
        return view('initiate_payment', ['result' => '']);
    }
}

请将YOUR_KEY_HERE、YOUR_SALT_HERE和YOUR_ENV_HERE替换为Easebuzz提供的自己的密钥、盐和环境

请注意,这是一个示例控制器,请根据您的需求进行自定义,然后调用initiatePaymentApi

// $param is an array. Parameter definitions can be found here - https://docs.easebuzz.in/docs/payment-gateway/8ec545c331e6f-initiate-payment-api

$result = $payebz->initiatePaymentAPI($param, true);

// Transaction Api 
// $param is an array. Parameter definitions can be found here - https://docs.easebuzz.in/docs/payment-gateway/910d60e2551c9-transaction-api
$result = $payebz->transactionAPI($param);

// Refund Api - v2
// $param is an array. Parameter definitions can be found here - https://docs.easebuzz.in/docs/payment-gateway/c2ac48618b3bd-refund-api-v2

$result = $payebz->refundAPIV2($param);


// Refund Status Api
// $param is an array. Parameter definitions can be found here - https://docs.easebuzz.in/docs/payment-gateway/de78eba8de53c-refund-status-api

$result = $payebz->refundStatus($param);