Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Express PayPal Checkout - How To?


dailce

Recommended Posts

Hello,

 

I have PayPal IPN Shopping Cart installed and it's working great, but what I have noticed is that there are over 50 customers and only 30 order so far in my site. I think that many people register and during checkout they give-up or don't know much about paypal.

 

I looking to have the following done but don't know how to do it:

 

1. (Default) Buyer clicks cart contents, and they are brought to the cart page that displays what's in the cart. The total is also displayed.

 

2. Next they click checkout and are brought to the login/create account page. I have a really small shop so creating an account or order in the admin is not really necessary for ALL orders because I know that many people do create accounts.

 

At this point I want there to be an additional horizontal box: "the one displayed during check out with the PAYPAL IPN shopping cart showing the PayPal info, plus my own little note explaining wht it would be better to create an account and that this is only an express checkout".

 

Now what code would I need to retreive the flat shipping rate I use, and items so that they can be used in the paypal button?

 

I think this can be done buy including a simple paypal buy now button, that would use the total and shipping for the checkout, I just need some help or ideas.

 

Thanks

Link to comment
Share on other sites

HERE IS THE CODE FOR THE PAYPAL BUTTON.

 

 <script type="text/javascript" src="order.js"></script>
                               <FORM name = "paypal" action="https://www.paypal.com/cgi-bin/webscr/" method="post" onsubmit = "return Process (this);">
                                   <p>
                                     <input type="hidden" name="cmd" value="_xclick">
                                     <input type="hidden" name="business" value="[email protected]">
                                     <input type="hidden" name="item_name" value="ITEMXXXXX">
                                     <input type="hidden" name="item_number" value="XXXXXXXX">
                                     <input type="hidden" name="amount" value="79.99">
                                     <input type="hidden" name="shipping" value="8">
                                     <INPUT TYPE="hidden" NAME="tax" VALUE="0">
                                     <input type="hidden" name="return" value="http://www.XXXXXXX.ca/orderpass.htm">
                                     <input type="hidden" name="cancel_return" value="http://www.XXXXXX.ca/orderfail.htm">
                                     <input type="hidden" name="currency_code" value="USD">
                                     <strong>Select Quantity:</strong>
                                     <INPUT name="quantity" type="text" value="1" size="6">
                                   </p>
                                   <p><span class="style1">Shipping Location: </span>
                                       <select name= "taxer" id = "taxer" onchange = "SetTX (this);">
            <option value="0" selected>U.S.A or International</option>
                                         <option value="15">Ontario (15% GST/PST)</option>
                                         <option value="7">Other Canada (7% GST)</option>
                                         <option value="15">NL, NS, NB (15% HST)</option>
                                       </select>
                                   </p>
                                 <p>
                                   <input name="submit" type="image" src="images/x-click-but23.gif" alt="Make payments with PayPal - it's fast, free and secure!" width="101" height="35" border="0">
</p>
</form>

 

 

 

The JAVA SCRIPT CODE NEEDED

 

	var taxp = 0; // tax percent for this order

function Process (obj1) { // process the form, but no submit
 var i,j,bqty,bamt,ttax;
   
 bqty = obj1.quantity.value; // selected quantity
 //check if quantity is valid
 if (isNaN(bqty) || bqty == "" || bqty < 1) {
	 alert ("Changing Quantity to 1");
	 bqty = 1;
	 obj1.quantity.value = "1";
 }
 bqty = bqty*1.0; //float that sucker
 bamt = obj1.amount.value * 1.0; //get amount
 
 var ttax = taxp/100.0; // yep - calculate it.
 var unformatted_tax = ttax * (bamt * bqty);
 var format_tax = fmtPrice(unformatted_tax);
 obj1.tax.value = format_tax;
}
 
function fmtPrice(value) {
 var result = Math.floor(value)+".";
 var cents = 100*(value-Math.floor(value))+0.5;
 result += Math.floor(cents/10);
 result += Math.floor(cents%10);
 return result;
}

function SetTX (obj1) { // Set tax percent for this order
 var pos;
 pos = obj1.selectedIndex; // which item selected
 taxp = obj1.options[pos].value*1.0; // float it
}

 

Now I tested this code in html and it works, but how do I modify it so it can be used in the express checkout I speak of above.

 

Instead of using Javascript could I make calls to the totals currency item etc... HOW?????

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...