12-02-2016 08:17 AM
Okay so im fairly new to software development (8 months)- no experience with API's. I have been tasked to implement authorize.net for our websites. I don't know what to do- I have read the the api reference documentation and sdk stuff on github. I don't know how I can implement any of it, just trying to use the chargecreditcard request but I cant figure out how to pass the login and transaction key, then implement the chargecreditcard request/method. I'm trying to implement this using c# but so confused on what I should. I ideally would like to use the API but don't know how... I did read and watch videos on how API's are meant to be implemented, those made sense but the documentation here doesn't make sense to me.
12-02-2016 10:19 AM
Let's take this one step at a time. Warning: I'm going to get a little basic here, but only to make sure that everything is clear.
First off, do you have a developer account for our sandbox? If not, sign up at http://developer.authorize.net/. That gives you your login ID and transaction key to use to send test transactions.
Second, we're assuming basic familiarity with web programming, like how to receive a request from a browser, how to act on whatever's received, and how to send a request to a web server.
Third, it might be important to understand the difference between our API and our SDKs. Our Authorize.Net API is the collection of instructions of what parameters and values to send to our server to cause it to do certain things.
It would be particularly instructive to spend some time with our API reference (http://developer.authorize.net/api/reference), particularly the "Try it" tab for each section. That tab gives you an interactive environment to create a request to send to our API, and to see the response to that request in real time. This shows the actual commands, parameters, and values that your system would be sending to our system to get it to do what you want. Experiment with removing or changing values to really get a feel for how our system works.
It's possible to take the information from the API reference and then write your program to construct requests the same way, with the same content, the same XML or JSON formatting, and then send them directly to our server. However, we have SDKs available to abstract some of that and make the process a little bit easier.
The SDK is like a middle layer that your application talks to which will then talk to our server. Instead of constructing out the fully formatted XML or JSON request, you'd call a method or function in the SDK to create a transaction, and then pass that method some parameters like login ID and card number and such. That SDK method would then probably call other methods or functions to assemble the request according to our API rules and send the request to our server. Other parts of the SDK would then get the response and interpret it, putting some of the response into variables for you to use, and notifying the rest of your app about the response.
Hopefully this is a good conceptual starting point for you. If this is all clear and you're running into specific problems with the SDK, let us know, and we can start troubleshooting from there.
12-02-2016 11:07 AM
Thank you @Aaron.
That helps a bit, lets dive into it a bit. I have the sandbox credentials. Do you have any example code snippets that I could see where someone has implemented the chargecreditcard request? I have looked at the api references page- only problem is I don't know how to use that code inside of our project. The api references page is using json and xml to make requests to your server. What I have is a c# class, and have no idea how to do anything like what's being done on the references page. I downloaded the sample sdk for c# and have been trying to figure out how I can implement that to what I need, but not having much luck.
12-02-2016 11:11 AM
On our Github page we also have sample code for the various SDKs. Have you looked at the C# sample code (https://github.com/AuthorizeNet/sample-code-csharp)?
Those samples show exactly how to call the classes in the SDK. If you're running into trouble there, let me know!