cancel
Showing results for 
Search instead for 
Did you mean: 

In-App Nonce Request

 

Hello,

 

I'm working on an idea of incorporating our business' online store into our C# application (a simulation game used on desktop Windows machines), due to many of our customers requesting an easier way of purchasing our add-on products.

 

I figured the In-App method would be the thing to use (ie Accept.js)? While I see there is an XML example for what to do after a Nonce is attained, there's nothing showing how I should submit the request for the Nonce (from inside our application) without having to use java.

 

Am I totally going wrong here? Have I misunderstood the "In-App" idea? I've added a WPF form in our simulation (one of our menus) that is our "in-sim" store, with all the necessary fields for completing the transaction, basically exactly the same fields as are on our existing website store. Everything would work fine except for the initial step of getting a Nonce. I don't wish to have the user submit card-details to our server, which is why I figured the In-App Accept method would be ideal.

 

Am I really stuck having to somehow call java-script just to send the API request for a Nonce? Our application is purely C# and DotNet 4.5.

 

Anyhow, I appreciate your time reading this. My C# code is below, with the resulting error code at the bottom. I'm sure I'm just making a stupid mistake somewhere. Thanks in-advance!

//SandBox
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; string URL = "https://apitest.authorize.net/xml/v1/request.api";
//build xml object for Nonce request
XNamespace xmlns = "AnetApi/xml/v1/schema/AnetApiSchema.xsd"; var xml = new XDocument(new XElement(xmlns + "createTransactionRequest", new XElement(xmlns + "merchantAuthentication", new XElement(xmlns + "name", "my sandbox APIL here"), new XElement(xmlns + "clientKey", "my sandbox client-key here")), new XElement(xmlns + "transactionRequest", new XElement(xmlns + "transactionType", "COMMON.ACCEPT.INAPP.PAYMENT"), new XElement(xmlns + "payment", new XElement(xmlns + "creditCard", new XElement(xmlns + "cardNumber", CardNumber.Text), new XElement(xmlns + "expirationDate", mm + yy), new XElement(xmlns + "cardCode", CVN.Text)))))); var httpContent = new StringContent(xml.ToString(), System.Text.Encoding.UTF8, "text/xml"); var result = client.PostAsync(URL, httpContent).Result;
//My result from A-Net contains: Error E00059 The authentication type is not allowed for this method call.

 

 

JWG
Member
2 REPLIES 2

Hello,

 

COMMON.ACCEPT.INAPP.PAYMENT should be the value of the dataDescriptor element and the value of transactionType should be authCaptureTransaction.

 

<transactionRequest>
<transactionType>authCaptureTransaction</transactionType>
<amount>75.00</amount>
<payment>
<opaqueData>
<dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor>
<dataValue>nonce_here</dataValue >
</opaqueData>
</payment>
</transactionRequest>
Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

Hi @JWG

 

Unfortunately, there's not really any other way to get a nonce other than through JavaScript. Most people in your situation are presenting some sort of web view within their app where the JavaScript is executing and sending payment details to our server. Once the nonce is obtained, then you send it in place of the card details in a normal transaction request.

Aaron
All Star