互億無線 · 文檔中心

銀行卡三要素 - 代碼示例


Go對接銀行卡信息核驗接口DEMO示例
本文為您提供了Go語言版本的銀行卡三要素核驗對接DEMO示例

銀行卡三要素接口文檔 點擊下載

銀行卡三要素接入指南 點擊訪問


// 接口類型:互億無線實名認(rèn)證接口
// 賬戶注冊:https://user.ihuyi.com/register.html
// 注意事項:
// DEMO僅作參考

package main

import (
	"crypto/md5"
	"encoding/hex"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"time"
)

func GetMd5String(s string) string {
	h := md5.New()
	h.Write([]byte(s))
	return hex.EncodeToString(h.Sum(nil))
}
func main() {
	v := url.Values{}
	_now := strconv.FormatInt(time.Now().Unix(), 10)
	//fmt.Printf(_now)
	_account := "APIID"
	_password := "APIKEY"
	_app := "bank3"http://固定值
	_name := "張三"
	_id_card_no := "123456789012345678"
	_bank_card_no := "637556789"
	v.Set("account", _account)
	v.Set("password", GetMd5String(_account+_password+_app+_name+_id_card_no+_bank_card_no+_now))
	v.Set("app", _app)
	v.Set("name", _name)
	v.Set("id_card_no", _id_card_no)
	v.Set("bank_card_no", _bank_card_no)
	v.Set("time", _now)
	//body := ioutil.NopCloser(strings.NewReader(v.Encode())) //把form數(shù)據(jù)編下碼
	body := strings.NewReader(v.Encode()) //把form數(shù)據(jù)編下碼
	client := &http.Client{}
	req, _ := http.NewRequest("POST", "https://api.ihuyi.com/idcard/Submit.json", body)

	req.Header.Set("Content-Type", "application/x-www-form-urlencoded;")
	//fmt.Printf("%+v\n", req) //看下發(fā)送的結(jié)構(gòu)

	resp, err := client.Do(req) //發(fā)送
	defer resp.Body.Close()     //一定要關(guān)閉resp.Body
	data, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(data), err)
}

現(xiàn)在注冊,即享新用戶禮包!

在線咨詢
電話咨詢

服務(wù)熱線:

4008 808 898

服務(wù)熱線(工作時間):

4008 808 898

業(yè)務(wù)咨詢(非工作時間):

售后咨詢(非工作時間):

驗證碼已發(fā)送到您的手機,請查收!

輸入驗證碼后,點擊“開通體驗賬戶”按鈕可立即開通體驗賬戶。

收不到短信驗證碼?
互億無線不提供接碼服務(wù),接碼用戶請勿點擊開通按鈕。
×