I’m wondering if you can help me with something (I don’t think it’s that hard, it’s just beyond me). I’m trying to set up an app to handle recurring billing through Authorize.net using django-merchant. Merchant’s documentation is a little thin in this area.
I’m using ARB. Here’s the call to the Gateway:
return g1.recurring(payment_arguments.get('rate', None), cc, options = payment_options)
A successful response generates a dictionary like this:
{u'ARBCreateSubscriptionResponse': {u'messages': {u'message': {u'code': u'I00001', u'text': u'Successful.'}, u'resultCode': u'Ok'}, u'subscriptionId': u'933728'}}
Apparently I’ve got this working ('Successful'; code:'I00001'). I’d like to log the responses. Merchant has an AuthorizeAIMResponse model class which I’ve subclassed on other projects. A snippet of that:
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 only says that:
recurring(money, creditcard, options = None): A method that sets up a recurring transaction (or a subscription). Subclasses must implement this method.
How should I structure my PaymentRequest model (and/or ARBCreateSubscriptionResponse model/object) to capture and log the response properly?