pagarme / pagarmecoreapi
Pagarme API
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- apimatic/jsonmapper: ^1.3.1
- apimatic/unirest-php: ^2.0.0
Requires (Dev)
- phpunit/phpunit: 4.8.*
- squizlabs/php_codesniffer: ^2.7
README
Pagarme API
如何构建
生成的代码依赖于外部库,如UniRest。这些依赖在SDK提供的composer.json
文件中定义。为了解决这些依赖,我们使用Composer包管理器,它需要在您的系统中安装PHP 5.3.2或更高版本。访问https://getcomposer.org.cn/download/下载Composer安装程序文件并在您的系统上运行它。打开命令提示符并输入composer --version
。如果安装成功,它将显示已安装的Composer的当前版本。
- 使用命令行,导航到包含生成的SDK文件(包括
composer.json
)的目录。 - 运行命令
composer install
。这将安装所有必需的依赖项并在您的项目目录中创建vendor
目录。
[仅限Windows用户] 在php.ini中配置CURL证书路径
CURL曾包含一个受信任CA列表,但不再捆绑任何CA证书。因此,默认情况下,它将拒绝所有SSL证书,因为它们无法验证。您将需要获取您的CA证书并将curl指向它。步骤如下:
- 从https://curl.haxx.se/docs/caextract.html下载证书捆绑包(.pem文件)到您的系统。
- 将“curl.cainfo = "PATH_TO/cacert.pem"”添加到您的php.ini文件中,该文件位于您的PHP安装目录中。“PATH_TO”必须包含.pem文件的绝对路径。
[curl] ; A default value for the CURLOPT_CAINFO option. This is required to be an ; absolute path. ;curl.cainfo =
如何使用
以下部分解释了如何在新的项目中使用PagarmeCoreApi库。
1. 在IDE中打开项目
打开PHP的IDE,如PhpStorm。这里展示的基本工作流程也适用于您更喜欢使用不同编辑器或IDE的情况。
在PhpStorm中点击打开
,浏览到您的生成的SDK目录,然后点击确定
。
2. 添加一个新的测试项目
如以下示例所示,在解决方案名称上右键单击以创建一个新的目录
将目录命名为"test"
向此项目添加一个PHP文件
命名为"testSDK"
根据您的项目设置,您可能需要在PHP代码中包含composer的自动加载器,以启用类的自动加载。
require_once "../vendor/autoload.php";
确保在require_once路径中正确指向在依赖安装期间在vendor目录中创建的autoload.php
文件。
之后,您可以添加代码以初始化客户端库并获取控制器类的实例。随后的部分提供了初始化客户端库和使用控制器方法的示例代码。
3. 运行测试项目
要运行您的项目,您必须设置项目的解释器。解释器是安装在您计算机上的PHP引擎。
从文件
菜单中打开设置
。
从语言和框架
中选择PHP
。
在解释器
选项附近浏览解释器并选择您的解释器。
选择解释器后,点击确定
。
要运行您的项目,在测试项目中右键单击您的PHP文件并点击运行
。
如何测试
可以使用PHPUnit运行此SDK中的单元测试。
- 首先使用composer安装依赖项,包括
require-dev
依赖项。 - 从命令行运行
vendor\bin\phpunit --verbose
以执行测试。如果您已全局安装PHPUnit,则使用phpunit --verbose
运行测试。
您可以在phpunit.xml
文件中更改PHPUnit测试配置。
初始化
身份验证
为了设置API客户端的身份验证和初始化,您需要以下信息。
API客户端可以按照以下方式初始化。
$serviceRefererName = 'serviceRefererName'; $basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication $basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication $client = new PagarmeCoreApiLib\PagarmeCoreApiClient($serviceRefererName, $basicAuthUserName, $basicAuthPassword);
类参考
控制器列表
- SubscriptionsController
- OrdersController
- PlansController
- InvoicesController
- CustomersController
- ChargesController
- RecipientsController
- TokensController
- TransactionsController
- TransfersController
SubscriptionsController
获取单例实例
可以从API客户端访问SubscriptionsController
类的单例实例。
$subscriptions = $client->getSubscriptions();
updateSubscriptionCard
更新订阅中的信用卡
function updateSubscriptionCard( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateSubscriptionCardRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionCard($subscriptionId, $body, $idempotencyKey);
错误
deleteUsage
删除使用记录
function deleteUsage( $subscriptionId, $itemId, $usageId, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $itemId = 'item_id'; $usageId = 'usage_id'; $idempotencyKey = 'idempotency-key'; $result = $subscriptions->deleteUsage($subscriptionId, $itemId, $usageId, $idempotencyKey);
错误
createDiscount
创建折扣
function createDiscount( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new CreateDiscountRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->createDiscount($subscriptionId, $body, $idempotencyKey);
错误
createAnUsage
创建使用记录
function createAnUsage( $subscriptionId, $itemId, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $itemId = 'item_id'; $idempotencyKey = 'idempotency-key'; $result = $subscriptions->createAnUsage($subscriptionId, $itemId, $idempotencyKey);
错误
getUsages
列出订阅项的所有使用记录
function getUsages( $subscriptionId, $itemId, $page = null, $size = null, $code = null, $group = null, $usedSince = null, $usedUntil = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $itemId = 'item_id'; $page = 69; $size = 69; $code = 'code'; $group = 'group'; $usedSince = date("D M d, Y G:i"); $usedUntil = date("D M d, Y G:i"); $result = $subscriptions->getUsages($subscriptionId, $itemId, $page, $size, $code, $group, $usedSince, $usedUntil);
错误
updateCurrentCycleStatus
更新当前周期状态
function updateCurrentCycleStatus( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateCurrentCycleStatusRequest(); $idempotencyKey = 'idempotency-key'; $subscriptions->updateCurrentCycleStatus($subscriptionId, $body, $idempotencyKey);
错误
updateSubscriptionPaymentMethod
更新订阅的支付方式
function updateSubscriptionPaymentMethod( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateSubscriptionPaymentMethodRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionPaymentMethod($subscriptionId, $body, $idempotencyKey);
错误
deleteDiscount
删除折扣
function deleteDiscount( $subscriptionId, $discountId, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $discountId = 'discount_id'; $idempotencyKey = 'idempotency-key'; $result = $subscriptions->deleteDiscount($subscriptionId, $discountId, $idempotencyKey);
错误
getSubscriptionItems
获取订阅项
function getSubscriptionItems( $subscriptionId, $page = null, $size = null, $name = null, $code = null, $status = null, $description = null, $createdSince = null, $createdUntil = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $page = 69; $size = 69; $name = 'name'; $code = 'code'; $status = 'status'; $description = 'description'; $createdSince = 'created_since'; $createdUntil = 'created_until'; $result = $subscriptions->getSubscriptionItems($subscriptionId, $page, $size, $name, $code, $status, $description, $createdSince, $createdUntil);
错误
createSubscriptionItem
创建新的订阅项
function createSubscriptionItem( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new CreateSubscriptionItemRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->createSubscriptionItem($subscriptionId, $body, $idempotencyKey);
错误
getSubscriptionItem
获取订阅项
function getSubscriptionItem( $subscriptionId, $itemId)
参数
示例用法
$subscriptionId = 'subscription_id'; $itemId = 'item_id'; $result = $subscriptions->getSubscriptionItem($subscriptionId, $itemId);
错误
updateSubscriptionItem
更新订阅项
function updateSubscriptionItem( $subscriptionId, $itemId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $itemId = 'item_id'; $body = new UpdateSubscriptionItemRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionItem($subscriptionId, $itemId, $body, $idempotencyKey);
错误
getSubscriptions
获取所有订阅
function getSubscriptions( $page = null, $size = null, $code = null, $billingType = null, $customerId = null, $planId = null, $cardId = null, $status = null, $nextBillingSince = null, $nextBillingUntil = null, $createdSince = null, $createdUntil = null)
参数
示例用法
$page = 160; $size = 160; $code = 'code'; $billingType = 'billing_type'; $customerId = 'customer_id'; $planId = 'plan_id'; $cardId = 'card_id'; $status = 'status'; $nextBillingSince = date("D M d, Y G:i"); $nextBillingUntil = date("D M d, Y G:i"); $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $result = $subscriptions->getSubscriptions($page, $size, $code, $billingType, $customerId, $planId, $cardId, $status, $nextBillingSince, $nextBillingUntil, $createdSince, $createdUntil);
错误
createSubscription
创建新的订阅
function createSubscription( $body, $idempotencyKey = null)
参数
示例用法
$body = new CreateSubscriptionRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->createSubscription($body, $idempotencyKey);
错误
cancelSubscription
取消订阅
function cancelSubscription( $subscriptionId, $idempotencyKey = null, $body = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $idempotencyKey = 'idempotency-key'; $body = new CreateCancelSubscriptionRequest(); $result = $subscriptions->cancelSubscription($subscriptionId, $idempotencyKey, $body);
错误
getSubscription
获取订阅
function getSubscription($subscriptionId)
参数
示例用法
$subscriptionId = 'subscription_id'; $result = $subscriptions->getSubscription($subscriptionId);
错误
createIncrement
创建增量
function createIncrement( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new CreateIncrementRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->createIncrement($subscriptionId, $body, $idempotencyKey);
错误
getDiscountById
GetDiscountById
function getDiscountById( $subscriptionId, $discountId)
参数
示例用法
$subscriptionId = 'subscription_id'; $discountId = 'discountId'; $result = $subscriptions->getDiscountById($subscriptionId, $discountId);
错误
updateSubscriptionAffiliationId
UpdateSubscriptionAffiliationId
function updateSubscriptionAffiliationId( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateSubscriptionAffiliationIdRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionAffiliationId($subscriptionId, $body, $idempotencyKey);
错误
updateSubscriptionMetadata
更新订阅的元数据
function updateSubscriptionMetadata( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateMetadataRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionMetadata($subscriptionId, $body, $idempotencyKey);
错误
deleteIncrement
删除增量
function deleteIncrement( $subscriptionId, $incrementId, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $incrementId = 'increment_id'; $idempotencyKey = 'idempotency-key'; $result = $subscriptions->deleteIncrement($subscriptionId, $incrementId, $idempotencyKey);
错误
getIncrementById
GetIncrementById
function getIncrementById( $subscriptionId, $incrementId)
参数
示例用法
$subscriptionId = 'subscription_id'; $incrementId = 'increment_id'; $result = $subscriptions->getIncrementById($subscriptionId, $incrementId);
错误
getSubscriptionCycles
GetSubscriptionCycles
function getSubscriptionCycles( $subscriptionId, $page, $size)
参数
示例用法
$subscriptionId = 'subscription_id'; $page = 'page'; $size = 'size'; $result = $subscriptions->getSubscriptionCycles($subscriptionId, $page, $size);
错误
renewSubscription
RenewSubscription
function renewSubscription( $subscriptionId, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $idempotencyKey = 'idempotency-key'; $result = $subscriptions->renewSubscription($subscriptionId, $idempotencyKey);
错误
getDiscounts
GetDiscounts
function getDiscounts( $subscriptionId, $page, $size)
参数
示例用法
$subscriptionId = 'subscription_id'; $page = 160; $size = 160; $result = $subscriptions->getDiscounts($subscriptionId, $page, $size);
错误
updateSubscriptionBillingDate
更新订阅的账单日期
function updateSubscriptionBillingDate( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateSubscriptionBillingDateRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionBillingDate($subscriptionId, $body, $idempotencyKey);
错误
deleteSubscriptionItem
删除订阅项
function deleteSubscriptionItem( $subscriptionId, $subscriptionItemId, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $subscriptionItemId = 'subscription_item_id'; $idempotencyKey = 'idempotency-key'; $result = $subscriptions->deleteSubscriptionItem($subscriptionId, $subscriptionItemId, $idempotencyKey);
错误
getIncrements
获取增量
function getIncrements( $subscriptionId, $page = null, $size = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $page = 160; $size = 160; $result = $subscriptions->getIncrements($subscriptionId, $page, $size);
错误
updateSubscriptionDueDays
更新订阅的票据到期天数
function updateSubscriptionDueDays( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateSubscriptionDueDaysRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionDueDays($subscriptionId, $body, $idempotencyKey);
错误
updateSubscriptionStartAt
更新订阅的开始日期
function updateSubscriptionStartAt( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateSubscriptionStartAtRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionStartAt($subscriptionId, $body, $idempotencyKey);
错误
updateLatestPeriodEndAt
更新最新周期结束日期
function updateLatestPeriodEndAt( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateCurrentCycleEndDateRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateLatestPeriodEndAt($subscriptionId, $body, $idempotencyKey);
错误
updateSubscriptionMiniumPrice
更新订阅的最小价值
function updateSubscriptionMiniumPrice( $subscriptionId, $body, $idempotencyKey = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $body = new UpdateSubscriptionMinimumPriceRequest(); $idempotencyKey = 'idempotency-key'; $result = $subscriptions->updateSubscriptionMiniumPrice($subscriptionId, $body, $idempotencyKey);
错误
getSubscriptionCycleById
根据ID获取订阅周期
function getSubscriptionCycleById( $subscriptionId, $cycleId)
参数
示例用法
$subscriptionId = 'subscription_id'; $cycleId = 'cycleId'; $result = $subscriptions->getSubscriptionCycleById($subscriptionId, $cycleId);
错误
getUsageReport
获取使用报告
function getUsageReport( $subscriptionId, $periodId)
参数
示例用法
$subscriptionId = 'subscription_id'; $periodId = 'period_id'; $result = $subscriptions->getUsageReport($subscriptionId, $periodId);
错误
updateSplitSubscription
更新分割订阅
function updateSplitSubscription( $id, $body)
参数
示例用法
$id = 'id'; $body = new UpdateSubscriptionSplitRequest(); $result = $subscriptions->updateSplitSubscription($id, $body);
错误
OrdersController
获取单例实例
API客户端可以访问OrdersController
类的单例实例。
$orders = $client->getOrders();
getOrders
获取所有订单
function getOrders( $page = null, $size = null, $code = null, $status = null, $createdSince = null, $createdUntil = null, $customerId = null)
参数
示例用法
$page = 160; $size = 160; $code = 'code'; $status = 'status'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $customerId = 'customer_id'; $result = $orders->getOrders($page, $size, $code, $status, $createdSince, $createdUntil, $customerId);
错误
createOrder
创建一个新的订单
function createOrder( $body, $idempotencyKey = null)
参数
示例用法
$body = new CreateOrderRequest(); $idempotencyKey = 'idempotency-key'; $result = $orders->createOrder($body, $idempotencyKey);
错误
deleteAllOrderItems
删除所有订单项
function deleteAllOrderItems( $orderId, $idempotencyKey = null)
参数
示例用法
$orderId = 'orderId'; $idempotencyKey = 'idempotency-key'; $result = $orders->deleteAllOrderItems($orderId, $idempotencyKey);
错误
createOrderItem
创建订单项
function createOrderItem( $orderId, $body, $idempotencyKey = null)
参数
示例用法
$orderId = 'orderId'; $body = new CreateOrderItemRequest(); $idempotencyKey = 'idempotency-key'; $result = $orders->createOrderItem($orderId, $body, $idempotencyKey);
错误
updateOrderItem
更新订单项
function updateOrderItem( $orderId, $itemId, $body, $idempotencyKey = null)
参数
示例用法
$orderId = 'orderId'; $itemId = 'itemId'; $body = new UpdateOrderItemRequest(); $idempotencyKey = 'idempotency-key'; $result = $orders->updateOrderItem($orderId, $itemId, $body, $idempotencyKey);
错误
deleteOrderItem
删除订单项
function deleteOrderItem( $orderId, $itemId, $idempotencyKey = null)
参数
示例用法
$orderId = 'orderId'; $itemId = 'itemId'; $idempotencyKey = 'idempotency-key'; $result = $orders->deleteOrderItem($orderId, $itemId, $idempotencyKey);
错误
getOrderItem
获取订单项
function getOrderItem( $orderId, $itemId)
参数
示例用法
$orderId = 'orderId'; $itemId = 'itemId'; $result = $orders->getOrderItem($orderId, $itemId);
错误
closeOrder
关闭订单
function closeOrder( $id, $body, $idempotencyKey = null)
参数
示例用法
$id = 'id'; $body = new UpdateOrderStatusRequest(); $idempotencyKey = 'idempotency-key'; $result = $orders->closeOrder($id, $body, $idempotencyKey);
错误
updateOrderMetadata
更新订单的元数据
function updateOrderMetadata( $orderId, $body, $idempotencyKey = null)
参数
示例用法
$orderId = 'order_id'; $body = new UpdateMetadataRequest(); $idempotencyKey = 'idempotency-key'; $result = $orders->updateOrderMetadata($orderId, $body, $idempotencyKey);
错误
getOrder
获取订单
function getOrder($orderId)
参数
示例用法
$orderId = 'order_id'; $result = $orders->getOrder($orderId);
错误
PlansController
获取单例实例
可以通过API客户端访问的PlansController
类的单例实例。
$plans = $client->getPlans();
getPlan
获取计划
function getPlan($planId)
参数
示例用法
$planId = 'plan_id'; $result = $plans->getPlan($planId);
错误
updatePlan
更新计划
function updatePlan( $planId, $body, $idempotencyKey = null)
参数
示例用法
$planId = 'plan_id'; $body = new UpdatePlanRequest(); $idempotencyKey = 'idempotency-key'; $result = $plans->updatePlan($planId, $body, $idempotencyKey);
错误
deletePlan
删除计划
function deletePlan( $planId, $idempotencyKey = null)
参数
示例用法
$planId = 'plan_id'; $idempotencyKey = 'idempotency-key'; $result = $plans->deletePlan($planId, $idempotencyKey);
错误
updatePlanMetadata
更新计划的元数据
function updatePlanMetadata( $planId, $body, $idempotencyKey = null)
参数
示例用法
$planId = 'plan_id'; $body = new UpdateMetadataRequest(); $idempotencyKey = 'idempotency-key'; $result = $plans->updatePlanMetadata($planId, $body, $idempotencyKey);
错误
updatePlanItem
更新计划项目
function updatePlanItem( $planId, $planItemId, $body, $idempotencyKey = null)
参数
示例用法
$planId = 'plan_id'; $planItemId = 'plan_item_id'; $body = new UpdatePlanItemRequest(); $idempotencyKey = 'idempotency-key'; $result = $plans->updatePlanItem($planId, $planItemId, $body, $idempotencyKey);
错误
getPlanItem
获取计划项目
function getPlanItem( $planId, $planItemId)
参数
示例用法
$planId = 'plan_id'; $planItemId = 'plan_item_id'; $result = $plans->getPlanItem($planId, $planItemId);
错误
deletePlanItem
从计划中移除项目
function deletePlanItem( $planId, $planItemId, $idempotencyKey = null)
参数
示例用法
$planId = 'plan_id'; $planItemId = 'plan_item_id'; $idempotencyKey = 'idempotency-key'; $result = $plans->deletePlanItem($planId, $planItemId, $idempotencyKey);
错误
createPlanItem
向计划中添加新项目
function createPlanItem( $planId, $body, $idempotencyKey = null)
参数
示例用法
$planId = 'plan_id'; $body = new CreatePlanItemRequest(); $idempotencyKey = 'idempotency-key'; $result = $plans->createPlanItem($planId, $body, $idempotencyKey);
错误
createPlan
创建新计划
function createPlan( $body, $idempotencyKey = null)
参数
示例用法
$body = new CreatePlanRequest(); $idempotencyKey = 'idempotency-key'; $result = $plans->createPlan($body, $idempotencyKey);
错误
getPlans
获取所有计划
function getPlans( $page = null, $size = null, $name = null, $status = null, $billingType = null, $createdSince = null, $createdUntil = null)
参数
示例用法
$page = 160; $size = 160; $name = 'name'; $status = 'status'; $billingType = 'billing_type'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $result = $plans->getPlans($page, $size, $name, $status, $billingType, $createdSince, $createdUntil);
错误
InvoicesController
获取单例实例
API客户端可以访问的InvoicesController
类的单例实例。
$invoices = $client->getInvoices();
getPartialInvoice
获取部分发票
function getPartialInvoice($subscriptionId)
参数
示例用法
$subscriptionId = 'subscription_id'; $result = $invoices->getPartialInvoice($subscriptionId);
错误
cancelInvoice
取消发票
function cancelInvoice( $invoiceId, $idempotencyKey = null)
参数
示例用法
$invoiceId = 'invoice_id'; $idempotencyKey = 'idempotency-key'; $result = $invoices->cancelInvoice($invoiceId, $idempotencyKey);
错误
getInvoice
获取发票
function getInvoice($invoiceId)
参数
示例用法
$invoiceId = 'invoice_id'; $result = $invoices->getInvoice($invoiceId);
错误
createInvoice
创建发票
function createInvoice( $subscriptionId, $cycleId, $idempotencyKey = null, $body = null)
参数
示例用法
$subscriptionId = 'subscription_id'; $cycleId = 'cycle_id'; $idempotencyKey = 'idempotency-key'; $body = new CreateInvoiceRequest(); $result = $invoices->createInvoice($subscriptionId, $cycleId, $idempotencyKey, $body);
错误
updateInvoiceMetadata
更新发票的元数据
function updateInvoiceMetadata( $invoiceId, $body, $idempotencyKey = null)
参数
示例用法
$invoiceId = 'invoice_id'; $body = new UpdateMetadataRequest(); $idempotencyKey = 'idempotency-key'; $result = $invoices->updateInvoiceMetadata($invoiceId, $body, $idempotencyKey);
错误
getInvoices
获取所有发票
function getInvoices( $page = null, $size = null, $code = null, $customerId = null, $subscriptionId = null, $createdSince = null, $createdUntil = null, $status = null, $dueSince = null, $dueUntil = null, $customerDocument = null)
参数
示例用法
$page = 252; $size = 252; $code = 'code'; $customerId = 'customer_id'; $subscriptionId = 'subscription_id'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $status = 'status'; $dueSince = date("D M d, Y G:i"); $dueUntil = date("D M d, Y G:i"); $customerDocument = 'customer_document'; $result = $invoices->getInvoices($page, $size, $code, $customerId, $subscriptionId, $createdSince, $createdUntil, $status, $dueSince, $dueUntil, $customerDocument);
错误
updateInvoiceStatus
更新发票的状态
function updateInvoiceStatus( $invoiceId, $body, $idempotencyKey = null)
参数
示例用法
$invoiceId = 'invoice_id'; $body = new UpdateInvoiceStatusRequest(); $idempotencyKey = 'idempotency-key'; $result = $invoices->updateInvoiceStatus($invoiceId, $body, $idempotencyKey);
错误
CustomersController
获取单例实例
API客户端可以访问CustomersController
类的单例实例。
$customers = $client->getCustomers();
updateCard
更新一张卡
function updateCard( $customerId, $cardId, $body, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $cardId = 'card_id'; $body = new UpdateCardRequest(); $idempotencyKey = 'idempotency-key'; $result = $customers->updateCard($customerId, $cardId, $body, $idempotencyKey);
错误
deleteCard
删除客户的卡
function deleteCard( $customerId, $cardId, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $cardId = 'card_id'; $idempotencyKey = 'idempotency-key'; $result = $customers->deleteCard($customerId, $cardId, $idempotencyKey);
错误
getCard
获取客户的卡片
function getCard( $customerId, $cardId)
参数
示例用法
$customerId = 'customer_id'; $cardId = 'card_id'; $result = $customers->getCard($customerId, $cardId);
错误
updateAddress
更新地址
function updateAddress( $customerId, $addressId, $body, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $addressId = 'address_id'; $body = new UpdateAddressRequest(); $idempotencyKey = 'idempotency-key'; $result = $customers->updateAddress($customerId, $addressId, $body, $idempotencyKey);
错误
getAddress
获取客户的地址
function getAddress( $customerId, $addressId)
参数
示例用法
$customerId = 'customer_id'; $addressId = 'address_id'; $result = $customers->getAddress($customerId, $addressId);
错误
deleteAddress
删除客户的地址
function deleteAddress( $customerId, $addressId, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $addressId = 'address_id'; $idempotencyKey = 'idempotency-key'; $result = $customers->deleteAddress($customerId, $addressId, $idempotencyKey);
错误
deleteAccessToken
删除客户的访问令牌
function deleteAccessToken( $customerId, $tokenId, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $tokenId = 'token_id'; $idempotencyKey = 'idempotency-key'; $result = $customers->deleteAccessToken($customerId, $tokenId, $idempotencyKey);
错误
getAccessToken
获取客户的访问令牌
function getAccessToken( $customerId, $tokenId)
参数
示例用法
$customerId = 'customer_id'; $tokenId = 'token_id'; $result = $customers->getAccessToken($customerId, $tokenId);
错误
createAccessToken
为客户创建访问令牌
function createAccessToken( $customerId, $body, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $body = new CreateAccessTokenRequest(); $idempotencyKey = 'idempotency-key'; $result = $customers->createAccessToken($customerId, $body, $idempotencyKey);
错误
getAccessTokens
获取客户的所有访问令牌
function getAccessTokens( $customerId, $page = null, $size = null)
参数
示例用法
$customerId = 'customer_id'; $page = 252; $size = 252; $result = $customers->getAccessTokens($customerId, $page, $size);
错误
createAddress
为客户创建新的地址
function createAddress( $customerId, $body, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $body = new CreateAddressRequest(); $idempotencyKey = 'idempotency-key'; $result = $customers->createAddress($customerId, $body, $idempotencyKey);
错误
getAddresses
获取客户的所有地址
function getAddresses( $customerId, $page = null, $size = null)
参数
示例用法
$customerId = 'customer_id'; $page = 252; $size = 252; $result = $customers->getAddresses($customerId, $page, $size);
错误
createCustomer
创建一个新的客户
function createCustomer( $body, $idempotencyKey = null)
参数
示例用法
$body = new CreateCustomerRequest(); $idempotencyKey = 'idempotency-key'; $result = $customers->createCustomer($body, $idempotencyKey);
错误
getCustomers
获取所有客户
function getCustomers( $name = null, $document = null, $page = 1, $size = 10, $email = null, $code = null)
参数
示例用法
$name = 'name'; $document = 'document'; $page = 1; $size = 10; $email = 'email'; $code = 'Code'; $result = $customers->getCustomers($name, $document, $page, $size, $email, $code);
错误
deleteAccessTokens
删除客户的访问令牌
function deleteAccessTokens($customerId)
参数
示例用法
$customerId = 'customer_id'; $result = $customers->deleteAccessTokens($customerId);
错误
createCard
为客户创建一个新的卡片
function createCard( $customerId, $body, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $body = new CreateCardRequest(); $idempotencyKey = 'idempotency-key'; $result = $customers->createCard($customerId, $body, $idempotencyKey);
错误
getCards
获取客户的全部卡片
function getCards( $customerId, $page = null, $size = null)
参数
示例用法
$customerId = 'customer_id'; $page = 252; $size = 252; $result = $customers->getCards($customerId, $page, $size);
错误
updateCustomer
更新客户信息
function updateCustomer( $customerId, $body, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $body = new UpdateCustomerRequest(); $idempotencyKey = 'idempotency-key'; $result = $customers->updateCustomer($customerId, $body, $idempotencyKey);
错误
getCustomer
获取客户信息
function getCustomer($customerId)
参数
示例用法
$customerId = 'customer_id'; $result = $customers->getCustomer($customerId);
错误
renewCard
续期卡片
function renewCard( $customerId, $cardId, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $cardId = 'card_id'; $idempotencyKey = 'idempotency-key'; $result = $customers->renewCard($customerId, $cardId, $idempotencyKey);
错误
updateCustomerMetadata
更新客户的元数据
function updateCustomerMetadata( $customerId, $body, $idempotencyKey = null)
参数
示例用法
$customerId = 'customer_id'; $body = new UpdateMetadataRequest(); $idempotencyKey = 'idempotency-key'; $result = $customers->updateCustomerMetadata($customerId, $body, $idempotencyKey);
错误
ChargesController
获取单例实例
从API客户端可以访问ChargesController
类的单例实例。
$charges = $client->getCharges();
updateChargeMetadata
从费用更新元数据
function updateChargeMetadata( $chargeId, $body, $idempotencyKey = null)
参数
示例用法
$chargeId = 'charge_id'; $body = new UpdateMetadataRequest(); $idempotencyKey = 'idempotency-key'; $result = $charges->updateChargeMetadata($chargeId, $body, $idempotencyKey);
错误
captureCharge
捕获收费
function captureCharge( $chargeId, $idempotencyKey = null, $body = null)
参数
示例用法
$chargeId = 'charge_id'; $idempotencyKey = 'idempotency-key'; $body = new CreateCaptureChargeRequest(); $result = $charges->captureCharge($chargeId, $idempotencyKey, $body);
错误
updateChargePaymentMethod
更新收费的支付方式
function updateChargePaymentMethod( $chargeId, $body, $idempotencyKey = null)
参数
示例用法
$chargeId = 'charge_id'; $body = new UpdateChargePaymentMethodRequest(); $idempotencyKey = 'idempotency-key'; $result = $charges->updateChargePaymentMethod($chargeId, $body, $idempotencyKey);
错误
getChargeTransactions
获取ChargeTransactions
function getChargeTransactions( $chargeId, $page = null, $size = null)
参数
示例用法
$chargeId = 'charge_id'; $page = 252; $size = 252; $result = $charges->getChargeTransactions($chargeId, $page, $size);
错误
updateChargeDueDate
更新收费的到期日
function updateChargeDueDate( $chargeId, $body, $idempotencyKey = null)
参数
示例用法
$chargeId = 'charge_id'; $body = new UpdateChargeDueDateRequest(); $idempotencyKey = 'idempotency-key'; $result = $charges->updateChargeDueDate($chargeId, $body, $idempotencyKey);
错误
getCharges
列出所有收费
function getCharges( $page = null, $size = null, $code = null, $status = null, $paymentMethod = null, $customerId = null, $orderId = null, $createdSince = null, $createdUntil = null)
参数
示例用法
$page = 252; $size = 252; $code = 'code'; $status = 'status'; $paymentMethod = 'payment_method'; $customerId = 'customer_id'; $orderId = 'order_id'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $result = $charges->getCharges($page, $size, $code, $status, $paymentMethod, $customerId, $orderId, $createdSince, $createdUntil);
错误
updateChargeCard
更新收费的卡片
function updateChargeCard( $chargeId, $body, $idempotencyKey = null)
参数
示例用法
$chargeId = 'charge_id'; $body = new UpdateChargeCardRequest(); $idempotencyKey = 'idempotency-key'; $result = $charges->updateChargeCard($chargeId, $body, $idempotencyKey);
错误
getCharge
根据ID获取收费
function getCharge($chargeId)
参数
示例用法
$chargeId = 'charge_id'; $result = $charges->getCharge($chargeId);
错误
cancelCharge
取消收费
function cancelCharge( $chargeId, $idempotencyKey = null, $body = null)
参数
示例用法
$chargeId = 'charge_id'; $idempotencyKey = 'idempotency-key'; $body = new CreateCancelChargeRequest(); $result = $charges->cancelCharge($chargeId, $idempotencyKey, $body);
错误
getChargesSummary
获取ChargesSummary
function getChargesSummary( $status, $createdSince = null, $createdUntil = null)
参数
示例用法
$status = 'status'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $result = $charges->getChargesSummary($status, $createdSince, $createdUntil);
错误
retryCharge
重试收费
function retryCharge( $chargeId, $idempotencyKey = null)
参数
示例用法
$chargeId = 'charge_id'; $idempotencyKey = 'idempotency-key'; $result = $charges->retryCharge($chargeId, $idempotencyKey);
错误
createCharge
创建新的收费
function createCharge( $body, $idempotencyKey = null)
参数
示例用法
$body = new CreateChargeRequest(); $idempotencyKey = 'idempotency-key'; $result = $charges->createCharge($body, $idempotencyKey);
错误
confirmPayment
确认支付
function confirmPayment( $chargeId, $idempotencyKey = null, $body = null)
参数
示例用法
$chargeId = 'charge_id'; $idempotencyKey = 'idempotency-key'; $body = new CreateConfirmPaymentRequest(); $result = $charges->confirmPayment($chargeId, $idempotencyKey, $body);
错误
RecipientsController
获取单例实例
可以通过API客户端访问RecipientsController
类的单例实例。
$recipients = $client->getRecipients();
getTransfer
获取转账
function getTransfer( $recipientId, $transferId)
参数
示例用法
$recipientId = 'recipient_id'; $transferId = 'transfer_id'; $result = $recipients->getTransfer($recipientId, $transferId);
错误
updateRecipient
更新收件人
function updateRecipient( $recipientId, $body, $idempotencyKey = null)
参数
示例用法
$recipientId = 'recipient_id'; $body = new UpdateRecipientRequest(); $idempotencyKey = 'idempotency-key'; $result = $recipients->updateRecipient($recipientId, $body, $idempotencyKey);
错误
getRecipient
检索收件人信息
function getRecipient($recipientId)
参数
示例用法
$recipientId = 'recipient_id'; $result = $recipients->getRecipient($recipientId);
错误
createAnticipation
创建预期
function createAnticipation( $recipientId, $body, $idempotencyKey = null)
参数
示例用法
$recipientId = 'recipient_id'; $body = new CreateAnticipationRequest(); $idempotencyKey = 'idempotency-key'; $result = $recipients->createAnticipation($recipientId, $body, $idempotencyKey);
错误
getAnticipations
从收件人处检索分页的预期列表
function getAnticipations( $recipientId, $page = null, $size = null, $status = null, $timeframe = null, $paymentDateSince = null, $paymentDateUntil = null, $createdSince = null, $createdUntil = null)
参数
示例用法
$recipientId = 'recipient_id'; $page = 252; $size = 252; $status = 'status'; $timeframe = 'timeframe'; $paymentDateSince = date("D M d, Y G:i"); $paymentDateUntil = date("D M d, Y G:i"); $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $result = $recipients->getAnticipations($recipientId, $page, $size, $status, $timeframe, $paymentDateSince, $paymentDateUntil, $createdSince, $createdUntil);
错误
getAnticipationLimits
获取收件人的预期限制
function getAnticipationLimits( $recipientId, $timeframe, $paymentDate)
参数
示例用法
$recipientId = 'recipient_id'; $timeframe = 'timeframe'; $paymentDate = date("D M d, Y G:i"); $result = $recipients->getAnticipationLimits($recipientId, $timeframe, $paymentDate);
错误
getRecipients
检索分页的收件人信息
function getRecipients( $page = null, $size = null)
参数
示例用法
$page = 252; $size = 252; $result = $recipients->getRecipients($page, $size);
错误
createRecipient
创建新的收件人
function createRecipient( $body, $idempotencyKey = null)
参数
示例用法
$body = new CreateRecipientRequest(); $idempotencyKey = 'idempotency-key'; $result = $recipients->createRecipient($body, $idempotencyKey);
错误
getWithdrawById
GetWithdrawById
function getWithdrawById( $recipientId, $withdrawalId)
参数
示例用法
$recipientId = 'recipient_id'; $withdrawalId = 'withdrawal_id'; $result = $recipients->getWithdrawById($recipientId, $withdrawalId);
错误
updateRecipientDefaultBankAccount
更新收款人的默认银行账户
function updateRecipientDefaultBankAccount( $recipientId, $body, $idempotencyKey = null)
参数
示例用法
$recipientId = 'recipient_id'; $body = new UpdateRecipientBankAccountRequest(); $idempotencyKey = 'idempotency-key'; $result = $recipients->updateRecipientDefaultBankAccount($recipientId, $body, $idempotencyKey);
错误
updateRecipientMetadata
更新收款人元数据
function updateRecipientMetadata( $recipientId, $body, $idempotencyKey = null)
参数
示例用法
$recipientId = 'recipient_id'; $body = new UpdateMetadataRequest(); $idempotencyKey = 'idempotency-key'; $result = $recipients->updateRecipientMetadata($recipientId, $body, $idempotencyKey);
错误
getTransfers
获取收款人的分页转账列表
function getTransfers( $recipientId, $page = null, $size = null, $status = null, $createdSince = null, $createdUntil = null)
参数
示例用法
$recipientId = 'recipient_id'; $page = 210; $size = 210; $status = 'status'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $result = $recipients->getTransfers($recipientId, $page, $size, $status, $createdSince, $createdUntil);
错误
createTransfer
为收款人创建转账
function createTransfer( $recipientId, $body, $idempotencyKey = null)
参数
示例用法
$recipientId = 'recipient_id'; $body = new CreateTransferRequest(); $idempotencyKey = 'idempotency-key'; $result = $recipients->createTransfer($recipientId, $body, $idempotencyKey);
错误
createWithdraw
createWithdraw
function createWithdraw( $recipientId, $body)
参数
示例用法
$recipientId = 'recipient_id'; $body = new CreateWithdrawRequest(); $result = $recipients->createWithdraw($recipientId, $body);
错误
getWithdrawals
获取收款人的分页转账列表
function getWithdrawals( $recipientId, $page = null, $size = null, $status = null, $createdSince = null, $createdUntil = null)
参数
示例用法
$recipientId = 'recipient_id'; $page = 210; $size = 210; $status = 'status'; $createdSince = date("D M d, Y G:i"); $createdUntil = date("D M d, Y G:i"); $result = $recipients->getWithdrawals($recipientId, $page, $size, $status, $createdSince, $createdUntil);
错误
updateAutomaticAnticipationSettings
更新收款人元数据
function updateAutomaticAnticipationSettings( $recipientId, $body, $idempotencyKey = null)
参数
示例用法
$recipientId = 'recipient_id'; $body = new UpdateAutomaticAnticipationSettingsRequest(); $idempotencyKey = 'idempotency-key'; $result = $recipients->updateAutomaticAnticipationSettings($recipientId, $body, $idempotencyKey);
错误
getAnticipation
获取预付款
function getAnticipation( $recipientId, $anticipationId)
参数
示例用法
$recipientId = 'recipient_id'; $anticipationId = 'anticipation_id'; $result = $recipients->getAnticipation($recipientId, $anticipationId);
错误
updateRecipientTransferSettings
UpdateRecipientTransferSettings
function updateRecipientTransferSettings( $recipientId, $body, $idempotencyKey = null)
参数
示例用法
$recipientId = 'recipient_id'; $body = new UpdateTransferSettingsRequest(); $idempotencyKey = 'idempotency-key'; $result = $recipients->updateRecipientTransferSettings($recipientId, $body, $idempotencyKey);
错误
getBalance
获取收款人的余额信息
function getBalance($recipientId)
参数
示例用法
$recipientId = 'recipient_id'; $result = $recipients->getBalance($recipientId);
错误
getRecipientByCode
检索收件人信息
function getRecipientByCode($code)
参数
示例用法
$code = 'code'; $result = $recipients->getRecipientByCode($code);
错误
getDefaultRecipient
GetDefaultRecipient
function getDefaultRecipient()
示例用法
$result = $recipients->getDefaultRecipient();
错误
TokensController
获取单例实例
TokensController
类的单例实例可以通过 API 客户端访问。
$tokens = $client->getTokens();
createToken
标签:
跳过身份验证
CreateToken
function createToken( $publicKey, $body, $idempotencyKey = null, $appId = null)
参数
示例用法
$publicKey = 'public_key'; $body = new CreateTokenRequest(); $idempotencyKey = 'idempotency-key'; $appId = 'appId'; $result = $tokens->createToken($publicKey, $body, $idempotencyKey, $appId);
错误
getToken
标签:
跳过身份验证
通过其 ID 获取令牌
function getToken( $id, $publicKey, $appId = null)
参数
示例用法
$id = 'id'; $publicKey = 'public_key'; $appId = 'appId'; $result = $tokens->getToken($id, $publicKey, $appId);
错误
TransactionsController
获取单例实例
TransactionsController
类的单例实例可以通过 API 客户端访问。
$transactions = $client->getTransactions();
getTransaction
GetTransaction
function getTransaction($transactionId)
参数
示例用法
$transactionId = 'transaction_id'; $result = $transactions->getTransaction($transactionId);
错误
TransfersController
获取单例实例
TransfersController
类的单例实例可以通过 API 客户端访问。
$transfers = $client->getTransfers();
getTransferById
GetTransferById
function getTransferById($transferId)
参数
示例用法
$transferId = 'transfer_id'; $result = $transfers->getTransferById($transferId);
错误
postCreateTransfer
CreateTransfer
function postCreateTransfer($body)
参数
示例用法
$body = new CreateTransfer(); $result = $transfers->postCreateTransfer($body);
错误
getTransfers1
获取所有转账
function getTransfers1()
示例用法
$result = $transfers->getTransfers1();