我们如何整合Tap Payment Gateway Php

时间:2019-04-02 13:09:00

标签: php payment-gateway

我想将Tap Payment Gateway集成到Php中, 我尝试使用以下代码

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.tap.company/v2/charges",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"amount\":1,\"currency\":\"KWD\",\"threeDSecure\":true,\"save_card\":false,\"description\":\"Test Description\",\"statement_descriptor\":\"Sample\",\"metadata\":{\"udf1\":\"test 1\",\"udf2\":\"test 2\"},\"reference\":{\"transaction\":\"txn_0001\",\"order\":\"ord_0001\"},\"receipt\":{\"email\":false,\"sms\":true},\"customer\":{\"first_name\":\"test\",\"middle_name\":\"test\",\"last_name\":\"test\",\"email\":\"test@test.com\",\"phone\":{\"country_code\":\"965\",\"number\":\"50000000\"}},\"source\":{\"id\":\"src_kw.knet\"},\"post\":{\"url\":\"http://your_website.com/post_url\"},\"redirect\":{\"url\":\"http://your_website.com/redirect_url\"}}",
  CURLOPT_HTTPHEADER => array(
    "authorization: Bearer sk_test_XKokBfNWv6FIYuTMg5sLPjhJ",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

现在我得到以下结果

{ "id": "chg_y4O54220191519Ph990204234", "object": "charge", "live_mode": false, "api_version": "V2", "status": "INITIATED", "amount": 1.000, "currency": "KWD", "threeDSecure": true, "save_card": false, "statement_descriptor": "Sample", "description": "Test Description", "metadata": { "udf1": "test 1", "udf2": "test 2" }, "transaction": { "timezone": "UTC+03:00", "created": "1554218382280", "url": "https://sandbox.payments.tap.company/test_gosell/v2/payment/response.aspx?chg=%2bmNRtNcfMlgq0CGQzmDeB7a4ATTR9QspydJif9BqgMI%3d&sess=KFxgGLGWFsU%3d&token=%2bmNRtNcfMlgq0CGQzmDeB7a4ATTR9QsptrqPVmYTjkxg9JcUB7NTow%3d%3d" }, "reference": { "transaction": "txn_0001", "order": "ord_0001" }, "response": { "code": "100", "message": "Initiated" }, "receipt": { "email": false, "sms": true }, "customer": { "first_name": "test", "middle_name": "test", "last_name": "test", "email": "test@test.com", "phone": { "country_code": "965", "number": "50000000" } }, "source": { "object": "source", "id": "src_kw.knet" }, "redirect": { "status": "PENDING", "url": "http://your_website.com/redirect_url" }, "post": { "status": "PENDING", "url": "http://your_website.com/post_url" } }

我将网址部分(https://sandbox.payments.tap.company/test_gosell/v2/payment/response.aspx?chg=%2bmNRtNcfMlgq0CGQzmDeB7a4ATTR9QspydJif9BqgMI%3d&sess=KFxgGLGWFsU%3d&token=%2bmNRtNcfMlgq0CGQzmDeB7a4ATTR9QsptrqPVmYTjkxg9JcUB7NTow%3d%3d) 我必须填写银行帐户详细信息,如何查看虚拟交易? 如何转换为实时状态并在管理面板(我的帐户)中查看?

0 个答案:

没有答案