# Paypal hosted buttons

**URL:** <https://forum.kirupa.com/t/paypal-hosted-buttons/288650>\
**Category:** Uncategorized\
**Created:** [May 19, 2009, 12:38pm UTC](https://forum.kirupa.com/t/paypal-hosted-buttons/288650 "2009-05-19T12:38:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deborah](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@Deborah](https://forum.kirupa.com/u/Deborah)\
**Post date:** [May 19, 2009, 12:38pm UTC](https://forum.kirupa.com/t/paypal-hosted-buttons/288650/1 "2009-05-19T12:38:47Z")

</div>

Hi,

This code is posted in several places saying it works with paypal. For some reason, for me, it does not work - I get to paypal’s homepage instead. However, the same code (sort of) works if I just use a straight html page. I don’t get it.

AS3

```auto

addcart.addEventListener(MouseEvent.CLICK, addItem);

function addItem (event:MouseEvent):void
{
var url:String = 'https://www.paypal.com/cgi-bin/webscr';
var request:URLRequest = new URLRequest(url);
var paypal:URLVariables = new URLVariables();
paypal.cmd='_s-xclick';
paypal.hosted_button_id='5529701';
paypal.instanceName='addcart';

request.data = paypal;
request.method = URLRequestMethod.POST;
navigateToURL(request, '_blank');
}

```

HTML

```auto

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="5529701">
<input type="image" src="http://www.kiwemail.com/images/button.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
</form>

```
