Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 836
  • Last Modified:

Sending variables to Paypal using Flash CS4

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
brucegust
Asked:
brucegust
  • 2
  • 2
1 Solution
 
sjklein42Commented:
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
 
brucegustAuthor Commented:
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
 
brucegustAuthor Commented:
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
 
sjklein42Commented:
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now