所以我住在欧洲,我们必须向用户显示的价格中已经包含税,我想知道如何使用Paypal sdk做到这一点。
我的billing_plan_attributes:
billing_plan_attributes = {
"name": request.args['name'],
"description": request.args['description'],
"merchant_preferences": {
"auto_bill_amount": "yes",
"cancel_url": "https://ruby-eu.com/profile/settings/paypal/cancel/token",
"initial_fail_amount_action": "continue",
"max_fail_attempts": "1",
"return_url": 'https://ruby-eu.com/profile/settings/paypal/subscribe/execute',
"setup_fee": {
"currency": request.args['currency'],
"value": request.args['setup_fee']
}
},
"payment_definitions": [
{
"amount": {
"currency": request.args['currency'],
"value": request.args['amount']
},
"cycles": request.args['cycles'],
"frequency": request.args['frequency'],
"frequency_interval": request.args['frequency_interval'],
"name": request.args['payment_name'],
"type": request.args['payment_type'],
}
],
"type": request.args['type']
}
我尝试添加
"taxes": {
"percentage": "23",
"inclusive": True
}
在merchant_preferences
,payment_defenitions
内和type
下,但是当我运行它们时它们会返回
Problem while creating a new plan: Incoming JSON request does not map to API request
而且我不知道该如何解决这个问题。如果您想知道问题是否出在其他地方,我从JSON中删除了税款,然后运行就可以了。
首先,要知道Python SDK中的depcrecated billing plan object与新的Subscriptions API中的新计划对象不对应。如果您想使用Subscriptions API(可能应该使用),则需要与直接的HTTPS API调用集成,而不要与任何旧的SDK集成。基本上,请看一下您在此处看到的CURL调用:https://developer.paypal.com/docs/subscriptions/integrate/ ...并从Python实现它们的等效项。
Subscriptions API do]的计费计划对象支持您尝试添加的语法,所以我想这是从以下位置获得的:https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create