Authorize.net create ARB and get Id

404 views Asked by At

When I create a new ARB subscription the response comes back and I save the id it gives us. I tried it out and it gives us back "33".

Then when the silent post callback hits our method, the response has a different id, 15631016.

15631016 is correct in matching up with the one we see in the authorize.net online portal.

So, what is 33 and why doesn't it return the real ARB ID?

Here is the code that creates the new ARB and then gets the arbId:

net.authorize.arb.Transaction arbTransaction = createARBTransaction(startDate.getTime(), creditCard, member, splitOccurrences.intValue() - 1, splitUnit, useBillingAddress, billingAddress, recurringOrder.getTotalAmount().doubleValue(), recurringOrder);

net.authorize.arb.Result<?> arbResult = (net.authorize.arb.Result<?>) merchant.postTransaction(arbTransaction);

String arbId;
if (arbResult.isOk()) {
   arbId = arbResult.getResultSubscriptionId();
}

If getResultSubscriptionId() is not the correct way to get the new ARB subscription ID, what is the correct method to use?

2

There are 2 answers

1
John Conde On

I went through the sample code and also their community and there isn't much to go on. The only thing I can think of trying is changing:

arbResult.getResultSubscriptionId();

to:

arbTransaction.getResultSubscriptionId();

I know that doesn't sound logical but it's the best I can some up with.

0
Omn On

According to the source code, you are using the correct method.

If you trace the calls back into the code you'll see that the subscription id gets set by the following call in importResponseMessages() of net.authorize.arb.Result

getElementText(txn.getCurrentResponse().getDocumentElement(),AuthNetField.ELEMENT_SUBSCRIPTION_ID.getFieldName());

so if you call this on your arbResult variable, you might get closer. Note that txn should be replaced by your variable arbTransaction.

Alternatively, you can dig into the response itself to see why the Authorize.net APK isn't returning the correct subscription id.

xml = arbTransaction.getCurrentResponse().dump(true);

The true determines whether the XML tree is collapsed. xml should be a string containing your XML response from authorize.net