muhannadalhariri / gosell
dev-master
2023-01-04 09:02 UTC
Requires
- php: >=8.0.0
- guzzlehttp/guzzle: ^7.5.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: >=8.0.0
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2024-09-04 12:40:50 UTC
README
注意:这是一个原始 TapPayment GoSell https://github.com/Tap-Payments/gosell-sdk-php 的分支,包含了更新到 PHP 8.0+ 的版本和更新后的库。分支的原因是为了更新依赖。
GoSell PHP SDK
GoSell API 的官方绑定。
注意:详细的 REST API 请求和响应模式可以在 API 文档 中找到。
要求
此库支持 PHP 8.0 及以上版本。
安装
推荐通过 Composer 安装 GoSell PHP SDK
composer require muhannadalhariri/gosell
要使用绑定,请使用 Composer 的 自动加载
require_once('vendor/autoload.php');
手动安装
如果您不想使用 Composer,可以下载最新版本。然后,要使用绑定,包含 vendor.php 文件。
require_once('/pathto/Tap-Payments/gosell-sdk-php/vendor/autoload.php');
入门指南
use TapPayments\GoSell;
//set yout secret key here
GoSell::setPrivateKey("sk_test_XKokBfNWv6FIYuTMg5sLPjhJ");
$charge = GoSell\Charges::create(
[
"amount"=> 1,
"currency"=> "KWD",
"threeDSecure"=> true,
"save_card"=> false,
"description"=> "Test Description",
"statement_descriptor"=> "Sample",
"metadata"=> [
"udf1"=> "test 1",
"udf2"=> "test 2"
],
"reference"=> [
"transaction"=> "txn_0001",
"order"=> "ord_0001"
],
"receipt"=> [
"email"=> false,
"sms"=> true
],
"customer"=> [
"first_name"=> "test",
"middle_name"=> "test",
"last_name"=> "test",
"email"=> "test@test.com",
"phone"=> [
"country_code"=> "965",
"number"=> "50000000"
]
],
"source"=> [
"id"=> "src_all"
],
"post"=> [
"url"=> "http://your_website.com/post_url"
],
"redirect"=> [
"url"=> "http://your_website.com/redirect_url"
]
]
);
echo '<pre>';
var_dump($charge); //will give charge response as PHP object