2010-07-22 49 views
32

Tôi có danh sách các sản phẩm mà tôi muốn thêm nút "thanh toán ngay bây giờ" để tôi có thể cho phép khách hàng thanh toán qua Paypal.Thanh toán cho nhiều mặt hàng (cùng một lúc) qua paypal

Tôi đã trải qua tài liệu và không thể tìm thấy cách thực hiện việc này. Tôi có thể thêm nhiều mục, nhưng điều này sẽ không tiện dụng vì tôi đã có danh sách các mục cần xử lý. Tôi cũng cần quy trình thanh toán để phân loại đơn đặt hàng, vì vậy, "mua ngay bây giờ" với 1 giá cũng không tốt.

Bất kỳ giúp đánh giá cao guys, tôi đã cố gắng (không có may mắn):

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
<input type="hidden" name="cmd" value="_cart"> 
<input type="hidden" name="business" value="[email protected]"> 
<input type="hidden" name="lc" value="GB"> 
<input type="hidden" name="item_name" value="test 1"> 
<input type="hidden" name="item_number" value="1"> 
<input type="hidden" name="item_name2" value="test 2"> 
<input type="hidden" name="item_number2" value="2"> 
<input type="hidden" name="item_name3" value="test 3"> 
<input type="hidden" name="item_number3" value="3"> 
<input type="hidden" name="amount" value="99.00"> 
<input type="hidden" name="currency_code" value="GBP"> 
<input type="hidden" name="button_subtype" value="products"> 
<input type="hidden" name="no_note" value="0"> 
<input type="hidden" name="add" value="1"> 
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest"> 
<input type="image" src="https://www.paypal.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.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> 
</form> 

Trả lời

66

Xem mẫu này và thực hiện những thay đổi của bạn cho phù hợp. Về cơ bản, thêm dấu gạch dưới vào tên mục trước số và đặt tên duy nhất cho số tiền cũng với dấu gạch dưới và số.

Bạn phải cung cấp số tiền cho mỗi mục dựa trên tổng số giỏ hàng của bạn.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
<input type="hidden" name="cmd" value="_cart"> 
<input type="hidden" name="upload" value="1"> 
<input type="hidden" name="business" value="[email protected]"> 
<input type="hidden" name="currency_code" value="USD"> 

<input type="hidden" name="item_name_1" value="beach ball"> 
<input type="hidden" name="amount_1" value="15"> 

<input type="hidden" name="item_name_2" value="towel"> 
<input type="hidden" name="amount_2" value="20"> 

<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> 
</form> 

Xác định lượng (không bắt buộc)

<input type="hidden" name="quantity_1" value="1"> 
+0

Bạn chỉ định số lượng khác nhau cho mỗi mục như thế nào? –

+1

@JosephPersie Tôi đã cập nhật câu trả lời. Ngoài ra, hãy xem liên kết này để có câu trả lời chi tiết hơn https://www.paypal-community.com/t5/About-Selling/how-do-i-add-a-quot-quantity-quot-option-to-my- button-ie-5-x/td-p/480148 – Codex73

0

nó sẽ không làm việc trong

<input type="hidden" name="cmd" value="_xclick-subscriptions"> 

vui lòng cập nhật cho tôi nếu bạn biết nhiều tùy chọn thanh toán mục trong phương thức thanh toán định kỳ hoặc trong bất kỳ cách tôi có thể thêm thuế trong phương pháp này.

+1

Nó phải là '_cart' thay vì' _xclick-subscriptions' – Pankaj

0

Nút PayPal Thêm vào giỏ hàng giúp bạn chấp nhận thanh toán cho nhiều mục. Nút HTML sẽ như sau.

<form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
<input type="hidden" name="business" value="[email protected]"> 
<input type="hidden" name="cmd" value="_cart"> 
<input type="hidden" name="add" value="1"> 
<input type="hidden" name="item_name" value="PHP Book"> 
<input type="hidden" name="item_number" value="PB123"> 
<input type="hidden" name="amount" value="25"> 
<input type="hidden" name="currency_code" value="USD"> 
<input type='hidden' name='cancel_return' value='http://www.example.com/cancel.php'> 
<input type='hidden' name='return' value='http://www.example.com/success.php'> 
<input type="image" name="submit" 
src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_addtocart_120x26.png" 
alt="Add to Cart"> 
<img alt="" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif"> 
</form> 
Các vấn đề liên quan