Python 3.x 计费协议有问题。取消()。(';cancel()缺少1个必需的位置参数:';attributes';)
SDK/库版本:1.13.1 环境:沙箱 贝宝调试ID值:无 语言、语言版本和操作系统:Python、Ubuntu 发行说明: 当我试图取消账单协议时,我遇到以下错误 错误:Python 3.x 计费协议有问题。取消()。(';cancel()缺少1个必需的位置参数:';attributes';),python-3.x,paypal,paypal-rest-sdk,paypal-subscriptions,Python 3.x,Paypal,Paypal Rest Sdk,Paypal Subscriptions,SDK/库版本:1.13.1 环境:沙箱 贝宝调试ID值:无 语言、语言版本和操作系统:Python、Ubuntu 发行说明: 当我试图取消账单协议时,我遇到以下错误 错误: TypeError: cancel() missing 1 required positional argument: 'attributes' 我的代码: billing_agreement = BillingAgreement.find(billing_id) if billing_agreement.can
TypeError: cancel() missing 1 required positional argument: 'attributes'
我的代码:
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel():
print(billing_agreement)
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))
我得到这个错误是因为我需要属性值中的某些内容,但我不知道应该为变量指定什么
GitHub问题:经过一些挖掘和查看文档示例后,我发现了一个关于取消选项的示例,我需要分配给属性值的是一个
cancel\u注释
守则:
cancel_note = {"note": "Canceling the agreement"}
user = Users.query.filter_by(id=ID).first()
billing_id = Subscriptions.query.filter_by(email=user.email).filter_by(active=1).first().order_id
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel(cancel_note):
flash('Subscription canceled with success.', 'success')
return redirect(url_for('settings.settingspage'))
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))
经过一些挖掘和查看文档示例后,我发现了一个关于取消选项的示例,我需要分配给属性值的是一个
cancel\u注释
守则:
cancel_note = {"note": "Canceling the agreement"}
user = Users.query.filter_by(id=ID).first()
billing_id = Subscriptions.query.filter_by(email=user.email).filter_by(active=1).first().order_id
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel(cancel_note):
flash('Subscription canceled with success.', 'success')
return redirect(url_for('settings.settingspage'))
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))