简体   繁体   English

如何通过 MySQL 手动跟踪 Wordpress 中的沙箱 Paypal 重复交易

[英]How to track sandbox Paypal recurring transactions in Wordpress by manually with MySQL

I have created 3 tables for price listing by using a price listing plugin and add ' PayNow ' button for recurring payments through PayPal.我使用价格列表插件创建了 3 个价格列表表,并添加了“ PayNow ”按钮以通过 PayPal 进行定期付款。 Now I am using the sandbox for testing purposes.现在我使用沙箱进行测试。 I have set custom URL for 'PayNow' button like this https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions&business=example@gmail.com&item_name=Bronze%27s%20Pack&a3=29.00&p3=1&t3=D&srt=12&sra=1&src=1&currency_code=USD&return=http://example.com/payments-recieved/我已经为这样的“PayNow”按钮设置了自定义 URL https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions&business=example@gmail.com&item_name=Bronze%27s%20Pack&a3=29.00&p3 =1&t3=D&srt=12&sra=1&src=1&currency_code=USD&return=http://example.com/payments-recieved/

When I click on 'PayNow' button it will redirect to Paypal and be showing the recurring offers for daily basis.当我点击“PayNow”按钮时,它会重定向到 Paypal 并显示每天的经常性优惠。 After all the things done payment completed then I have the redirect to payment received a page in Wordpress and I have called there a PHP template where I print array and got these values.在完成所有事情后付款完成然后我重定向到付款在 Wordpress 中收到一个页面,我在那里调用了一个 PHP 模板,在那里我打印数组并获取这些值。

Array
(
    [tx] => 4M134216E2452352C
    [st] => Completed
    [amt] => 29.00
    [cc] => USD
    [cm] => 
    [item_number] => 
    [sig] => VMCQP7/uVkdAsN/sNNRcpYeFRTzD57Y3u2NnJcPi06O530J1JUmk7Wm6hoyOXdWJWZHnwMHh00JcsZvMmcqnuzswZlbh7nc2regh2hXFiTPj0WoIlMEMuTesclA6uq5At760uJoQxRKVw0ryj8poJSUpT7xxncecCNdK66Rn/CU=
)

I check my sandbox Paypal account history it will show the recurring payments with the current date, next date cycle, and the last date of the cycle.我检查了我的沙箱 Paypal 帐户历史记录,它将显示当前日期、下一个日期周期和周期的最后一个日期的定期付款。 On PHP template page the array receives the complete transactions.在 PHP 模板页面上,数组接收完整的交易。 But I don't find the transaction in database tables history.但是我没有在数据库表历史记录中找到该事务。

How we got the entry of the transaction in database track every record for future references.我们如何在数据库中获取事务的条目跟踪每条记录以供将来参考。 Can we insert the transaction manually if yes then how will we do this?如果是,我们可以手动插入事务,那么我们将如何执行此操作? Please help me out and give me the best solution.请帮助我并给我最好的解决方案。

Many Thanks!!!非常感谢!!!

Try this mate, I think it will help you,试试这个朋友,我想它会帮助你,

<?php
    /*
        Template Name: All Payments History
    */
        get_header();
    echo "<pre>";print_r($_REQUEST);
    global $wpdb; //global query variable
    $wpdb->show_errors();

    if (!empty( $_REQUEST) && $_REQUEST['st']=='Completed'){
        $wpdb->insert('wp_paypal_payments_tracking', array(
            'transaction_id' => $_REQUEST['tx'], 
            'transaction_status' => $_REQUEST['st'],
            'amount' => $_REQUEST['amt'], 
            'currency_type' => $_REQUEST['cc'],
            'item_number' => $_REQUEST['item_number'], 
            ));
        echo "Payment Done Successfully, We will update you soon!!!"; 
    }
    get_footer();
    ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM