01-21-2018 01:06 AM
I would like to know , how to get a subscription's completed / approved transactions details using an API call using subscription ID in request.
Also i would like to make fake/test transactions for a subscription and analyze the response for approved or rejected transactions for a specific subscription/recurring billing , is there a way using API call ?
Basically , on my site , there are different packages to get access to different types of data. A user can subscribe to multiple packages.
Now the process i do is, if the authorize.net's customer profile information for the user does not exist in our database , then i make an API call to create the Customer profile first ( with payment and address information included ) , then i store the " an_customer_profile_id ", " an_payment_profile_id " and " an_shipping_address_id " , in our database for this user. Then i use these id's , to create a subscription and store the "an_subscription_id" in our database for that user. The recurring billing will occur after every 12 months.
Now what i want is that, i want to give the user access to those subsription packages only , whose this year's payment is complete/approved, and same with next year, meaning if payment is cleared for that year then allow user to access data otherwise forbid him to access the package data on our site.
Can anyone help me how should i go about doing this ? and how to get the completed/approved transactions for a subscription using an API call ? ( i am using the PHP library )
01-21-2018 11:50 AM - edited 01-21-2018 11:53 AM
In order the get the details/list of transactions associated with a subscription you will need to call the ARBGetSubscription API with flag
This enhancement to the API is pretty new and we are in process of updating the the sdks, the php sdk does not have this change, we will soon be making the php-sdk release with these changes, meanwhile you can test this by making direct API calls.
You will need to wait till the date of the transaction mentioned in the subscription to get the result.
Hope this helps !
01-21-2018 01:58 PM
I tried the 'getSubscription' API using a custom CURL XML request with this set to true:
.I needed to make some test transactions , to test different responses and write code according to that , but you say that i have to wait till next transaction ? my suscription is after every 12 months , should i wait till next year ? even if i made a minimum time subscription , that will be 7 days , so should i wait 7 days each !!?
For example i needed to know whether there will be multiple 'arbTransaction' arrays for mulltiple transactions ? because i needed to loop over them but i do not know the structure of multiple transactions therefore i needed to make fake transactions for the subscription.
[arbTransactions] => Array ( [arbTransaction] => Array ( [response] => This transaction has been approved. [submitTimeUTC] => 2018-01-16T09:12:49.67 [payNum] => 1 [attemptNum] => 1 ) )
Also i wanted to confirm , i saw that , when the 1st transaction was not charged , the 'arbTransactions' field was not returned in response. but when the 1st transaction was occured only then it appeared in response, so for multiple transactions, will the lastest transation will be the first in the array , followed by 2nd lastest transaction and so on ? and all the setteled transactions will return this response ?
This transaction has been approved.
because i noticed that for a transaction where an error was caused , it returned the same success message , but there was no transaction id returned in the response.