我想设置一个月度订阅计划.
每个月初,买家将收取100美元的费用.
这是我制作的结算方案代码:
billing_plan = paypalrestsdk.BillingPlan({
"name": "Monthly Billing Plan",
"description": "Monthly Plan",
"merchant_preferences": {
"auto_bill_amount": "yes",
"cancel_url": "http://localhost:8000/payment_billing_agreement_cancel",
"initial_fail_amount_action": "continue",
"max_fail_attempts": "0",
"return_url": "http://localhost:8000/payment_billing_agreement_execute",
"setup_fee": {
"currency": "USD",
"value": "100"
}
},
"payment_definitions": [
{
"amount": {
"currency": "USD",
"value": "100"
},
"cycles": "0",
"frequency": "MONTH",
"frequency_interval": "1",
"name": "Monthly Payment",
"type": "REGULAR"
}
],
"type": "INFINITE"
})
我不清楚它是在月的第一天还是在月的最后一天收费?我应该进行设置,以便立即收费吗?我的意图是收费是在每个月的第一天完成的.
我在买家的沙箱中看到这个:
预先批准的付款100美元
这是什么意思,他已经收取100美元或预先批准并在当月的最后一天收费?
到目前为止我用过这个流程:
create billing plan
activate billing plan
create billing agreement
execute billing agreement
(这是正确的吗?它显示预先批准但是这真的是收费,如果不是应该采取什么其他步骤来正确收费)
为了澄清,主要问题是如何使用PayPal设置月度结算(以及设置充电周期,无论是月初还是结束)? (在这个例子中,它使用django python)
更新:
根据推荐@ john-moutafis,我现在设置了100美元,并且定期开始日期设置为1个月后的USD111
billing_agreement = paypalrestsdk.BillingAgreement({
"name": "Monthly Billing Agreement",
"description": "Monthly Payment Agreement",
"start_date": arrow.utcnow().shift(months=+1).datetime.strftime('%Y-%m-%dT%H:%M:%SZ'),
"plan": {
"id": billing_plan.id
},
"payer": {
"payment_method": "paypal"
}
})
这里是paypal截图,为什么没有关于数量的信息,为什么没有重复信息预先批准?
https://imgur.com/a/Sp7JdVC
解决方法:
您可以通过指定start_datefield来说明this example中所述的结算协议的开始日期.这里我使用arrow模块,方便地计算下个月的第一天:
import arrow
billing_plan = paypalrestsdk.BillingPlan({
"name": "Monthly Billing Plan",
"description": "Monthly Plan",
"start_date": arrow.utcnow().shift(months=+1).replace(day=1).isoformat(),
"merchant_preferences": {
...
"setup_fee": {
"currency": "USD",
"value": "100"
}
}
...
})
初始订阅费应由setup_fee字段处理!
问题更新后编辑:
在计划的merchant_preferences字段中,您将auto_bill_amount设置为yes.
通过查看documentation on merchant_preferences,我们可以看到:
auto_bill_amount enum
Indicates whether PayPal automatically bills the outstanding balance in the next billing cycle. The outstanding balance is the total amount of any previously failed scheduled payments. Value is:
NO. PayPal does not automatically bill the customer the outstanding >balance.
YES. PayPal automatically bills the customer the outstanding balance.
Possible values: YES, NO.
Default: NO.
标签:python,django,paypal
来源: https://codeday.me/bug/20191007/1866446.html