Solved

Sending variables to Paypal using Flash CS4

Posted on 2011-02-14
4
827 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

911 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

20 Experts available now in Live!

Get 1:1 Help Now