在WordPress中使用Molpay定期付款

时间:2017-01-28 作者:murugesh

我现在工作WordPress molpay定期付款。我的代码在那里。我有一个定期付款文件。所以我还是被那个文件跟踪了。但我不知道如何解决这个问题。请帮帮我。

$c_cost=isset($_REQUEST[\'m_cost\']) ? $_REQUEST[\'m_cost\'] : \'0\';

    $c_pay=$_REQUEST[\'payment\'];

    $c_name=$_REQUEST[\'m_c_name\'];

    $c_num=$_REQUEST[\'m_cred_num\'];

    $c_date=$_REQUEST[\'m_exp_date\'];

    $c_cvv=$_REQUEST[\'m_c_vv\'];





    if(isset($_REQUEST[\'payment\']) and $_REQUEST[\'payment\'] != \'others\')
    {

    $amount = $wpdb->get_results ( "SELECT * FROM bootsgrid_mol_payment where `id`=".$c_pay);

    $molpay_camount=$amount[0]->money;
    $c_month = $amount[0]->month;
    }

    else
    {
    $molpay_camount=$c_cost;
    $c_month = 0;
    }




    $user_id = get_current_user_id();

    $table_name = "bootsgrid_mol_new_paynow";


    $wpdb->insert($table_name, array(\'user_id\' =>$user_id, \'cost\' => $c_cost,\'payment\' => $c_pay ,\'credit_name\' =>$c_name,\'creditcard\' =>$c_num,\'ex_date\'=>$c_date,\'cvv\'=>$c_cvv,\'month\'=>$c_month,\'recurring_money\'=>$molpay_camount,\'created\'=>time()));

    //order_id
    $last_id = $wpdb->insert_id;

    //merchant id and verfig key
    $bg_set = $wpdb->get_results ( "SELECT * FROM bootsgrid_molpay_setting" );
    $c_merchant_id=$bg_set[0]->merchant_id;
    $c_api_key=$bg_set[0]->verify_key;

    //amount
    $cdecimal_amount= number_format((float)$molpay_camount, 2, \'.\', \'\');



    //formula
    $Checksum = md5(\'T\'.$c_merchant_id.$c_num.$last_id.\'MYR\'.$cdecimal_amount.$c_api_key );


    $recurring_array =array(\'T|\'.$c_merchant_id.\'||\'.$c_num.\'|\'.$last_id.\'|MYR|\'.$cdecimal_amount.\'|\'.$Checksum);



    $URL ="https://www.onlinepayment.com.my/MOLPay/API/Recurring/input.php";

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_POST , TRUE );
    curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($recurring_array));
    curl_setopt($ch, CURLOPT_URL , $URL );
    curl_setopt($ch, CURLOPT_HEADER , TRUE );
    curl_setopt($ch, CURLINFO_HEADER_OUT , TRUE );
    curl_setopt($ch, CURLOPT_RETURNTRANSFER , TRUE );
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , FALSE);

    $result = curl_exec($ch);

    curl_close($ch);

    print_r($result);exit;
我得到了回应

    HTTP/1.1 200 OK
    Date: Sat, 28 Jan 2017 05:01:14 GMT
    Content-Type: text/html; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Set-Cookie: __cfduid=dc32c2870dfdd6f7bb177cd46f17be2f11485579673; expires=Sun, 28-Jan-18 05:01:13 GMT; path=/; domain=.onlinepayment.com.my; HttpOnly
    Vary: Accept-Encoding,User-Agent
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    Cache-Control: max-age=600
    Access-Control-Allow-Credentials: true
    Server: cloudflare-nginx
    CF-RAY: 3281e2a02e832fdb-MAA

    [{"status":"failed","orderid":"69","tranID":"","reason":"Invalid token"}]
如何解决此问题。

1 个回复
SO网友:murugesh

最后,我在这里找到了结果和我的Bootsgrid molpay循环wordpress插件:https://bootsgrid.com/product/recurring-molpay-plugin-wordpress/

相关推荐

插件放置在/wp-content/plugins内的文件夹中时不保存值

我得到了WordPRess插件的以下代码,它在每个页面/后期编辑屏幕上添加了两个自定义输入。然后将这些值保存并输出到前端页面的标题中。如果代码位于内部,则可以正常工作。php文件并直接放入“wp内容/插件”。然而,如果我把它放在插件(如“wp-content/plugins/myplugin”)中自己的文件夹中,那么在通过编辑屏幕保存帖子/页面时,输入字段不会保存。此外,它不会向前端页面html标题部分输出任何内容。这似乎是一个被放弃的项目,所以我无法与原始开发人员一起制定解决方案。然而,代码中的某些内容