即时PayPal付款后获取交易ID

时间:2016-08-04 08:17:43

标签: php paypal transactions paypal-ipn

我是Paypal的新手并尝试使用paypal付款。我找到代码在我的网站上显示购买按钮,它成功地将我重定向到paypal。成功付款后,我想将用户trasnaction id存储到我的数据库中。但作为回应我没有得到交易ID。

这是我的代码:

 <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
                <input type="hidden" name="cmd" value="_xclick">
                <input type="hidden" name="business" value="business_email@gmail.com">
                <input type="hidden" name="item_name" value="Job Post">
                <input type="hidden" name="item_number" value="1">
                <input type="hidden" name="amount" value="25">
                <input type="hidden" name="quantity" value="1">
                <input type="hidden" name="currency_code" value="USD">
                <input type="hidden" name="cancel_return" value="<?php echo base_url('account/paypal_cancel');?>">
                <input type="hidden" name="notify_url" value="<?php echo base_url('account/paypal_return');?>">
                <input type="hidden" name="return" value="<?php echo base_url('account/paypal_return');?>">
                <input type="image" class="hidden" name="submit" name="paypal_submit" id="paypal_submit"
                src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"
                alt="PayPal - The safer, easier way to pay online">
            </form>

付款成功后,我得到了回复:

                        Array
                    (
                        [mc_gross] => 25.00
                        [protection_eligibility] => Eligible
                        [address_status] => confirmed
                        [payer_id] => K7MH34Q4ZNN12
                        [tax] => 0.00
                        [address_street] => 1 Main St
                        [payment_date] => 23:25:32 Aug 03, 2016 PDT
                        [payment_status] => Completed
                        [charset] => windows-1252
                        [address_zip] => 95131
                        [first_name] => Payer First name
                        [mc_fee] => 1.28
                        [address_country_code] => US
                        [address_name] => Name
                        [notify_version] => 3.8
                        [custom] => 
                        [payer_status] => verified
                        [business] => business_email@gmail.com
                        [address_country] => United States
                        [address_city] => San Jose
                        [quantity] => 1
                        [payer_email] => payer_email@gmail.com
                        [verify_sign] => AFcWxV21C7fd0v3bYYYRCpSSRl31Apes4ffYPHmXs3U0H9m6oiBFZWDe
                        [txn_id] => 4HH86447NJ982154T
                        [payment_type] => instant
                        [last_name] => Last Name
                        [address_state] => CA
                        [receiver_email] => business_email@gmail.com
                        [payment_fee] => 1.28
                        [receiver_id] => C4VX55Z5QJG87
                        [txn_type] => web_accept
                        [item_name] => Job Post
                        [mc_currency] => USD
                        [item_number] => 1
                        [residence_country] => US
                        [test_ipn] => 1
                        [handling_amount] => 0.00
                        [transaction_subject] => 
                        [payment_gross] => 25.00
                        [shipping] => 0.00
                        [auth] => A5eWy6N2pRotb5qNnmxnnEWAabmNZfgr0pGGMFWYVoXqrcmQpINk7nAB0fNCv0m66XgcwMbCVIWqtW0q7yldjHg
                    )

我想要交易ID,但响应中没有交易ID。

任何人都可以帮助我,我如何使用paypal响应获得交易ID。

由于

0 个答案:

没有答案