Reply
Highlighted
Member
Posts: 1
Registered: ‎03-24-2017

Android Studio integration fails in 1000+1 ways

First I tried to integrate Authorize.Net in a simple Android Studio project.

The sample code from github only has the credit charging method.

 

I would like to implement the createCustomerProfile method, but the api sample codes are not working.

 

What I tried:

-importing the Authorize.Net sdk from various sites (no helpful article on the gradle components)

with the gradle dependencies added, the error pointed to a noSuchDef - JAXBContext error

 

-imported the Authorize.Net sdk files manually and imported 2900 other java files to be able to build the project

with this I got an error which said the java.util.Map doesn't have a createContext method....

 

-tried to make a simple json-api request based on the Authorize.Net JSON examples, but it says: 

 

The element 'transactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'amount' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'transactionType' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.

 

Which is ridiculous, because it works on the website...

Highlighted
All Star
Posts: 699
Registered: ‎11-03-2016

Re: Android Studio integration fails in 1000+1 ways

Hi @Cellalex1234,

 

Sorry about the troubles you're having. Any errors regarding validation to the schema are usually an indicator that something's being sent out of order, or being sent with the wrong name, things like that.

 

When using our SDK, you'd expect that if you can get the SDK to send the request the request would be properly formatted. If you hadn't called the relevant getter or setter functions correctly, you'd get an error before the request was even sent. So, with the SDK, you shouldn't ever get a schema error like that.

 

If, however, you're sending the JSON directly to the API and getting a schema error, double check to make sure that every element is in the right place, in the right order, and has the right capitalization.

 

In your case, perhaps you're sending "amount" before "transactionType"?

 

Highlighted
Contributor
Posts: 15
Registered: ‎08-25-2015

Re: Android Studio integration fails in 1000+1 ways

Both the Android and Apple SDKs are very poorly documented. I managed to get a payment nonce using the SDK and snippets from the sample code, but it took a lot of work. And now I'm trying to figure out how to use the nonce make a payment profile, but I can find no documentation at all about using CIM with the mobile SDKs. Where were you able to find help for it?