我已经使用以下计划明细创建了定期付款:
{
"name": "Daily Plan",
"description": "Daily plan for sandbox",
"status": "ACTIVE",
"usage_type": "LICENSED",
"product_id": "PROD-32M79039A8219464Y",
"billing_cycles": [
{
"frequency": {
"interval_unit": "DAY",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 1,
"total_cycles": 0,
"pricing_scheme": {
"fixed_price": {
"value": "5.99",
"currency_code": "EUR"
}
}
}
],
"payment_preferences": {
"auto_bill_outstanding": true,
"setup_fee": {
"value": "5.99",
"currency_code": "EUR"
},
"setup_fee_failure_action": "CANCEL",
"payment_failure_threshold": 0
},
"taxes": {
"percentage": "0",
"inclusive": false
}
}
因此,基本上我的客户应立即支付5.99,每天收取5.99。我在这里发现了三个问题:
1)创建订阅后,PayPal不会返回有关已付款期的期末信息。相反,我得到以下响应:
{
"status": "ACTIVE",
"status_update_time": "2020-05-05T13:57:19Z",
"id": "I-E5EJ8L0FTMUS",
"plan_id": "P-4VV24380M0247112FL2YW6ZQ",
"start_time": "2020-05-04T22:00:00Z",
"quantity": "1",
"shipping_amount": {
"currency_code": "EUR",
"value": "0.0"
},
"subscriber": {
"name": {
"given_name": "test",
"surname": "facilitator"
},
"email_address": "xxx",
"payer_id": "xxx"
},
"billing_info": {
"outstanding_balance": {
"currency_code": "EUR",
"value": "0.0"
},
"cycle_executions": [
{
"tenure_type": "REGULAR",
"sequence": 1,
"cycles_completed": 0,
"cycles_remaining": 0,
"current_pricing_scheme_version": 1,
"total_cycles": 0
}
],
"last_payment": {
"amount": {
"currency_code": "EUR",
"value": "5.99"
},
"time": "2020-05-05T13:54:42Z"
},
"next_billing_time": "2020-05-05T13:54:40Z",
"failed_payments_count": 0
},
"create_time": "2020-05-05T13:53:37Z",
"update_time": "2020-05-05T13:57:19Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-E5EJ8L0FTMUS/cancel",
"rel": "cancel",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-E5EJ8L0FTMUS",
"rel": "edit",
"method": "PATCH"
},
{
"href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-E5EJ8L0FTMUS",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-E5EJ8L0FTMUS/suspend",
"rel": "suspend",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-E5EJ8L0FTMUS/capture",
"rel": "capture",
"method": "POST"
}
]
}
看着next_billing_time
,该值为2020-05-05T13:54:40Z
,但这是不正确的,实际上是该日期已支付订阅费。 next_billing_time
应为:2020-05-06T13:54:40Z
,“因为客户已订阅了5.99的每日计划,所以为什么PayPal会返回激活日期?
2)我如何才能真正获得定期付款的末期?使用Stripe
,我可以轻松地使用current_period_end
,请参阅here。
3)start_time
不正确,客户今天开始并已支付订阅,为什么贝宝昨天仍显示?
更新:
预计下一笔付款应为06/05/2020
,但应为05/05/2020
,因此我无法计算数据库中的订阅截止日期,PayPal使我感到非常困难
几分钟后变成:
问题在于,PayPal会在几分钟后更新此日期,这对我来说是错误的
PayPal在创建订阅时不会计算这些值。如您所见,相应的服务稍后会对其进行计算。