Solved

Sending variables to Paypal using Flash CS4

Posted on 2011-02-14
4
832 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:sjklein42
ID: 34893541
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
ID: 34902408
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
ID: 34902418
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
ID: 34902707
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
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 how to record live broadcast.

734 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