在发送到外部url (Paypal)之前验证表单输入


Validate form input before sending to external url ( Paypal )

我目前正在研究一个系统,该系统为用户提供"银行"余额,用户通过paypal存入资金,并在数据库中更新以反映他们存入的内容等。我已经设置了这与贝宝按钮之前,但我现在与输入文本框工作,我想确保整个过程。这是我目前对表单

的设置
<form action='https://www.paypal.com/cgi-bin/webscr' method='post' target='_top' name='_xclick'>
                <!-- Identify Business -->
                <input type='hidden' name='business' value='email goes here'>
                <!-- Identify Button Type - Buy it Now Button -->
                <input type='hidden' name='cmd' value='_xclick'>
                <!-- Identify Item Details -->
                <input type='hidden' name='currency_code' value='USD'>
                <input type='hidden' name='item_name' value='Bank Deposit'>
                <input type='hidden' name='item_number' value='' id='item_number'>
                How Much Do You Want to Add
                $ <input type='text' name='bank_deposit' placeholder='Amount to deposit' id='bank_deposit' onchange='BankDeposit(this.value)'>
                <input type='hidden' name='amount' value='' id='amount'>
                <input type='hidden' name='custom' value='$user_id'>
                <input name='notify_url' value='ipn url here' type='hidden'>
                <input type='hidden' name='lc' value='US'>
                <input type='hidden' name='bn' value='PP-BuyNowBF'>
                <button type='submit' class='btn_blue' style='border-width: 0px 0px 2px 0px;'>Add To Bank</button>
            </form>

我最好想验证所有输入通过php在我的结束,然后发送所有的帖子数据安全的贝宝一旦事情已被验证。如果有人能就如何做到这一点提供见解,将不胜感激。

使用curl调用PayPal api并遵循express checkout工作流程。见https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECGettingStarted/

你会看到PayPal在握手时验证输入。验证在令牌内部。如果用户尝试更改任何数量,令牌将失败

首先,更安全的方法是收集用户输入,然后执行验证并将验证后的消息发送到支付处理程序(paypal)代码端。

但是,如果您的IPN设置和引用正确,那么您就不需要太担心,因为数据库更改应该只在侦听器接收到适当的、经过验证的IPN消息时发生。消息中的付款金额将是paypal报告的实际交易,并且可以信任。