问题
For example item price is £6.78 postage and packaging should be:
Single copy: £1.50 2-3 copies £3.00 4-6 copies: £4.00 7-8 copies: £5.00 9 copies: £6.00 10 or more free
Any idea how I can do this? The current code for the item is:
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="CUWB7BQEL337J">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
I read somewhere that I need to do something like:
<input type="hidden" name="shipping" value="1.50">
<input type="hidden" name="shipping2" value="3.00">
<input type="hidden" name="shipping3" value="3.00">
<input type="hidden" name="shipping4" value="4.00">
<input type="hidden" name="shipping5" value="4.00">
<input type="hidden" name="shipping6" value="4.00">
<input type="hidden" name="shipping7" value="5.00">
<input type="hidden" name="shipping8" value="5.00">
<input type="hidden" name="shipping9" value="6.00">
<input type="hidden" name="shipping10" value="0.00">
Where would this go as when I tried it it didn't work.
Any help appreciated.
回答1:
it looks like your on the right lines (although you might try 'shipping_1', 'shipping_2',etc. you have missed out the underscore) but you may find that you are need to send "shipping_1 = £1.00", "Quantity_1 = 2", which Paypal may interpret as 'shipping = 2 times £1.00', but I think it will assume shipping_1 is for the button item as a whole because you are using a button to specify a specific item not a bunch of items (i.e. 1 button = 1 item).
What happens if the person presses the button twice, im not sure. The only thing I've found in Paypal's documentation talks about setting up weight's for postage costs within your Paypal account, then prices per weight (i.e. 1 item weighs 1kg, cost = £1.00, 2 items weigh 2kg, cost = 2 x 1kg weight = £2.00, etc.). You could also look into this area.
I found the buttons to restictive and built my own shopping cart in my code behind including shipping costs (which I calculate), then send just one "shipping_1 = x.xx" cost to paypal along with the items details, this works fine.
I think I may add a new post on here with my working code for a shopping cart to help others, just need to tidy it up a bit. (I'll add a link from this post if your interested).
You could try referring to this page.
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/cart_upload/
Trev.
来源:https://stackoverflow.com/questions/18784100/i-need-to-create-a-custom-postage-price-depending-on-quantity-ordered-for-paypal