当我尝试在有效用户视图中执行以下操作时,出现错误。如何使用RecurringApplicationCharge?
@login_required
def confirm(request, *args, **kwargs):
with request.user.session:
# Tried this:
charge = shopify.RecurringApplicationCharge.create(name="Test", test="true")
# Tried this:
charge = shopify.RecurringApplicationCharge.customize(name="Test", test="true")
# Tried this:
charge = shopify.RecurringApplicationCharge(name="Test", test="true")
我可以看到RecurringApplicationCharge类具有一个自定义方法,该方法执行
load_attributes_from_response(self.put("customize", recurring_application_charge= kwargs))
,但是我不确定该如何处理。.create
给我:TypeError:create()得到了意外的关键字参数'name'.customize
给我:绑定方法custom()必须以RecurringApplicationCharge实例作为第一个参数来调用(代替什么也不做)最后给了我:
recurring_application_charge(None)
我是否需要先创建使用费并将其添加为前缀选项?
最佳答案
看来我是通过执行以下操作来创建费用的:
@login_required
def confirm(request, *args, **kwargs):
with request.user.session:
# Tried this:
charge = shopify.RecurringApplicationCharge()
charge.test = True
charge.return_url = [... my return url ...]
charge.price = 10.00
charge.name = "Test name"
关于python - 如何使用Shopify Python API RecurringApplicationCharge,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41435509/