我正在实施Paypal付款到我的网站。但是有一些隐藏的形式元素,例如价格,我们可以轻松操纵这些元素。我怎么能在PHP中完美地隐藏它们,以便没有人可以操纵它?
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="business@email.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Item Example 1">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="5.95">
<input type="hidden" name="currency_code" value="USD">
<input type='hidden' name='cancel_return' value='http://example.com/cancel.php'>
<input type='hidden' name='return' value='http://example.com/success.php'>
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
隐藏元素item_name
,item_number
,amount
和currency_code
我不希望看到它们。有没有机会隐藏它们,例如用PHP或某种方式隐藏它们?
非常感谢!
答案 0 :(得分:1)
如果您想坚持使用Payments Standard并隐藏详细信息,则需要使用托管按钮。在您的PayPal帐户中创建按钮的过程中,可以选择在PayPal上保存按钮。&#34;这将创建一个托管按钮,在这种情况下,所有细节都存储在PayPal中,因此按钮代码只有一个按钮ID,这对于尝试任何棘手的任何人都没有任何意义。
但是,如果您自己构建表单,则无法执行此操作。你可以做@Neil McGuigan提到的并尝试通过IPN取消/退款,如果数据不符合它应该是什么,但那不是我推荐的。
我建议使用Express Checkout API代替付款标准。这是完成任务的最安全方式,随着您与网站一起成长,您将无法像使用Payments Standard一样受限制。
此PayPal PHP SDK将使您快速轻松地进行Express Checkout API调用。具体而言,您将使用SetExpressCheckout,GetExpressCheckoutDetails和DoExpressCheckoutPayment。
图书馆附带了可以随时使用的示例和模板,但是如果您更喜欢fully functional demo那些也可以使用。