【问题标题】:How can I set up recurring billing objects w/Authorize.net using Django-merchant?如何使用 Django-merchant 设置带有 Authorize.net 的定期计费对象?
【发布时间】:2014-10-19 07:37:49
【问题描述】:

我想知道您是否可以帮我做点什么(我认为这并不难,只是超出了我的能力范围)。我正在尝试使用 django-merchant 设置一个应用程序来通过 Authorize.net 处理定期计费。商家在这方面的文档有点薄。

我正在使用 ARB。这是对网关的调用:

return g1.recurring(payment_arguments.get('rate', None), cc, options = payment_options)

成功的响应会生成这样的字典:

{u'ARBCreateSubscriptionResponse': {u'messages': {u'message': {u'code': u'I00001', u'text': u'Successful.'}, u'resultCode': u'Ok'}, u'subscriptionId': u'933728'}}

显然我已经完成了这项工作(“成功”;代码:“I00001”)。我想记录回复。 Merchant 有一个 AuthorizeAIMResponse 模型类,我在其他项目中对其进行了子类化。一个sn-p:

import datetime
from django.db import models
from billing.models.authorize_models import AuthorizeAIMResponse

class PaymentRequest(models.Model):
""" 
A payment request object is created for every payment request. Successful payment requests get an invoice number 
""" 
created = models.DateTimeField(default=datetime.datetime.now, editable=False) 
response = models.OneToOneField(AuthorizeAIMResponse, blank=True, null=True) 
invoice_number = models.CharField(max_length=15)

...

Merchant’s documentation on recurring billing 只说:

recurring(money, creditcard, options = None):一种设置循环交易(或订阅)的方法。 子类必须实现此方法。

我应该如何构建我的 PaymentRequest 模型(和/或 ARBCreateSubscriptionResponse 模型/对象)以正确捕获和记录响应?

【问题讨论】:

  • 感谢大家的快速回复。你们是最棒的! ;-)

标签: python django e-commerce authorize.net


【解决方案1】:

我找到了完成这项工作的方法。可能不是最优雅的解决方案。我在converting a Python dictionary to an object 上遵循了这篇文章中使用的方法。然后,我创建了一个模型来存储响应数据。

【讨论】:

    猜你喜欢
    • 2018-04-27
    • 2019-05-25
    • 2020-08-01
    • 2021-05-02
    • 2019-06-21
    • 2023-02-08
    • 2011-10-09
    • 2012-08-30
    • 2013-04-27
    相关资源
    最近更新 更多