wall0ck/omise

这是为 Laravel 9+ 版本设计的 omise

1.2 2024-04-25 04:09 UTC

This package is auto-updated.

Last update: 2024-09-25 05:10:46 UTC


README

Total Downloads Monthly Downloads Daily Downloads License

注意

旧版本安装失败,请升级以支持 Laravel v9.0 及以上版本

  • 支持创建 OmiseCharge 和 OmiseSource
  • 更新 OmiseCharge 以支持新的 retrieve 功能
  • 新增 Balance API 检查余额

文档

开始使用 omise

代码示例

源代码 0x01code

支持

用法

通过 composer 安装

composer require wall0ck/omise

将配置文件放置到项目中

php artisan vendor:publish --tag=config

设置 .env

OMISE_PUBLIC_KEY=
OMISE_SECRET_KEY=

创建 Source 了解更多

$response = OmiseSource::create([
   'amount' => 12345,
   'currency' => 'THB',
   'type' => 'truemoney',
   'phone_number' => '0123456789',
]);
dd($response);

创建 Charge 了解更多

$response = OmiseCharge::create([
   'amount' => 12345,
   'currency' => 'THB',
   'return_uri' => 'http://example.com/orders/345678/complete',
   'source' => 'src_*****',
]);
dd($response);

检查支付状态 了解更多

 $sourceId = $request->input('source_id');
        $charge = OmiseCharge::retrieve($sourceId);
        $response = response()->json(['status' => $charge['status']]);
dd($response);