AuthorizeNet / sdk-python

Python SDK for the Authorize.Net API
Other
53 stars 82 forks source link

Check whether ARB Subscription has successfully processed #119

Closed lighth7015 closed 6 years ago

lighth7015 commented 6 years ago

Good afternoon,

I am looking to determine whether the credit or debit card associated with an ARB has been successfully processed or declined. It seems the only way to reliably do this is with API hooks?

Thank you,

ashtru commented 6 years ago

You can get the list of transactions ran successfully for an ARB subscription. In the request, includeTransactions flag has to be set as true (GetSubscription example). And then you can traverse the array of transactions returned in the response (GetSubscription example).

Also note that the first transaction for a subscription will happen on the startDate for that subscription.

References

  1. https://developer.authorize.net/api/reference/features/recurring_billing.html#Subscription_Reporting
  2. https://developer.authorize.net/api/reference/index.html#recurring-billing (you can explore different scenarios in the Try It tab.)
lighth7015 commented 6 years ago

Thank you!

ashtru commented 6 years ago

The above sample codes shared were in PHP.

You can use Python code similar to this PR: https://github.com/AuthorizeNet/sample-code-python/pull/43

In Request code: request.includeTransactions = True In Response code:

if (response.messages.resultCode=="Ok"):
        print ("Subscription Name : %s" % response.subscription.name)
        print ("Subscription Amount: %s" % response.subscription.amount)
        for transaction in response.subscription.arbTransactions.arbTransaction:
            print "Transaction id: %d" % transaction.transId

Please try this out, and see if this works for you :)

gnongsie commented 6 years ago

Hi all,

Based on the response given by @ashtru , I'm closing this issue.

Kindly reopen this if the issue persists.