【问题标题】:How to use Shopify Python API RecurringApplicationCharge如何使用 Shopify Python API RecurringApplicationCharge
【发布时间】:2017-01-03 02:12:37
【问题描述】:

当我尝试在有效用户的视图中执行以下操作时,出现错误。如何使用 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() got an unexpected keyword argument 'name'

.customize 告诉我:绑定方法 customize() 必须以 RecurringApplicationCharge 实例作为第一个参数调用(什么都没有)

最后一个给了我:recurring_application_charge(None)

我是否需要先创建使用费并将其添加为前缀选项?

【问题讨论】:

    标签: python django shopify


    【解决方案1】:

    看起来我通过执行以下操作来创建费用:

    @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"
    

    【讨论】:

      猜你喜欢
      • 2021-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-02
      • 2013-01-17
      • 2020-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多