PayPal / Testing & API Responses
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
Let's take a look at our Text MXML Application. First I'm creating a form and adding all the inputs that will be needed to collect the User's Name, Address and Credit Card Details. These different form items are given inputs with descriptive ID's. Then at the end of the form the user is provided with a button to actually kick off the test and set it into motion. Down in an ActionScript Block beneath the MXML Code I've got the Do Test Function which is called when the user clicks the Test Button. As you can see we've got a transaction that's instantiated in our application, when the Do Test Function is called this transaction is populated with the details that the user entered in the form. Once all of these details have been passed to the Transaction Class the Transaction's Send Method is called. When the Send Method is called all these details are placed into Post Variables as we saw in the last video and sent to our Direct Payment Proxy. PHP File. When the PHP Script contacts PayPal sending the details we're going to get back either a success or a failure message. Let's take a look at what the failure message looks like first so we'll know how to deal with it. Remember that since we're tracing the response you'll need to run this application in Debug Mode to get the debug output to the console. If you were to run the application and call it with incomplete information or wrong information you would get an Array that looks like this in your console output as the data property of our URL loader complete event. The most important thing to note in your failure message is probably going to be the error code. You can use this error code to look up the actual problem either on the PayPal website in the API Documentation or in another script either in your ActionScript application or on your server so that you can display the diagnostic message to the user and give them clues about how they can correct it. If however you have a success this is the output you'll see in the console, you'll also get a Transaction ID which is unique to your transaction along with a Timestamp and some other information. You can also do more advanced interactions such as fraud prevention and warnings and these are detailed in the API Documentation on the PayPal Developer Site. Let's run our application in debug Mode and see what happens. You might want to go get a snack or do your Taxes while I fill out this form and then come back when we get the Console output. Click the Test Button and when the response comes back you get your traced output to the console.
Tutorial Information
| Course: | MasterClass! - ActionScript 3 & Payment Gateway APIs |
| Author: | Richard Bates |
| SKU: | 34014 |
| ISBN: | |
| Release Date: | 2009-07-08 |
| Duration: | 1.5 hrs / 19 lessons |
| Captions: | For Online University members only |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 