briqpay / legacy-php-sdk
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is not auto-updated.
Last update: 2024-09-25 02:16:27 UTC
README
这是Briqpay API的文档。您可以在我们的网站了解更多关于我们和我们的产品信息:https://briqpay.com 若要获取playground API的凭据,请注册https://app.briqpay.com # 简介 Briqpay Checkout是针对您的B2B电子商务的行内结账解决方案。Briqpay Checkout使您能够灵活控制支付方式和信用规则,同时优化顾客的UX体验。# SDKs 根据这些swagger定义,Briqpay提供基于PHP和.NET的标准SDK。您可以相应地下载它们或使用我们的swagger定义来生成自己的版本。#### 对于.NET Install-Package Briqpay
#### 对于PHP composer require briqpay/php-sdk
# 标准用例 作为集成的第一步,您需要创建一个结账会话。在这个会话中,您需要向Briqpay提供必要的基本信息。在Briqpay的响应中,您将收到一个HTML片段,该片段需要插入到您的前端中。Briqpay提供的片段将渲染一个iframe,用户将在其中完成购买。完成后,Briqpay将把客户重定向到您定义的确认页面。 # JavaScript SDK 集成的第一步是将我们的JS添加到您的网站中,在关闭`<head>
标签之前。这确保了我们的JS库可以加载结账。
<script src=\"https://api.briqpay.com/briq.min.js\"></script>
Briqpay通过我们的JavaScript SDK提供了一些可用方法。该库通过我们的iframe添加,并在
window._briqpay
上可用。如果您在结账页面上提供更新购物车或订单金额的功能,JS库将帮助您。如果您商店对客户的运输位置收取不同的费用和费用,您可以监听
addressupdate
事件来重新计算总成本。
`javascript window._briqpay.subscribe('addressupdate', function (data) { console.log(data) })
如果您的前端需要在注册完成后执行操作,请监听
signup_finalized事件。
`javascript window._briqpay.subscribe('signup_finalized', function (status) { // 重定向或处理状态 'success' / 'failure' })
如果您允许客户更改总购物车价值,您可以使用JS库在您执行后端更新调用时挂起iframe。如下所述: 如果您在7秒内不调用
_briqpay.resume(),iframe将自动恢复。 # 测试数据 为了验证您的集成,您需要使用测试数据来测试我们的信用引擎。## 公司识别号码* 1111111111 - 接收高信用评分公司(评分为100)* 2222222222 - 使用低信用评分公司测试环境(评分为10)## 卡详情 在我们的playground设置中,您的账户默认配置了Stripe集成。为了测试卡表单,您可以使用以下卡号:* 4000002500003155 - 模拟3ds认证窗口* 4000000000000069 - 交易因过期卡而拒绝。您可以使用任何有效的有效期和CVC代码。# 认证 Briqpay利用JWT来对我们的平台进行身份验证。身份验证令牌在48小时后过期,在此之后,您可以使用
/auth``端点为给定资源生成新令牌。 - 基本认证 - 仅在认证端点用于获取Bearer令牌 - JWT Bearer令牌 - 所有针对API的调用都使用此方法"
此PHP包是由Swagger Codegen项目自动生成的
- API版本:1.0.0
- 构建包:io.swagger.codegen.v3.generators.php.PhpClientCodegen
要求
PHP 5.5及更高版本
安装与使用
Composer
通过 Composer 安装绑定,请在 composer.json
中添加以下内容
{
"repositories": [
{
"type": "git",
"url": "https://github.com/briqpay/php-sdk.git"
}
],
"require": {
"briqpay/php-sdk": "*@dev"
}
}
然后运行 composer install
手动安装
下载文件并包含 autoload.php
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
测试
运行单元测试
composer install
./vendor/bin/phpunit
入门
请按照 安装流程 进行操作,然后运行以下命令
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: basicAuth
$config = Briqpay\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
$apiInstance = new Briqpay\Api\AuthenticationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
try {
$result = $apiInstance->getAuthToken();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->getAuthToken: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: basicAuth
$config = Briqpay\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
$apiInstance = new Briqpay\Api\AuthenticationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$sessionid = "sessionid_example"; // string | Session id for the new bearer token
try {
$result = $apiInstance->getAuthTokenForSession($sessionid);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->getAuthTokenForSession: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: basicAuth
$config = Briqpay\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
$apiInstance = new Briqpay\Api\AuthenticationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$sessionid = "sessionid_example"; // string | Session id for the new bearer token
try {
$result = $apiInstance->getSignupSessionAuth($sessionid);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->getSignupSessionAuth: ', $e->getMessage(), PHP_EOL;
}
?>
API端点文档
所有URI相对于 https://playground-api.briqpay.com/
类 | 方法 | HTTP请求 | 描述 |
---|---|---|---|
AuthenticationApi | getAuthToken | GET /auth | 生成bearer token |
AuthenticationApi | getAuthTokenForSession | GET /auth/{sessionid} | 为session生成新的auth token |
AuthenticationApi | getSignupSessionAuth | GET /auth/signup/{sessionid} | 获取一个注册session的新auth token |
CheckoutApi | cancelRecurringToken | POST /checkout/v1/recurring/token/cancel | 取消一个循环token |
CheckoutApi | createSession | POST /checkout/v1/sessions | 创建一个支付session |
CheckoutApi | patchCheckoutSession | POST /checkout/v1/sessions/patch | 修改session |
CheckoutApi | purchaseDecision | POST /v2/session/{sessionid}/decision/purchase | 批准或拒绝session的购买 |
CheckoutApi | readRecurringToken | POST /checkout/v1/recurring/token | 读取循环token |
CheckoutApi | readSession | POST /checkout/v1/readsession | 读取session |
CheckoutApi | updateSession | POST /checkout/v1/sessions/update | 更新session |
CheckoutApi | yourchargewebhookPost | POST /yourchargewebhook | 收费结果 |
HostedPageApi | createHostedPage | POST /hostedpage/v1/checkout | 创建一个托管支付页面 |
OrderManagementApi | captureOrder | POST /order-management/v1/capture-order | 捕获一个已放置的订单 |
OrderManagementApi | refundOrder | POST /order-management/v1/refund-order | 退还已捕获的订单 |
SignupApi | createSignup | POST /signup/v1/session | 创建一个新的注册session |
SignupApi | readSignup | GET /signup/v1/session | 读取一个正在进行的注册session |
SignupApi | sendValidateResponse | POST /signup/v1/hooks/validated | 验证结果 |
SignupApi | yoursignupwebhookPost | POST /yoursignupwebhook | 注册webhook请求 |
模型文档
- Address
- AuthenticationResponse
- BillingConfiguration
- BriqpayCreateHPPSessionRequest
- BriqpayCreateHPPSessionRequestConfig
- BriqpayCreateHPPSessionRequestDeliverymethod
- BriqpayValidateRequest
- CancelRecurringTokenRequest
- CaptureResponse
- CartItem
- Country
- CreateCaptureRequest
- CreateRefundRequest
- CreateSignupRequest
- CreateSignupRequestMerchanturls
- CreateSignupResponse
- Currency
- CustomInput
- ExtraCompanyFields
- GetSessionRequest
- IndividualRuleResult
- Locale
- LockFieldsConfiguration
- LockType
- MerchantConfig
- MerchantPrefillAddress
- MerchantReference
- MerchantUrls
- OrderNote
- OrderNoteConfiguration
- PSPRuleResults
- PatchSessionRequest
- PaymentConfiguration
- PaymentConfigurationPspRulesOverride
- ProductReference
- ProductType
- PurchaseDecisionRequest
- ReadRecurringToken
- ReadRecurringTokenRequest
- ReadSignupResponse
- ReadSignupResponseAddress
- ReadSignupResponseMerchanturls
- ReadSignupResponseUser
- RecurringChargeResultRequest
- RecurringSession
- RefundResponse
- RuleOverridePSP
- RuleOverridePSPHandles
- Session
- SessionPurchasepaymentmethod
- SessionRequest
- SessionRequestMerchantBilling
- SessionRequestMerchantShipping
- SessionRequestRecurring
- SessionState
- 会话标签
- 运输配置
- 注册认证令牌响应
- 税率
- 更新会话请求
- 验证注册响应
- 验证注册响应错误
授权文档
基本认证
- 类型: HTTP基本认证
携带认证
- 类型: HTTP携带认证
作者
hello@briqpay.com