php - paypal 付款成功后无法重定向商家网站

标签 php paypal payment-gateway paypal-sandbox paypal-ipn

我正在使用 Paypal 沙箱测试买家和卖家账户。使用这些卖家帐户集成 Paypal 支付网关。 支付成功后应该会自动重定向到成功页面。 这是我使用的代码

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<form name='_xclick' target='_parent' action='https://www.sandbox.paypal.com/webscr' method='post'>


        <input type="hidden" name="cmd" value="_xclick">
        <input type="hidden" name="business" value="xxxxxxxxxxxxx-faxxxx@gmail.com">
        <input type="hidden" name="currency_code" value="USD">
        <input type="hidden" name="item_name" value="Invoice payment">
        <input type="hidden" name="return" value="http://www.mysite.com/success.php/">


                   <input type="hidden" name="amount" value="12">

   <input type='subimit' name='submit' value='pay by paypal'>
    </form>  

我还在 Paypal 卖家设置中打开了网站付款的自动返回。如何将交易 ID 传递给 success.php。应该在 success.php 页面中编写什么代码...如果交易成功,我必须更新数据库中的金额,否则应该在数据库中更新失败金额...任何人都可以帮助我。

最佳答案

在成功页面上,您只需获取数据

$item_transaction = $_GET['tx']; // Paypal transaction ID
$item_price = $_GET['amt']; // Paypal received amount
$item_currency = $_GET['cc']; // Paypal received currency type

关于php - paypal 付款成功后无法重定向商家网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19271336/

相关文章:

php - Paypal html按钮自定义字段限制

php - 为什么在 paypal 集成中金额为零?

node.js - 使用 Paypal REST API 创建付款

javascript - Laravel 5.2 中无法读取 Jquery 代码中的 json 数据

php - 如何在不删除标签的情况下替换 HTML 标签内的空格

html - 将下拉菜单与 'A3' 参数的 PayPal 订阅一起使用

payment-gateway - 支付宝错误: Invalid IP address

PHP 使用键创建值数组

php - Ajax 邮件程序脚本无法正常工作,需要编辑什么?

python - 使用 REST Api 执行定期付款