- Create a header & an implementation class containing the sample code
- If you happen to be using PayPal as well as AuthNet in your code then you may run into some syntactical problems. To resolve any such issues, please have a look at this post on stackoverflow.
- When substituting values in the code, if you provide the "API Login ID" and "Transaction Key" as the name / password values in your call to AuthNet then you will run into the following error as seen in the logs:
- This fails as password and transactionKey are distinctly different variables in the header files.
- So make sure to substitute the sample code with the username and password used with https://developer.authorize.net/ or https://test.authorize.net/
- If you run the code at this point and end up calling loginToGateway, you will run into the following error logs:
- This is not the same as being at the point where you simply need to login to the sandbox (https://test.authorize.net/) and enable the new device. No, this is very different and you need to get past this to get to the next point. So you need to add some additional code which is talked about on the forums as well:
- Now you should be at a point where running the code results in the following error logs:
- This is more like it! So head over to https://test.authorize.net/ and enable your new device. Here are some screenshots: screenshot_1 and screenshot_2
- Sadly we aren't done yet, we see a message about the mobile device being ready for use but we also notice that the sessionToken has come back as null and therefore the next call's response displays an error ... claiming that the request content was incomplete:
- Even I don't have a solution past this point, feel free to follow this forum thread for any progress on the matter.
Showing posts with label paypal. Show all posts
Showing posts with label paypal. Show all posts
Saturday, March 24, 2012
AuthNet iOS Integration Part 2
There are quite a few gaps in the sample code provided by AuthNet, we will discuss the logs indicating the problem and what chunk of code needs to be added/removed to get to a complete sample that works. This blog entry assumes that you've cleared the challenges of adding AuthNet binaries to your Xcode project. If not then have a peek at AuthNet iOS Integration Part 1 before continuing.
AuthNet iOS Integration Part 1
- You can start with the official instructions to get an account with Authorize.Net and download their iOS SDK. Afterwards the instructions are bit out of date, so you can follow along below.
- After you download and unzip the SDK, you can move the files around to have them structured in this manner:
-
The structure above has the following pros:
- Clarity around which version has been downloaded and in use at any point of time: anet_ios_sdk-X.X.X
-
If you work long enough to have multiple versions, then having them in your repository (assumption - GIT repo) helps figure out any migration issues
- $(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib/
- $(SRCROOT)/anet_ios_sdk-1.0.1/ANMobilePaymentLib/
- $(SRCROOT)/anet_ios_sdk-1.0.2/ANMobilePaymentLib/
- ...
- $(SRCROOT)/anet_ios_sdk-X.X.X/ANMobilePaymentLib/
-
Goto MyProject > Targets > Build Settings in Xcode and set:
-
Header Search Paths
- "${SDK_DIR}"/usr/include/libxml2
- Mark the Recursive checkbox as checked
- "$(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib"
- "${SDK_DIR}"/usr/include/libxml2
-
Library Search Paths
- "$(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib"
-
Other Linker Flags
- -lxml2
-
Header Search Paths
-
Drag & Drop the ANMobilePaymentLib.xcodeproj file from a Finder window into Xcode under MyProject.
- If you don't follow this step then you will face compilation issues like:
-
Goto MyProject > Targets > Build Phases in Xcode and set:
-
Link Binary With Libraries
- libANMobilePaymentLib.a
-
Link Binary With Libraries
- For a discussion on the fixes to the sample code, head over to AuthNet iOS Integration Part 2
Subscribe to:
Posts (Atom)