ibnuhalimm/laravel-tripay 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ibnuhalimm/laravel-tripay

Composer 安装命令:

composer require ibnuhalimm/laravel-tripay

包简介

Laravel Wrapper for Tripay Payment Gateway

README 文档

README

Latest Version on Packagist Total Downloads

Laravel wrapper for Tripay payment gateway.

Contents

Installation

You can install the package via composer:

composer require ibnuhalimm/laravel-tripay

Optionally, you can publish the config file of this package with this command:

php artisan vendor:publish --tag="laravel-tripay-config"

Setting up

Put some environment variable to .env file:

TRIPAY_MERCHANT_CODE=
TRIPAY_API_KEY=
TRIPAY_PRIVATE_KEY=
TRIPAY_PRODUCTION_MODE=

** Valid value for TRIPAY_PRODUCTION_MODE is true or false

Usage

You can directly use the Tripay Facade (the alias or class itself):

Payment Channels

use Ibnuhalimm\LaravelTripay\Facades\Tripay;

// Get all available payment channels
Tripay::paymentChannels();

// Or get single payment channels by specifying the code
Tripay::paymentChannels('BRIVA');

Get Fee of Payment Channel

use Ibnuhalimm\LaravelTripay\Facades\Tripay;

$amount = 12000;
$paymentChannelCode = 'BRIVA';
Tripay::feeCalculator($amount, $paymentChannelCode);

Fetch the Transactions

use Ibnuhalimm\LaravelTripay\Facades\Tripay;

Tripay::transactions();

Get Transaction Details

use Ibnuhalimm\LaravelTripay\Facades\Tripay;

$reference = 'DEV-T11958501451EJYV'; // Get from create transaction response / Transaction list
Tripay::transactionDetails($reference);

Create a Transaction

use Ibnuhalimm\LaravelTripay\Facades\Tripay;

// All required parameters
$params = [
    'method'            => 'MANDIRIVA',
    'merchant_ref'      => 'INV-123456',
    'amount'            => 25000,
    'customer_name'     => 'Your Customer Name',
    'customer_email'    => 'customer.email@domain.com',
    'customer_phone'    => '081234567890',
    'order_items'       => [
        [
            'name'        => 'Product Name 1',
            'price'       => 6000,
            'quantity'    => 2
        ],
        [
            'name'        => 'Product Name 2',
            'price'       => 13000,
            'quantity'    => 1
        ]
    ]
];

// You can override the callback URL
// By adding the `callback_url` parameter
$params = [
    ...
    'callback_url' => 'https://yourdomain.tld/callback',
    ...
];

// By default, expired time will be set for 24 hours
// You can change it by adding 'expired_time'
$params = [
    ...
    'expired_time' => 1582855837 // Should be in integer value as unix format
    ...
];

// Add more info of ordered items
$params = [
    ...
    'order_items'    => [
        [
            'sku'         => 'FB-01',
            'name'        => 'Product Name',
            'price'       => 20000,
            'quantity'    => 1,
            'product_url' => 'https://yourstore.com/product/product-01',
            'image_url'   => 'https://yourstore.com/product/product-01.jpg',
        ],
        [
            'sku'         => 'FB-07',
            'name'        => 'Product Name 2',
            'price'       => 5000,
            'quantity'    => 1,
            'product_url' => 'https://yourstore.com/product/product-02',
            'image_url'   => 'https://yourstore.com/product/product-02.jpg',
        ]
    ],
    ...
];


Tripay::createTransaction($params);

Override Default Config

use Ibnuhalimm\LaravelTripay\Facades\Tripay;

// Override the default config
Tripay::setConfig([
    'merchant_code' => 'NEW-CODE',
    'api_key' => 'ANOTHER-API-KEY',
    ...
])->paymentChannels();

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ibnuhalim@pm.me instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 49
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固