bamalik1996 / tap-payment-gateway-laravel
dev-main
2023-04-30 16:05 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.5
- illuminate/support: 5.* || 6.* || 7.* || 8.* || 9.*
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-30 01:52:21 UTC
README
PHP Laravel Tap支付SDK包
安装
您可以通过composer安装此包
composer require bamalik1996/tap-payment-gateway-laravel
环境变量
要运行此项目,您需要将以下环境变量添加到您的 .env 文件中
TAP_PAYMENT_MODE
= 'sandbox' // 生产
TAP_PAYMENT_SECRET_KEY
TAP_PAYMENT_PUBLISH_KEY
TAP_PAYMENT_SANDBOX_SECRET_KEY
TAP_PAYMENT_SANDBOX_PUBLISH_KEY
## 文档(收费)
收费创建
use Bamalik1996\TapPaymentGateway\TapPaymentGateway;
$trans_object["amount"] = 123; $trans_object["currency"] = 'AED'; $trans_object["threeDsecure"] = true; $trans_object["save_card"] = false; $trans_object["description"] = "ORDER ID :" . 1; $trans_object["statement_descriptor"] = 'Sample'; $trans_object["metadata"]["udf1"] = 'test'; $trans_object["metadata"]["udf2"] = 'test'; $trans_object["reference"]["transaction"] = 'txn_0000' . 2; $trans_object["reference"]["order"] = 2; $trans_object["receipt"]["email"] = false; $trans_object["receipt"]["sms"] = true; $trans_object["customer"]["first_name"] = 'auth()->user()->last_name'; $trans_object["customer"]["last_name"] = 'auth()->user()->first_name'; $trans_object["customer"]["email"] = 'auth()->user()->email'; $trans_object["customer"]["phone"]["country_code"] = ''; $trans_object["customer"]["phone"]["number"] = ''; $trans_object["source"]["id"] = 'src_all'; $trans_object["post"]["url"] = '1'; $trans_object["redirect"]["url"] = 'v'; $tapPaymentGateway = new TapPaymentGateway; return ($tapPaymentGateway->charges()->create($trans_object));
收费更新
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->charges()->update($id,[ "description"=> "test", "receipt"=> [ "email"=> false, "sms"=> true ], "metadata"=> [ "udf2"=> "testing update" ] ]);
收费检索
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->charges()->retrieve($id);
收费删除
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->charges()->delete($id);
所有收费
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->charges()->all([ "period"=> [ "date"=> [ "from"=> time() - (30 * 24 * 60 * 60),//last 30 days "to"=> time()//today ] ], "status"=> "", "starting_after"=> "", "limit"=> 25 ]);
文档(自定义)
客户创建
use Bamalik1996\TapPaymentGateway\TapPaymentGateway;
$params = array ( 'first_name' => 'test', 'middle_name' => 'test', 'last_name' => 'test', 'email' => 'test@test.com', 'phone' => array ( 'country_code' => '965', 'number' => '51234567', ), 'description' => 'test', 'metadata' => array ( 'sample string 1' => 'string1', 'sample string 3' => 'string2', ), 'currency' => 'KWD', ); $tapPaymentGateway = new TapPaymentGateway; return ($tapPaymentGateway->customers()->create($params));
客户更新
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->customers()->update($id,[ 'first_name' => 'test', 'middle_name' => 'test', 'last_name' => 'test', 'email' => 'test@test.com', 'phone' => array ( 'country_code' => '965', 'number' => '51234567', ), 'description' => 'test', 'metadata' => array ( 'sample string 1' => 'string1', 'sample string 3' => 'string2', ), 'currency' => 'KWD', ]);
客户检索
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->customers()->retrieve($id);
客户删除
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->customers()->delete($id);
所有客户
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->customers()->all([ "period"=> [ "date"=> [ "from"=> time() - (30 * 24 * 60 * 60),//last 30 days "to"=> time()//today ] ], "status"=> "", "starting_after"=> "", "limit"=> 25 ]);