A Flash Developer Resource Site

Page 2 of 6 FirstFirst 123456 LastLast
Results 21 to 40 of 118

Thread: Flash and Paypal?

  1. #21
    Senior Member
    Join Date
    Sep 2003
    Posts
    303

    That would be perfect~

    I would love that. If I can view the coding, it would be much easier for me to figure out how it all works. This site is a good example of what I'm trying to achieve: http://www.dish-designs.com/home.htm

    Thanks!
    Furpants

  2. #22
    Senior Member
    Join Date
    Jun 2003
    Location
    Kent, WA
    Posts
    536
    Okay, here's the function I have. Bear in mind that this is being handled the way I'm storing records internally within Flash; you'll very likely have to loop through your cart differently.

    Code:
    function checkout() {
    	checkMC = new LoadVars();
    	checkMC.rand = random(99999);
    	checkMC.cmd = "_cart";
    	checkMC.upload = "1";
    	checkMC.business = "sendto@email.com";
    	checkMC.currency_code = "USD";
    	checkMC.amount = total.text.substr(1, total.text.length-1); //amount in decimal (eg 32.45)
    	for (var i = 0; i<cartRef.records.length; i++) {
    		var num = i+1;
    		checkMC["item_name_"+num] = cartRef.records[ i].part; // part name
    		checkMC["quantity_"+num] = cartRef.records[ i].quantity; // part quantity
    		checkMC["amount_"+num] = cartRef.records[ i].price; // part price
    		checkMC["on0_"+num] = "Unit price: $"+cartRef.records[ i].price; // optional field 1
    		checkMC["on1_"+num] = "Count: "+cartRef.records[ i].count; // optional field 2
    	}
    	checkMC.send("https://www.paypal.com/cgi-bin/webscr", "_blank", "POST");
    }
    Basically, item_name_X, quantity_X, and amount_X are the important things for each item. X must start at 1 and increase sequentially.
    Last edited by marshdabeachy; 08-12-2005 at 12:04 AM.

  3. #23
    Senior Member
    Join Date
    Sep 2003
    Posts
    303

    You're awesome, Thanks~

    Just what I needed~

  4. #24
    Junior Member
    Join Date
    Aug 2005
    Posts
    6

    So close, yet...

    First off, thank you marshdabeachy, I've been looking for this code for days. Also, I love your site. Very nice.

    My problem is in using that code on the site I'm currently building for myself. I only have two items to sell so I just list all the variables to send instead of using the for loop. The proplem is that when the quantity variable for either item is equal to zero, paypal gets cranky and gives a page that says the shopping cart is empty. Here's my site, very much still being created... http://www.nicholaskoby.com
    and here's the code I use on my checkout button...

    on (release) {
    payPal = new LoadVars();
    payPal.rand = random(99999);
    payPal.cmd = "_cart";
    payPal.business = "nick@nicholaskoby.com";
    payPal.currency_code = "USD";
    payPal.upload = "1";
    payPal.amount = (orderform.grandTotal + ".00");

    payPal.item_name_1 = "Caffeinated";
    payPal.quantity_1 = orderform.quantity1;
    payPal.amount_1 = "13.00";
    payPal.item_number_1 = "DR-001";

    payPal.item_name_2 = "Dirty Martini";
    payPal.quantity_2 = orderform.quantity2;
    payPal.amount_2 = "15.00";
    payPal.item_number_2 = "DR-002";

    payPal.send("https://www.paypal.com/cgi-bin/webscr", "_blank", "POST");
    cart.gotoAndPlay("checkout");
    }




    Please help! Any ideas?

  5. #25
    Junior Member
    Join Date
    Aug 2005
    Posts
    6

    oops...

    forgot to add email notification... that's better.

  6. #26
    Senior Member
    Join Date
    Jun 2003
    Location
    Kent, WA
    Posts
    536
    Just disregard the record if the quantity is set to 0. For example...

    Code:
    if (orderform.quantity1 > 0) {
       payPal.item_name_1 = "Caffeinated";
       payPal.quantity_1 = orderform.quantity1;
       payPal.amount_1 = "13.00";
       payPal.item_number_1 = "DR-001";
    }
    Of course, if the first item has a quantity set to 0, then it will skip record 1. I'm not sure how Paypal will react if don't provide the records in order. In case it gets cranky, you'll have to add an iterator that will keep things in order...

    Code:
    var iter = 1;
    if (orderform.quantity1 > 0) {
       payPal["item_name_"+iter] = "Caffeinated";
       payPal["quantity_"+iter] = orderform.quantity1;
       payPal["amount_"+iter] = "13.00";
       payPal["item_number_"+iter] = "DR-001";
       iter++;
    }
    Do that same type of thing for the other one, should work just fine.

  7. #27
    Junior Member
    Join Date
    Aug 2005
    Posts
    6

    perfect

    Bloody brilliant! You just saved me many many frustrated hours. I still had some issues until I realized exactly what the iter variable is for, and deleted the line where I reset it between items.

    Thanks!

  8. #28
    Junior Member
    Join Date
    Aug 2005
    Posts
    6
    Marshdabeachy, could I ask just one more question of you? The Background Selector experiment on your web site... I've been trying to do something similar with mouseover buttons and a slidding menu for an mp3 player on my site. Having a very hard time figuring it out, the cool physics-like slidding I mean. Don't suppose you could point me to any tutorials or even concepts used to get me going in the right direction?

  9. #29
    Junior Member
    Join Date
    Oct 2005
    Posts
    1
    Hi guys,

    I am using the variables as set above to use a simple buy now button. The only issue I am having is with the return url

    I have it set as payPal.return =
    "http://www.mysite.co.uk/payment-successful.php";

    It works fine for the cancel one where the code is =
    payPal.cancel_return = "http://www.mysite.co.uk/error.php";

    It is an issue to do with the return variable but that is set by Pay Pal.

    Any ideas?

    Cheers,

    Neil
    Last edited by nasal69; 10-18-2005 at 12:32 PM.

  10. #30
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Sorry to drudge up such an OLD thread..but there isnt much here besides this one.

    post# 24:

    can I ask if the "amount" var
    code:

    payPal.amount = (orderform.grandTotal + ".00");



    is needed when you are passing in the individual amount per item like that??

    trying to get mine working...but want to hardcode some stuff to test..then work on looping through.

    Thanks


    also how would be the best way to "loop" through these cart values?

    I see the above loop example..but Im not sure where hes getting his values from or how they are formatted.

    would I make some sort of internal ARRAY?

    cartTotalItems = ""; //increment x by 1's each add to cart (to get totalProds)
    cartTotalPrice=""; //sum of ALL product prices.
    cartItemNames = [];
    cartQuantity=[];

    etc..etc..


    having alittle trouble getting my head around the logic here.. Im not great with loops yet...but Im sure I can loop through an array to pull my data...

    I guess Im having trouble setting up my data to get to that point..

    suggestions?...

    thanks

  11. #31
    Senior Member pixelpusher84's Avatar
    Join Date
    May 2004
    Posts
    186
    chec out http://anyrd.anyorganization.com/home.html

    great price, and it works pretty well

  12. #32
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Thanks...but I dont want to "BUY" anything...(theres really no need)...

    I can just send everything in a _POST method varObject.

    (hence my questions)... but thanks.

  13. #33
    Member
    Join Date
    Mar 2004
    Location
    michigan
    Posts
    92
    now im making a website selling t shirts and i want to have radio buttons,to click the shirt size and then use paypal to pay how could i pull this off? im not too grand at actionscript so any help is amazing, thanks in advance

  14. #34
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    I am actually rescripting my cart to be free standing, and it will be released as open source when it is done.

    I can help ya with the radio buttons also.

  15. #35
    Senior Member
    Join Date
    Mar 2001
    Posts
    536
    Are you making a Flash Cart?

    Quote Originally Posted by N_R_D
    I am actually rescripting my cart to be free standing, and it will be released as open source when it is done.

    I can help ya with the radio buttons also.

  16. #36
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Quote Originally Posted by N_R_D
    I am actually rescripting my cart to be free standing, and it will be released as open source when it is done.

    I can help ya with the radio buttons also.

    N_R_D -
    what do you mean by 'free standing'??


    also...
    you would use radio buttons...the same you would anything else, on click of the radioButton it just sets the SAME variable to have a different value.

    I coudl show you a "crude" demo, using comboBoxes.

    has a 'store' of shirts to pick from (all loaded/populated through XML)
    you can 'buy' as many shirts as you want and it adds it to your 'cart'...you can delete products from the cart before final check out...

    since this was only a DEMO for testing...when you actually add a product to the cart the cart is right on top of the 'shopping' page... I didnt make it a seperate section...so its kind of ugly ... but functional.

  17. #37
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    Yeah I made a fully functional flash cart to use with paypal.....

    ala

    http://www.dp-labs.com/clients/fu/solidreality/

    but I put som much stuff in it to make it work with that site that it is dependant of it.

    I am working on converting it over so that it will be drop and play component style.

  18. #38
    I am not an expert
    Join Date
    Aug 2005
    Posts
    175
    please explain me the whole working of online payement and whats is the minimum requrement of information need to send to paypal to know from which site or user the request has come from. and how the merchant gets his/her payment. plz give me information about this as handling data in flash is not a problem for me but the next thing to do after knowing what user wants to purchase and and its cost information how to pass this information to paypal to accept the payement and notify us that the payment has been made by the purchaser and the goods or services need to be render now

  19. #39
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Did you read the thread?? Or check out any of the links here? you will have to go to PayPal site..(link is posted here already) on how to format and what vars to use to pass the data to PayPal....

    https://www.paypal.com/us/cgi-bin/we...howto_checkout

    must be logged in to view it.

  20. #40
    Member
    Join Date
    Mar 2004
    Location
    michigan
    Posts
    92
    whispers im interested in the crude demo of yours

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