php - paygate payweb3 在 php 网站中的集成
问题描述
我正在尝试将集成paygate payment gateway
集成到我的PHP API
. 我已经浏览了他们的文档,但对我来说还不清楚。有三个端点
- 发起
- 返回
- 询问
我不知道使用哪个端点。现在我正在使用启动端点,但是在邮递员中进行测试时出现错误
ERROR=DATA_CHK 错误
谁能指导我解决这个问题...
public function subscription(Request $request) {
$validator = Validator::make(
$request->all(),
array(
'subscription' => 'required|integer',
'email' => 'required|exists:users,email',
'amount' => 'required|integer',
'payment_mode' => 'required|integer',
),
array(
'exists' => 'The :attribute doesn\'t exists',
)
);
if ($validator->fails()) {
$error_messages = implode(',', $validator->messages()->all());
$response_array = array('success' => false, 'error' => Helper::get_error_message(101), 'error_code' => 101, 'error_messages'=>$error_messages);
} else {
$encryptionKey = 'AQ2Uted8BidhkIEv6oYgrqwS';
$data = array(
'PAYGATE_ID' => 1039433100014,
'REFERENCE' => 'pgtest_123456789',
'AMOUNT' => 3299,
'CURRENCY' => 'ZAR',
'RETURN_URL' => 'http://localhost/avvata/public/home',
'TRANSACTION_DATE' => date('Y-m-d H:i:s'),
'LOCALE' => 'en-za',
'COUNTRY' => 'ZAF',
'EMAIL' => $request->email,
);
$checksum = md5(implode('', $data) . $encryptionKey);
$data['CHECKSUM'] = $checksum;
$fieldsString = http_build_query($data);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, 'https://secure.paygate.co.za/payweb3/initiate.trans');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsString);
//execute post
$result = curl_exec($ch);
echo $result;
exit();
//close connection
curl_close($ch);
}`
提前致谢 :-)
解决方案
推荐阅读
- reactjs - 带有嵌套 CheckBoxGroupInput 的 ReferenceInput 行为异常
- java - 为什么 Java 不使用 ArrayList
对象作为集合 目的? - c - 将文本文件中的一行拆分为C中的单独变量
- javascript - Testcafe LocalStorage 的问题
- javascript - 使用“输入”事件动态更改背景颜色
- c - 创建一个以升序存储项目或按该顺序打印的链表
- javascript - 如果第一个 JS 脚本没有产生匹配项,我如何运行第二个 JS 脚本?
- python - 我们如何在 Python 中将信号拟合到 sigmoid 函数中?
- javascript - 向所有 Firebase 云消息传递令牌 (Web) 发送通知
- streaming - Liquidsoap——读取元数据