Skip to content

Instantly share code, notes, and snippets.

@xtrasmal
Created January 27, 2013 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xtrasmal/4648513 to your computer and use it in GitHub Desktop.
Save xtrasmal/4648513 to your computer and use it in GitHub Desktop.
AS3 PayPal Donate and Buynow
//Listeners
btDonate.addEventListener(MouseEvent.CLICK, donate);
btBuynow.addEventListener(MouseEvent.CLICK, buynow);
//Functions
function donate (event:MouseEvent):void{
var url:String = "https://www.paypal.com/cgi-bin/webscr";
var request:URLRequest = new URLRequest(url);
var paypal_donate:URLVariables = new URLVariables();
paypal_donate.cmd="_s-xclick";
paypal_donate.hosted_button_id="123456";
request.data = paypal_donate;
navigateToURL(request);
trace(paypal_donate)
}
function buynow (event:MouseEvent):void{
var url:String = "https://www.paypal.com/cgi-bin/webscr";
var request:URLRequest = new URLRequest(url);
var paypal_buynow:URLVariables = new URLVariables();
paypal_buynow.cmd="_s-xclick";
paypal_buynow.hosted_button_id="4901978";
request.data = paypal_buynow;
navigateToURL(request);
trace(paypal_buynow)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment