贝宝脚本
我想在我的网站上仅使用一个添加到购物车 paypal 按钮,并使用 php 和 select 替换产品值。
<select name="select_stuff" id="select_stuff">
<option value="0011" >Prod1</option>
<option value="0012" >Prod2</option>
</select>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd2" value="_cart">
<input type="hidden" name="business2" value="info@xxxx">
<input type="hidden" name="lc2" value="IT">
<input type="hidden" name="item_name2" value="Prod1">
<input type="hidden" name="item_number2" value="0011">
<input type="hidden" name="amount2" value="20.00">
<input type="hidden" name="currency_code2" value="EUR">
<input type="hidden" name="button_subtype2" value="products">
<input type="hidden" name="no_note2" value="0">
<input type="hidden" name="shipping2" value="0.00">
<input type="hidden" name="add2" value="1">
<input type="hidden" name="bn2" value="PP-ShopCartBF:btn_cart_SM.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/it_IT/IT/i/btn/btn_cart_SM.gif" border="0" name="submit2" alt="PayPal - Il sistema di pagamento online più facile e sicuro!">
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>
例如,从组合框中我选择产品 0011,然后重新加载页面,以便上面的表单将由添加到 0011 购物车的值填充,依此类推... 然后用户可以单击“添加到购物车”。
我将放置一个 switch case 以便根据 select (0011, 0012..) 的值设置表单的变量。觉得怎么样?这是一个好的方法吗?谢谢
I want to use just one add to cart paypal button for my website and substitute the product value using php and select.
<select name="select_stuff" id="select_stuff">
<option value="0011" >Prod1</option>
<option value="0012" >Prod2</option>
</select>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd2" value="_cart">
<input type="hidden" name="business2" value="info@xxxx">
<input type="hidden" name="lc2" value="IT">
<input type="hidden" name="item_name2" value="Prod1">
<input type="hidden" name="item_number2" value="0011">
<input type="hidden" name="amount2" value="20.00">
<input type="hidden" name="currency_code2" value="EUR">
<input type="hidden" name="button_subtype2" value="products">
<input type="hidden" name="no_note2" value="0">
<input type="hidden" name="shipping2" value="0.00">
<input type="hidden" name="add2" value="1">
<input type="hidden" name="bn2" value="PP-ShopCartBF:btn_cart_SM.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/it_IT/IT/i/btn/btn_cart_SM.gif" border="0" name="submit2" alt="PayPal - Il sistema di pagamento online più facile e sicuro!">
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>
For example from the combox I select the product 0011 then I reload the page so that the form above will be filled by the values for adding to the cart for 0011 and so on...
Then user can click add to cart.
i will put an switch case in order to set the variables for the form based on value of select (0011, 0012..) . What do think? Is it a good a approach? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这不是一个好方法。由于您将在页面源中将要收取的金额发送到 PayPal,因此可能会导致价格被操纵。
您可以通过使用 BMCreateButton API 创建“托管按钮”来解决此问题,其中金额通过 PayPal 安全存储。但如果您已经准备使用任何 API,您不妨开始使用 PayPal Express Checkout。
Express Checkout 基于三个 API 调用; SetExpressCheckout、GetExpressCheckoutDetails 和 DoExpressCheckoutPayment。
您可以在 找到 Express Checkout 的其他文档https://www.x.com/community/ppx/documentation#ec 以及 SDK 和示例代码 https://www.x.com/community/ppx/sdks#NVP
No, it's not a good approach. Since you'll be sending the amounts to be charged to PayPal clear-as-day in the source of your pages, leading possible manipulation of your prices.
You could fix this by using the BMCreateButton API to create a 'hosted button', where the amounts are securely stored with PayPal. But if you're going to be using any API's already, you may as well start using PayPal Express Checkout.
Express Checkout is based on three API calls; SetExpressCheckout, GetExpressCheckoutDetails and DoExpressCheckoutPayment.
You can find additional documentation for Express Checkout at https://www.x.com/community/ppx/documentation#ec as well as the SDK's and sample code at https://www.x.com/community/ppx/sdks#NVP