Reply
Highlighted
Member
Posts: 1
Registered: ‎07-09-2019

Updating amounts for each Recurring Subscription

[ Edited ]

Hello, I have been having trouble using the ARBUpdateSubscriptionRequest and I've narrowed it down to the fact it's attempting to update every subscription within a single request.

 

For context, this is what it should be doing: 

<ARBUpdateSubscriptionRequest>

  <merchantAuthentication></merchantAuthentication>

 

  <subscriptionId></subscriptionId>

  <subscription></subscription>

 

</ARBUpdateSubscriptionRequest>

...

<ARBUpdateSubscriptionRequest>

  <merchantAuthentication></merchantAuthentication>

 

  <subscriptionId></subscriptionId>

  <subscription></subscription>

 

</ARBUpdateSubscriptionRequest>

 

and this is what it is doing:

<ARBUpdateSubscriptionRequest>

  <merchantAuthentication></merchantAuthentication>

 

  <subscriptionId></subscriptionId>

  <subscription></subscription>

 

  <subscriptionId></subscriptionId>

  <subscription></subscription>

 

</ARBUpdateSubscriptionRequest>

 

As it is right now, the function is setup to loop through every company (using a foreach loop), and if they are Active (i.e. using our service), it should update their payment amount to reflect their proper usage. However, as shown in the examples, rather than creating a single, unique ARBUpdateSubscriptionRequest for each subscription (company), it is creating one request with ALL subscriptions. 

 

Very simple example of said function:

     foreach (company) {

          $subscriptionId = company['SUBSCRIPTIONID']; (variable from our db)

          $subscription = new \AuthorizeNet_Subscription();

          

          $subscription->$var_name = company[var_name];

          ...

 

          if (company is active) {

              $this->authorize->updateSubscription($subscriptionId, $subscription)

          } else...

     }

 

This function is declared within the SubscriptionHandler class, hence the usage of $this. If anyone can provide any insight as to what might be causing this or how to fix it, that'd be greatly appreciated! And I can/will provide more code upon request.

 

Also I apologize for the lack of information/vague wording; frankly, I don't know much about the ARB API and have been learning by reverse engineering the previous programmer's work. So bear with me, please!

 

Thanks!