我想在不向用户显示万事达卡界面的情况下集成支付部分,只会在我的网站上填写他们的信息我的门户而不是在这里万事达卡门户我正在尝试使用 curl 在我的 PHP 站点上实现 CommWeb。它不工作。我收到以下错误消息:if ($_SERVER["REQUEST_METHOD"] == "GET") { if (!isset($_GET['id']) || !isset($_GET['motif']) || !isset($_GET['code'])){ die("Invalid request"); } $amount = 10000; $id = 2; $motif = 'save'; $action_code = 'ookkk'; $orderInfo = 'fhhsd'.$id; $MerchTxnRef = $orderInfo.'-'.generateMerchTxnRef(); $accountData = array( 'merchant_id' => 'TESTID', // for test card 'access_code' => '77867878', // for test card 'secret' => 'TYUJHGFDFGHJ87654567GFDFGHGF' // for test card ); $currency_str = "USD"; $mult = 100; $queryData = array( 'vpc_AccessCode' => $accountData['access_code'], 'vpc_Merchant' => $accountData['merchant_id'], 'vpc_Amount' => 1000000, // Multiplying by 100 to convert to the smallest unit 'vpc_OrderInfo' => $orderInfo, 'vpc_MerchTxnRef' => $MerchTxnRef, 'vpc_Command' => 'pay', 'vpc_Currency' => $currency_str, 'vpc_Locale' => 'en', 'vpc_Version' => 2, 'vpc_ReturnURL' => ('http://theeventsfactory.biz/the_events_factory/logics/payment_return.php?id='.$id.'&motif='.$motif.'&code='.$action_code), 'vpc_SecureHashType' => 'SHA256', 'vpc_CardNum' => '5123456789012346', 'vpc_CardExp' => '0521', 'vpc_CardSecurityCode'=> '123' ); // Add secure secret after hashing // $queryData['vpc_SecureHash'] = generateSecureHash($accountData['secret'], $queryData); // $migsUrl = 'https://migs.mastercard.com.au/vpcpay?'.http_build_query($queryData);}这是我收到的回复vpc_Amount=0&vpc_BatchNo=0&vpc_Locale=en&vpc_Message=Required+field+vpc_Merchant+was+not+present+in+the+request&vpc_TransactionNo=0&vpc_TxnResponseCode=7 我将如何解决这个问题
1 回答
四季花海
TA贡献1811条经验 获得超5个赞
您需要使用 http_build_query 将数组转换为 url 编码的字符串
设置 queryData 数组后,添加
$queryData_string = http_build_query($queryData);
然后 curlpost 将设置为
CURLOPT_POSTFIELDS => $queryData_string,
- 1 回答
- 0 关注
- 166 浏览
添加回答
举报
0/150
提交
取消