|
Rank: Starting Member
Groups: Registered
Joined: 2/4/2003 Posts: 10 Location: ,
|
I am trying to pass the total shipping fee from my order page to PayPal. I calculate the amount based on USPS zone and weight. I have tried the following line every which way, but I am unable to pass the shipping variable.
var shippingB=1.00
var shippingA=parseFloat(document.order15.shipping.value)
window.open('https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=jsdaniel2@yahoo.com&shipping2='+shippingB+'&shipping='+shippingA+'&add=1')
I also tried setting shipping amount equal to shipping_1. It acts as if it is not acting on this transaction. Please help.
|
|
Rank: Starting Member
Groups: Registered
Joined: 11/24/2002 Posts: 2,004 Location: ,
|
You didn't really supply enough information. Several points. What sort of error (if any) are you getting? Is it just ignoring your values? Do you have the box checked in your PayPal settings to allow shipping override?
"shippingA" and "shippingB" need to be strings in valid dollar format. Most amount variables in PayPal need to be whole integers, or 2-decimal place dollar amounts. Example, x=1.50... If x gets put into a string it is going to be "1.5" which is not a valid dollaar value.
function Dollar (val) { // force to valid dollar amount var str,pos; str = escape (val*1.0 + 0.005); pos = str.indexOf ("."); if (pos > 0) str = str.substring (0, pos + 3); return str; }
Input is number or string, output is string.
Ron.
|