跳转到主要内容

计费 API(管理员)

作者:Daria Mamchenkova

开始之前

计费 API

Affise API 为您提供了多种处理账单的方法。例如,您可以获取付款发票信息、创建付款发票、删除付款发票等。本文将为您展示最常用的账单相关 API 请求(方法)示例,并附有 cURL 示例及响应示例。

💰 “通过 API 进行计费”功能仅适用于特定套餐。如需启用该功能,请联系您的 Affise 客户经理。

获取付款列表

使用此方法可根据您在 API 请求中指定的属性,获取付款列表。

方法:GET /3.1/payments。

获取指定时间段内付款列表的请求:

https://api-rocketcompany.affise.com/3.1/payments?date_from=2022-08-08&date_to=2022-12-12

创建付款发票

使用此方法根据特定联盟成员的属性(您可在 API 请求中指定)生成指定金额的付款发票。

方法:POST /3.1/payments/create-for-affiliate。

以下是用于创建具有以下属性的付款发票的 cURL 请求:

  • 联盟成员ID

  • 付款发票金额

  • 货币ID

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/create-for-affiliate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=alcje7al4vd7p27ev26s1gclqm' \
--data-urlencode 'aid=2' \
--data-urlencode 'sum=2' \
--data-urlencode 'currency=150'

为联盟成员生成付款发票

使用此方法根据其属性生成特定时间段的账单,您可在 API 请求中指定这些属性。

方法:POST /3.1/payments/generate。

以下 cURL 请求用于为联盟成员生成具有以下属性的付款发票:

  • 日期

  • 联盟成员ID

  • 需排除的联盟成员ID

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/generate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=alcje7al4vd7p27ev26s1gclqm' \
--data-urlencode 'date=2022-05-23' \
--data-urlencode 'aid=2' \
--data-urlencode 'exclude_aids[]=8'

更新付款发票

使用此方法根据其属性更新付款发票,您可在 API 请求中指定这些属性。

该方法:POST /3.1/payments/{ID}。

以下是用于更新付款发票的 cURL 请求,其中包含以下属性:

  • 付款账户信息

  • “部分已付”状态

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/2926' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=7e3nrlm566d1vdqdioiaflrhhn' \
--data-urlencode 'payment_account=payment account' \
--data-urlencode 'status=3'

为付款发票添加更正金额

使用此方法根据付款发票的属性(您可在 API 请求中指定)为其添加更正值。

方法:POST /3.1/payments/{ID}/add-correction。

以下是用于添加更正值的 cURL 请求,其中包含以下属性:

  • 收入 = 22

  • 备注

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/2921/add-correction' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=alcje7al4vd7p27ev26s1gclqm' \
--data-urlencode 'revenue=22' \
--data-urlencode 'comment=example'

删除多张付款发票

使用此方法可根据付款发票的属性(您可在 API 请求中指定)批量删除多张付款发票。

方法:POST /3.1/payments/bulk-delete。
​

⚠️ 您可以删除任何状态的付款发票,但“已完成”状态除外。若尝试删除状态为“已完成”的付款发票,将收到以下错误:

以下是用于批量删除支付发票(发票 ID 为 2925 和 2924)的 cURL 请求:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.1/payments/bulk-delete' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=7e3nrlm566d1vdqdioiaflrhhn' \
--data-urlencode 'ids[0]=2925' \
--data-urlencode 'ids[1]=2924'

编辑支付系统

使用此方法可根据其属性编辑联盟成员的支付系统,您可在 API 请求中指定这些属性。
​
​方法:POST /3.0/admin/partner/{ID}。

⚠️ 仅当账单状态为“未完成”时,才可进行编辑。

用于编辑合作伙伴系统 ID 为 13、货币代码为 USD 且高级字段为 1b765 的 cURL 请求:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.0/admin/partner/2' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: 5c9f6bbe709c5b331a9630b1fb1db0ed' \
--header 'Cookie: PHPSESSID=7e3nrlm566d1vdqdioiaflrhhn' \
--data-urlencode 'payment_systems[0][system_id]=13' \
--data-urlencode 'payment_systems[0][currency]=USD' \
--data-urlencode 'payment_systems[0][fields][4]=1b765'

如有任何疑问,请通过电子邮件 [email protected] 联系 Affise 客户支持团队。

这是否解答了您的问题?