php - migs(万事达卡虚拟支付客户端)集成 php

标签 php integration payment onlinebanking

任何人都可以帮助我了解如何在 php 网站中集成 migs (万事达卡虚拟支付客户端)!

我已阅读引用指南,但没有帮助!

最佳答案

//这个值提交给MIGS PAYMENT GATEWAY

        $SECURE_SECRET =  $signature; //value from migs payment gateway
        $accessCode    =  $accesscode;//value from migs payment gateway
        $merchantId    =  $merchantid;//value from migs payment gateway
        $paymentdata = array(
                 "vpc_AccessCode" => $accessCode,
                 "vpc_Amount" => ($amount*100),//our product price , must multipy by 100
                 "vpc_Command" => 'pay',
                 "vpc_Locale" => 'en',// order id
                 "vpc_MerchTxnRef" => random_unique_value(like session),
                 "vpc_Merchant" => $merchantId,
                 "vpc_OrderInfo" => "Some Comment",
                 "vpc_ReturnURL" => "htps://yoursite.com/returnpoint",//here code for db updation, return variable here
                 "vpc_Version" => '1'
                           );

        $actionurl = 'https://migs.mastercard.com.au/vpcpay' . "?";
        $HashData = $SECURE_SECRET;
        $str = 0;
        foreach ($paymentdata as $key => $value) {
            // create the md5 input and URL
            if (strlen($value) > 0) {
                // this ensures the first paramter of the URL is preceded by the '?' char
                if ($appendAmp == 0) {
                    $actionurl .= urlencode($key) . '=' . urlencode($value);
                    $str = 1;
                } else {
                    $actionurl .= '&' . urlencode($key) . "=" . urlencode($value);
                }
                $HashData .= $value;
            }
        }

        if (strlen($SECURE_SECRET) > 0){$actionurl .= "&vpc_SecureHash=" . strtoupper(md5($HashData));}
        header("Location: " . $actionurl);
    }

///////////////////返回值////////////////////////////////

the return url will be like

https://yoursite.com/returnpoint?vpc_TransactionNo="migs_transaction_number"&vpc_MerchTxnRef="random_unique_value(we post to migs)"&vpc_TxnResponseCode=value&vpc_Message="value"
 if vpc_TxnResponseCode = 0 -- success ,vpc_Message = approved -- paymet is success , All other unsuccessfull payment

关于php - migs(万事达卡虚拟支付客户端)集成 php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8033497/

相关文章:

payment-gateway - 如何解决来自 Paypal Website Payments Pro 的 "Internal Error"错误?

php - 使用ajax显示搜索结果

javascript - 使用 ajax 将数据发布到 PHP 文件

php - 描述中给出的代码在Windows系统中是否可执行?

php - 速记数组在服务器上不起作用

ninject - 在集成测试中使用 IMapper

php - Magento 订单被收取两次费用

ios - iTunes Connect 何时更新财务报告?

c++ - 评估多重积分

Python 积分