6 Replies Latest reply on Jul 17, 2007 8:24 AM by africanshox

    Flex 2 paypal

    Matt1112222333
      Hello,

      I am relatively new to flex 2, could someone help me implement a paypal button into flex2? I have little idea how to start unfortunately :( would it be a httpservice?

      Thanks in advance.
        • 1. Re: Flex 2 paypal
          Matt1112222333 Level 1
          I have a attempted a solution using the code below, which paypal recieves but doesn't understand unfortunately, would anyone know if I need to change the data type that's being sent? or what I need to do from here?

          <mx:Script>
          import flash.net.*;
          public function openNewWindow():void {

          var url:URLRequest = new URLRequest("https://www.paypal.com/cgi-bin/webscr");
          var uv:URLVariables = new URLVariables();
          url.method = "POST";
          uv.cmd = "_xclick";
          uv.business = "email@address.com";
          uv.item_name = "test";
          uv.item_number = "1";
          uv.amount = "10.00";
          uv.no_shipping = "0";
          uv.no_note = "1";
          uv.currency_code = "GBP";
          uv.lc = "GB";
          uv.bn = "PP-BuyNowBF";
          url.data = uv;
          url.contentType = "xml";

          navigateToURL(url,"_blank");
          }
          </mx:Script>
          • 2. Re: Flex 2 paypal
            Matt1112222333 Level 1
            It appears the problem may be with the encoding type, can someone help me with what encoding types there are, or how to send it uncoded?
            • 3. Re: Flex 2 paypal
              Robert Hirst Level 1
              That code you sent works perfectly for me. I just copied some form vars from a website i play an online game on, and ran the request, and it popped up the item and even let me complete the purchase right through to the notification back to the site that the sale was complete.

              Have you tested with a html form and copied the POST vars exactly as you had them on the form? Does it work that way?
              • 4. Flex 2 paypal
                Matt1112222333 Level 1
                Cold you please send me the exact code you used which worked?

                These cvars are copied from html (and the html works fine), but I cannot get it to work via flex.
                • 5. Re: Flex 2 paypal
                  Matt1112222333 Level 1
                  Ahh, have sorted the problem, for some reason it was because I running it from a local host, as soon as it was hosted on a webserver it worked.

                  Which is incredibly annoying, I've lost count of the number of hours I've been searching for a solution for it, lol, but at least it works :).
                  • 6. Re: Flex 2 paypal
                    africanshox
                    can i ask in relation to paypal....i want to be able to post multiple items to a basket instead of single items as your example shows. how could this be done?