A Flash Developer Resource Site

Page 6 of 6 FirstFirst ... 23456
Results 101 to 118 of 118

Thread: Flash and Paypal?

  1. #101
    Junior Member
    Join Date
    Jan 2008
    Posts
    3
    Whispers - I realize this post is a little old, but I'm hoping you still monitor it. I'm an animator, so I'm good with Flash, but am new to Actionscript, so I haven't learned arrays yet. Could you show me how to setup the cartArray? Thanks!


    [QUOTE=whispers]

    PHP Code:
    //Loop through the array for product details;
    for (var 0i<cartArray.lengthi++) {
        var 
    num i+1;
        
    payPal["item_name_"+num] = cartArray[i].name;
        
    payPal["quantity_"+num] = cartArray[i].quantity;
        
    payPal["amount_"+num] = cartArray[i].amount;
        
    payPal["on0_"+num] = "Color: "+cartArray[i].color;
        
    payPal["on1_"+num] = "Size: "+cartArray[i].size;        


  2. #102
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    well if you are new to arrays you should read up on them.. and how they work..

    think of it as a 'container' (or better yet a reference) to a number of indexed items.

    so you have an array (container/reference)

    var referenceArray:Array = new Array();

    that just declares (creates) a new array and gives it the reference name of: referenceArray.. so anytime you see referenceArray it means this indexed array of items.

    now you need to populate the array.. many ways

    referenceArray[0]="Item 1";
    referenceArray[1]="Item 2";
    referenceArray[2]="Item 3";

    thing to note/know if that all array indexes start with 0 (called zero based arrays)

    so if I call

    someTextField.text = referenceArray[0];

    that text field will have: "Item 1" displayed in it..

    someTextField.text = referenceArray[1];

    results in Item 2 being displayed.. and so on.

    this is how you use a basic array.. they are great to use with loops.. and once you get the hang of them..XML will be a snap as well..

    NOW..the above array is an object array.. meaning the array has an OBJECT in each slot/index

    an object is its own 'entity' and have its own properties you can access.

    So I created an array

    var cartArray:Array = new Array();

    and I populated it with an OBJECT ..

    this object is my product object.. that contains name, color, size..etc for that object.

    I push/add one object to the array for each product I 'purchase' (add to cart)

    to do that:

    //create array
    var peopleArray:Array = new Array();

    //populate it with object
    peopleArray.push({name:"Some name1", age:"26"});
    peopleArray.push({name:"Some name2", age:"16"});
    peopleArray.push({name:"Some name3", age:"28"});



    you have now just made an object array...

    and you can access the data like so:

    someTextField.text = peopleArray[0].name;
    someTextField.text = peopleArray[1].name;
    someTextField.text = peopleArray[2].name;

    hope this helps...

  3. #103
    Junior Member
    Join Date
    Jan 2008
    Posts
    3
    Thanks for the quick response. I'll give it a try if I ever get Flash MX working again. This is definately the wrong place to post this question, but perhaps you can help; all of a sudden "Test Movie" isn't working correctly. Parts of my actionscript aren't working at all. The strange thing is that everything works fine if I publish the swf, but for some reason it just won't work within MX's Test Movie. Any ideas?

  4. #104
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    have you tried to re-boot?

    or maybe un-install and re-install the FLASH PLAYER??

    as a last resort.. try re-installing Flash again..

  5. #105
    Junior Member
    Join Date
    Jan 2008
    Posts
    3
    Rebooted and re-installed everything, then rebooted again. Didn't work. Looks like my Flashing is on hold for now. It's weird though, it just all of a sudden stopped working, I never changed any settings or anything. Sucky.

  6. #106
    + Kaco's Avatar
    Join Date
    Sep 2003
    Location
    Mexico town
    Posts
    493
    hi, I downloaded the Flash Paypal Button by levelfourdesigns and what this does is send the paypal variables over to paypal AND send you to the paypal shopping cart right away, what i am trying to do is to make 2 different buttons, one that adds the item to the cart, and another that proceeds to the checkout. I tried changing some of the code on the button but nothing happens, to be honest I've no idea what I'm doing.


    Any help is greatly appreciated

  7. #107
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    well the "CART" part is nothing to do with PayPal really.. is JUST an array on the flash side... when you are all done.. you send the WHOLE array over.. instead of just one product..

  8. #108
    + Kaco's Avatar
    Join Date
    Sep 2003
    Location
    Mexico town
    Posts
    493
    I browsed over some of your older posts. Let's see if I understand this a bit...


    OK, I think this would be the "add to cart" button code?

    Quote Originally Posted by whispers
    PHP Code:
    paypalVars = new LoadVars();

    paypalVars.cmd "_cart"//required PayPal var 
    paypalVars.business "emailforpaypal@whatever.com"//required PayPal var (use your email associated with PayPal)
    paypalVars.item_name "XBOX_360";//required PayPal var
    paypalVars.currency_code "USD"//required PayPal var
    paypalVars.amount "350.00"//required paypal var total amount to send to PayPal

    payPal.send("https://www.paypal.com/cgi-bin/webscr""_blank""POST"); 
    at the end of the code above there's this bit of code which sends the item info to paypal and takes you to the paypal checkout page? how can i make it so it only sends the item info without opening paypal checkout?

    can i have a separate button that takes you to the checkout page?




    this is where all the different item info is stored before sending it over to paypal? Would this be on the same frame as the "add to cart" buttons?

    Quote Originally Posted by whispers

    PHP Code:
    //Loop through the array for product details;
    for (var 0i<cartArray.lengthi++) {
        var 
    num i+1;
        
    payPal["item_name_"+num] = cartArray[i].name;
        
    payPal["quantity_"+num] = cartArray[i].quantity;
        
    payPal["amount_"+num] = cartArray[i].amount;
        
    payPal["on0_"+num] = "Color: "+cartArray[i].color;
        
    payPal["on1_"+num] = "Size: "+cartArray[i].size;        


  9. #109
    + Kaco's Avatar
    Join Date
    Sep 2003
    Location
    Mexico town
    Posts
    493
    *bump

  10. #110
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    If you want to do it that way... you will need to use the DirectPayment (or whatever they call it) API/method to do so...

    the above code was done before that (Direct) was available.. and that is what (I believe) they call "Express Checkout"

    I havent really dug into doing it the new way..

    but maybe we can work on it together.. shouldnt be too hard..

    I suggest you going to the PayPal Dev forum and searching.. getting answers there can be along wait though..

    but there is stuff to search through that may be of some help.

    I think you need to so some PayPal upgrades (free I think) to your account..upgrade to a business account.. and register for a sandbox ID to test with..

    but dont quote me..

  11. #111
    Junior Member
    Join Date
    Jun 2008
    Posts
    1
    There is a PayPal Button generator for ActionScript at www.website-dev.com

    Also has a script generator for Mal's E-commerce, so PayPal Express Checkout and Pro can work with Flash easily using that

  12. #112
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Id like to know/talk more about the PRO option with PayPal..

    anyone have any knowledge of it? Im really un-sure how you can have a button generator for the PRO option?

    Her are some questions I have: and this ONLY applies to PRO/DIRECT payment.. not the Express where you are taken to the PayPal site.. so dont even include it in any responses.


    1.) can this be used with JUST Flash..? (ie: no PHP script in between?) I have been told yes..but have seen no examples??

    Using a simple sendAndLoad(); in flash....yes? and since it looks as if the returned vars form PayPal are in a flashVar format.. Flash should be able ot read it latently.....yes or no?


    2.) what are the REQUIRED VARS NEEDED to be sent to PayPal on each 'transaction'?

    3.) what is a list of OPTIONAL VARS you can send?

    It was laid out so much easier with the Express checkout.. pass in some vars to a url.. done deal.. and the documentation was very 'to the point'..

    I think the Dev Group is severely lacking.. search sucks, and the 'replies' are half arsed, with people only linking to know examples mostly... from what I remember..

    anyone got some input on these questions?


    I'll start:

    required vars:

    IP (i think)
    cc#
    cc expy
    name

  13. #113
    Junior Member
    Join Date
    Nov 2008
    Posts
    1
    i am writing a Flash website that will allow users to purchase Digital Documents using PayPal.

    Does anybody out there know to achieve this?

    i am guessing that one solution is for the user to make the PayPal payment and when that is successful - email the document to them and if not successful display a HTML page stating that it is unsuccessful.

    is this a good approach?
    how do i detect the payment is successful or unsuccessful?

    thanks

  14. #114

  15. #115
    Member
    Join Date
    Sep 2003
    Location
    Seattle
    Posts
    54
    luwunu,
    the method you described is the 'easiest' solution but not really user friendly for the customer. Customers are accustomed to being able to download their product minutes after purchasing it, so you may lose customers if you don't provide that same level of service. With that said, depending on your level of AS and PHP knowledge, it can be rather difficult to manually set up a situation where an email containing a download link is automatically sent to a customer after their paypal payment is confirmed. If you don't want deal with the coding I'd recommend adding a 3rd party shopping cart that has this service built in. As Whispers suggested you should visit the Paypal site and learn more about the process. HTH.

  16. #116
    Member
    Join Date
    Apr 2001
    Posts
    58

    flash and paypal

    I agonized over this and found this perfect link- exactly what you need.

    http://www.paypaldeveloper.com/pdn/b...id=29461#M2067

    if you go to paypal/business/merchant/ then website payment standards. once you register as a business account it will let give you the html code. The above link will translate into actionscript.

  17. #117
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    I suggest you look into the PRO option..this way you do NOT have to even have the customer leave the site.. and you can get a call back saying if the transaction was a success or not.. and based on the return supply them with an email or a link directly..

  18. #118
    Junior Member
    Join Date
    Nov 2008
    Posts
    2
    ok, i know this post is like four years old, but i'm hoping anyone who can help is still alive. It looks as though all of this code is for AS2. I am currently making a website for my father's art business in AS3. Does anyone know of anywhere I can get my hands on some AS3 paypal code??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center