Solved

Sending variables to Paypal using Flash CS4

Posted on 2011-02-14
4
826 Views
Last Modified: 2012-08-14
I've got to convert a button that I've built into one whose script accommodates the posting of variables to Paypal. I've done this before, but I'm stuck.

Here's my code:

on (release) {
      getURL("https://www.paypal.com/cgi-bin/webscr", "_blank", "POST");
}
0
Comment
Question by:brucegust
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:sjklein42
Comment Utility
I think you're basically there.  Use argument getURL's fourth argument to pass the POST CGI parameters.  Concatenate them with "&" characters.

PayPal has documented a long list of webscr CGI parameters which you are probably already familiar with.

If you're submitting an order by redirecting to PayPal, for example, the request would look like this:

 getURL("https://www.paypal.com/cgi-bin/webscr", "_blank", "POST",
    "cmd=_xclick&cn=MyCompany&invoice=123......"  );

PayPal should pop up in a new window with prepopulated fields based on your CGI parms.
0
 

Author Comment

by:brucegust
Comment Utility
Hey, friend!

I'm missing it somehow. I took your code as it was documented above (and you probably just meant it as a starting point), but I got this error:

Wrong number of parameters: getURL requires between 1 and 3

What am I missing?
0
 

Author Comment

by:brucegust
Comment Utility
Basically, what's happening is when I try to introduce the variables, I'm getting hung up.

How do I declare a variable? I'm used to ASII, ASIII is throwing me, I guess...
0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 total points
Comment Utility
After checking some of my code, I see that I use LoadVars.send instead of getURL.  Here's an example.  The idea is that all the variables in the LoadVars structure are packaged up as POST parameters and sent as part of the request.  So first create a LoadVars structure, populate it with your POST parameter name/value pairs, and Send it.  I hope this gives you some direction.

http://www.flash-here.com/tutorials/flash_loadvars_sample.html

var sender = new LoadVars();

sender.x = "xxx";

sender.y = "yyy";

sender.z = "zzz";

sender.send("http://www.paypal.com/cgi-bin/webscr", "", "POST");
 

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now