curl --request POST \
--url https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth \
--header 'Content-Type: application/json' \
--header 'signature: <api-key>' \
--data '
{
"charset": "UTF-8",
"version": "2.0.0",
"transType": "PAY",
"accessType": "s2s",
"signType": "RSA",
"memberId": "2023010558663764",
"merchantId": "2023010558663764",
"threeDsType": "2.0",
"deviceChannel": "string",
"transChannel": "WEIXIN",
"transTimeout": "string",
"carrierId": "carrierId",
"currency": "USD",
"transAmt": "20.01",
"goodsName": "Iphone15",
"dcc": "DCC",
"notifyUrl": "http://example.com",
"redirectUrl": "http://www.gogole.com",
"merchantOrderId": "20230424141154",
"customerIp": "18.277.26.154",
"payMode": "QRCODE",
"payMethodInfo": {
"cardNo": "444433******1111",
"expirationMonth": "01",
"expirationYear": "2026",
"cvv": "123",
"firstName": "Bren",
"lastName": "Qiu",
"phone": "18817536697"
},
"merchantOrderTime": "2019-08-24T14:15:22Z",
"osType": "IOS",
"merchantRegion": "US",
"authCode": "133788758877188822",
"appId": "wxd678efh567hg6787",
"openId": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"reqReserved": "reqReserved",
"reserved": "reserved",
"buyerId": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"address": {
"zipCode": "344104",
"region": "US",
"city": "ShangHai",
"state": "ShangHai",
"phone": "18817536697",
"email": "string",
"address1": "Lou Lan street",
"address2": "Lou Lan street 2"
},
"customer": {
"address": {
"zipCode": "344104",
"region": "US",
"city": "ShangHai",
"state": "ShangHai",
"phone": "18817536697",
"email": "string",
"address1": "Lou Lan street",
"address2": "Lou Lan street 2"
},
"certificate": {
"number": "string",
"type": "string"
}
},
"subMerchantId": "string",
"userAgent": "string",
"goods": [
{
"referenceGoodsId": "M1006",
"goodsName": "单品惠-6",
"goodsCategory": "1001",
"goodsQuantity": "100",
"goodsUnitAmount": "100.01"
}
],
"store": {
"storeTerminalId": "0001"
},
"browserInfo": {
"acceptHeader": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"javaEnabled": "true",
"language": "en-US",
"colorDepth": "160",
"screenHeight": "1024",
"screenWidth": "648",
"browserTz": "string",
"browserIp": "8.8.8.8",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
}
}
'import requests
url = "https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth"
payload = {
"charset": "UTF-8",
"version": "2.0.0",
"transType": "PAY",
"accessType": "s2s",
"signType": "RSA",
"memberId": "2023010558663764",
"merchantId": "2023010558663764",
"threeDsType": "2.0",
"deviceChannel": "string",
"transChannel": "WEIXIN",
"transTimeout": "string",
"carrierId": "carrierId",
"currency": "USD",
"transAmt": "20.01",
"goodsName": "Iphone15",
"dcc": "DCC",
"notifyUrl": "http://example.com",
"redirectUrl": "http://www.gogole.com",
"merchantOrderId": "20230424141154",
"customerIp": "18.277.26.154",
"payMode": "QRCODE",
"payMethodInfo": {
"cardNo": "444433******1111",
"expirationMonth": "01",
"expirationYear": "2026",
"cvv": "123",
"firstName": "Bren",
"lastName": "Qiu",
"phone": "18817536697"
},
"merchantOrderTime": "2019-08-24T14:15:22Z",
"osType": "IOS",
"merchantRegion": "US",
"authCode": "133788758877188822",
"appId": "wxd678efh567hg6787",
"openId": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"reqReserved": "reqReserved",
"reserved": "reserved",
"buyerId": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"address": {
"zipCode": "344104",
"region": "US",
"city": "ShangHai",
"state": "ShangHai",
"phone": "18817536697",
"email": "string",
"address1": "Lou Lan street",
"address2": "Lou Lan street 2"
},
"customer": {
"address": {
"zipCode": "344104",
"region": "US",
"city": "ShangHai",
"state": "ShangHai",
"phone": "18817536697",
"email": "string",
"address1": "Lou Lan street",
"address2": "Lou Lan street 2"
},
"certificate": {
"number": "string",
"type": "string"
}
},
"subMerchantId": "string",
"userAgent": "string",
"goods": [
{
"referenceGoodsId": "M1006",
"goodsName": "单品惠-6",
"goodsCategory": "1001",
"goodsQuantity": "100",
"goodsUnitAmount": "100.01"
}
],
"store": { "storeTerminalId": "0001" },
"browserInfo": {
"acceptHeader": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"javaEnabled": "true",
"language": "en-US",
"colorDepth": "160",
"screenHeight": "1024",
"screenWidth": "648",
"browserTz": "string",
"browserIp": "8.8.8.8",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
}
}
headers = {
"signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {signature: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
charset: 'UTF-8',
version: '2.0.0',
transType: 'PAY',
accessType: 's2s',
signType: 'RSA',
memberId: '2023010558663764',
merchantId: '2023010558663764',
threeDsType: '2.0',
deviceChannel: 'string',
transChannel: 'WEIXIN',
transTimeout: 'string',
carrierId: 'carrierId',
currency: 'USD',
transAmt: '20.01',
goodsName: 'Iphone15',
dcc: 'DCC',
notifyUrl: 'http://example.com',
redirectUrl: 'http://www.gogole.com',
merchantOrderId: '20230424141154',
customerIp: '18.277.26.154',
payMode: 'QRCODE',
payMethodInfo: {
cardNo: '444433******1111',
expirationMonth: '01',
expirationYear: '2026',
cvv: '123',
firstName: 'Bren',
lastName: 'Qiu',
phone: '18817536697'
},
merchantOrderTime: '2019-08-24T14:15:22Z',
osType: 'IOS',
merchantRegion: 'US',
authCode: '133788758877188822',
appId: 'wxd678efh567hg6787',
openId: 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
reqReserved: 'reqReserved',
reserved: 'reserved',
buyerId: 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
address: {
zipCode: '344104',
region: 'US',
city: 'ShangHai',
state: 'ShangHai',
phone: '18817536697',
email: 'string',
address1: 'Lou Lan street',
address2: 'Lou Lan street 2'
},
customer: {
address: {
zipCode: '344104',
region: 'US',
city: 'ShangHai',
state: 'ShangHai',
phone: '18817536697',
email: 'string',
address1: 'Lou Lan street',
address2: 'Lou Lan street 2'
},
certificate: {number: 'string', type: 'string'}
},
subMerchantId: 'string',
userAgent: 'string',
goods: [
{
referenceGoodsId: 'M1006',
goodsName: '单品惠-6',
goodsCategory: '1001',
goodsQuantity: '100',
goodsUnitAmount: '100.01'
}
],
store: {storeTerminalId: '0001'},
browserInfo: {
acceptHeader: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
javaEnabled: 'true',
language: 'en-US',
colorDepth: '160',
screenHeight: '1024',
screenWidth: '648',
browserTz: 'string',
browserIp: '8.8.8.8',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
}
})
};
fetch('https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'charset' => 'UTF-8',
'version' => '2.0.0',
'transType' => 'PAY',
'accessType' => 's2s',
'signType' => 'RSA',
'memberId' => '2023010558663764',
'merchantId' => '2023010558663764',
'threeDsType' => '2.0',
'deviceChannel' => 'string',
'transChannel' => 'WEIXIN',
'transTimeout' => 'string',
'carrierId' => 'carrierId',
'currency' => 'USD',
'transAmt' => '20.01',
'goodsName' => 'Iphone15',
'dcc' => 'DCC',
'notifyUrl' => 'http://example.com',
'redirectUrl' => 'http://www.gogole.com',
'merchantOrderId' => '20230424141154',
'customerIp' => '18.277.26.154',
'payMode' => 'QRCODE',
'payMethodInfo' => [
'cardNo' => '444433******1111',
'expirationMonth' => '01',
'expirationYear' => '2026',
'cvv' => '123',
'firstName' => 'Bren',
'lastName' => 'Qiu',
'phone' => '18817536697'
],
'merchantOrderTime' => '2019-08-24T14:15:22Z',
'osType' => 'IOS',
'merchantRegion' => 'US',
'authCode' => '133788758877188822',
'appId' => 'wxd678efh567hg6787',
'openId' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'reqReserved' => 'reqReserved',
'reserved' => 'reserved',
'buyerId' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'address' => [
'zipCode' => '344104',
'region' => 'US',
'city' => 'ShangHai',
'state' => 'ShangHai',
'phone' => '18817536697',
'email' => 'string',
'address1' => 'Lou Lan street',
'address2' => 'Lou Lan street 2'
],
'customer' => [
'address' => [
'zipCode' => '344104',
'region' => 'US',
'city' => 'ShangHai',
'state' => 'ShangHai',
'phone' => '18817536697',
'email' => 'string',
'address1' => 'Lou Lan street',
'address2' => 'Lou Lan street 2'
],
'certificate' => [
'number' => 'string',
'type' => 'string'
]
],
'subMerchantId' => 'string',
'userAgent' => 'string',
'goods' => [
[
'referenceGoodsId' => 'M1006',
'goodsName' => '单品惠-6',
'goodsCategory' => '1001',
'goodsQuantity' => '100',
'goodsUnitAmount' => '100.01'
]
],
'store' => [
'storeTerminalId' => '0001'
],
'browserInfo' => [
'acceptHeader' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
'javaEnabled' => 'true',
'language' => 'en-US',
'colorDepth' => '160',
'screenHeight' => '1024',
'screenWidth' => '648',
'browserTz' => 'string',
'browserIp' => '8.8.8.8',
'userAgent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"signature: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth"
payload := strings.NewReader("{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"transType\": \"PAY\",\n \"accessType\": \"s2s\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"threeDsType\": \"2.0\",\n \"deviceChannel\": \"string\",\n \"transChannel\": \"WEIXIN\",\n \"transTimeout\": \"string\",\n \"carrierId\": \"carrierId\",\n \"currency\": \"USD\",\n \"transAmt\": \"20.01\",\n \"goodsName\": \"Iphone15\",\n \"dcc\": \"DCC\",\n \"notifyUrl\": \"http://example.com\",\n \"redirectUrl\": \"http://www.gogole.com\",\n \"merchantOrderId\": \"20230424141154\",\n \"customerIp\": \"18.277.26.154\",\n \"payMode\": \"QRCODE\",\n \"payMethodInfo\": {\n \"cardNo\": \"444433******1111\",\n \"expirationMonth\": \"01\",\n \"expirationYear\": \"2026\",\n \"cvv\": \"123\",\n \"firstName\": \"Bren\",\n \"lastName\": \"Qiu\",\n \"phone\": \"18817536697\"\n },\n \"merchantOrderTime\": \"2019-08-24T14:15:22Z\",\n \"osType\": \"IOS\",\n \"merchantRegion\": \"US\",\n \"authCode\": \"133788758877188822\",\n \"appId\": \"wxd678efh567hg6787\",\n \"openId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"reqReserved\": \"reqReserved\",\n \"reserved\": \"reserved\",\n \"buyerId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"customer\": {\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"certificate\": {\n \"number\": \"string\",\n \"type\": \"string\"\n }\n },\n \"subMerchantId\": \"string\",\n \"userAgent\": \"string\",\n \"goods\": [\n {\n \"referenceGoodsId\": \"M1006\",\n \"goodsName\": \"单品惠-6\",\n \"goodsCategory\": \"1001\",\n \"goodsQuantity\": \"100\",\n \"goodsUnitAmount\": \"100.01\"\n }\n ],\n \"store\": {\n \"storeTerminalId\": \"0001\"\n },\n \"browserInfo\": {\n \"acceptHeader\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\",\n \"javaEnabled\": \"true\",\n \"language\": \"en-US\",\n \"colorDepth\": \"160\",\n \"screenHeight\": \"1024\",\n \"screenWidth\": \"648\",\n \"browserTz\": \"string\",\n \"browserIp\": \"8.8.8.8\",\n \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("signature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth")
.header("signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"transType\": \"PAY\",\n \"accessType\": \"s2s\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"threeDsType\": \"2.0\",\n \"deviceChannel\": \"string\",\n \"transChannel\": \"WEIXIN\",\n \"transTimeout\": \"string\",\n \"carrierId\": \"carrierId\",\n \"currency\": \"USD\",\n \"transAmt\": \"20.01\",\n \"goodsName\": \"Iphone15\",\n \"dcc\": \"DCC\",\n \"notifyUrl\": \"http://example.com\",\n \"redirectUrl\": \"http://www.gogole.com\",\n \"merchantOrderId\": \"20230424141154\",\n \"customerIp\": \"18.277.26.154\",\n \"payMode\": \"QRCODE\",\n \"payMethodInfo\": {\n \"cardNo\": \"444433******1111\",\n \"expirationMonth\": \"01\",\n \"expirationYear\": \"2026\",\n \"cvv\": \"123\",\n \"firstName\": \"Bren\",\n \"lastName\": \"Qiu\",\n \"phone\": \"18817536697\"\n },\n \"merchantOrderTime\": \"2019-08-24T14:15:22Z\",\n \"osType\": \"IOS\",\n \"merchantRegion\": \"US\",\n \"authCode\": \"133788758877188822\",\n \"appId\": \"wxd678efh567hg6787\",\n \"openId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"reqReserved\": \"reqReserved\",\n \"reserved\": \"reserved\",\n \"buyerId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"customer\": {\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"certificate\": {\n \"number\": \"string\",\n \"type\": \"string\"\n }\n },\n \"subMerchantId\": \"string\",\n \"userAgent\": \"string\",\n \"goods\": [\n {\n \"referenceGoodsId\": \"M1006\",\n \"goodsName\": \"单品惠-6\",\n \"goodsCategory\": \"1001\",\n \"goodsQuantity\": \"100\",\n \"goodsUnitAmount\": \"100.01\"\n }\n ],\n \"store\": {\n \"storeTerminalId\": \"0001\"\n },\n \"browserInfo\": {\n \"acceptHeader\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\",\n \"javaEnabled\": \"true\",\n \"language\": \"en-US\",\n \"colorDepth\": \"160\",\n \"screenHeight\": \"1024\",\n \"screenWidth\": \"648\",\n \"browserTz\": \"string\",\n \"browserIp\": \"8.8.8.8\",\n \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"transType\": \"PAY\",\n \"accessType\": \"s2s\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"threeDsType\": \"2.0\",\n \"deviceChannel\": \"string\",\n \"transChannel\": \"WEIXIN\",\n \"transTimeout\": \"string\",\n \"carrierId\": \"carrierId\",\n \"currency\": \"USD\",\n \"transAmt\": \"20.01\",\n \"goodsName\": \"Iphone15\",\n \"dcc\": \"DCC\",\n \"notifyUrl\": \"http://example.com\",\n \"redirectUrl\": \"http://www.gogole.com\",\n \"merchantOrderId\": \"20230424141154\",\n \"customerIp\": \"18.277.26.154\",\n \"payMode\": \"QRCODE\",\n \"payMethodInfo\": {\n \"cardNo\": \"444433******1111\",\n \"expirationMonth\": \"01\",\n \"expirationYear\": \"2026\",\n \"cvv\": \"123\",\n \"firstName\": \"Bren\",\n \"lastName\": \"Qiu\",\n \"phone\": \"18817536697\"\n },\n \"merchantOrderTime\": \"2019-08-24T14:15:22Z\",\n \"osType\": \"IOS\",\n \"merchantRegion\": \"US\",\n \"authCode\": \"133788758877188822\",\n \"appId\": \"wxd678efh567hg6787\",\n \"openId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"reqReserved\": \"reqReserved\",\n \"reserved\": \"reserved\",\n \"buyerId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"customer\": {\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"certificate\": {\n \"number\": \"string\",\n \"type\": \"string\"\n }\n },\n \"subMerchantId\": \"string\",\n \"userAgent\": \"string\",\n \"goods\": [\n {\n \"referenceGoodsId\": \"M1006\",\n \"goodsName\": \"单品惠-6\",\n \"goodsCategory\": \"1001\",\n \"goodsQuantity\": \"100\",\n \"goodsUnitAmount\": \"100.01\"\n }\n ],\n \"store\": {\n \"storeTerminalId\": \"0001\"\n },\n \"browserInfo\": {\n \"acceptHeader\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\",\n \"javaEnabled\": \"true\",\n \"language\": \"en-US\",\n \"colorDepth\": \"160\",\n \"screenHeight\": \"1024\",\n \"screenWidth\": \"648\",\n \"browserTz\": \"string\",\n \"browserIp\": \"8.8.8.8\",\n \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\"\n }\n}"
response = http.request(request)
puts response.read_body{
"isSuccess": true,
"errCode": "00000003",
"errMessage": "处理中",
"status": "PENDING",
"traceId": "33fae7b7aed1233f",
"data": {
"orderId": "TR1658354573473091584",
"merchantNo": "2023010558663764",
"merchantOrderId": "20230424141154",
"currency": "USD",
"transAmt": "100.01",
"payMethodResponse": {
"isRedirect": "yes",
"redirectMethod": "get",
"termUrl": "string",
"redirectParam": {},
"codeUrl": "weixin://wxpay/bizpayurl?pr=waUjCuPzz"
}
}
}预授权
curl --request POST \
--url https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth \
--header 'Content-Type: application/json' \
--header 'signature: <api-key>' \
--data '
{
"charset": "UTF-8",
"version": "2.0.0",
"transType": "PAY",
"accessType": "s2s",
"signType": "RSA",
"memberId": "2023010558663764",
"merchantId": "2023010558663764",
"threeDsType": "2.0",
"deviceChannel": "string",
"transChannel": "WEIXIN",
"transTimeout": "string",
"carrierId": "carrierId",
"currency": "USD",
"transAmt": "20.01",
"goodsName": "Iphone15",
"dcc": "DCC",
"notifyUrl": "http://example.com",
"redirectUrl": "http://www.gogole.com",
"merchantOrderId": "20230424141154",
"customerIp": "18.277.26.154",
"payMode": "QRCODE",
"payMethodInfo": {
"cardNo": "444433******1111",
"expirationMonth": "01",
"expirationYear": "2026",
"cvv": "123",
"firstName": "Bren",
"lastName": "Qiu",
"phone": "18817536697"
},
"merchantOrderTime": "2019-08-24T14:15:22Z",
"osType": "IOS",
"merchantRegion": "US",
"authCode": "133788758877188822",
"appId": "wxd678efh567hg6787",
"openId": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"reqReserved": "reqReserved",
"reserved": "reserved",
"buyerId": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"address": {
"zipCode": "344104",
"region": "US",
"city": "ShangHai",
"state": "ShangHai",
"phone": "18817536697",
"email": "string",
"address1": "Lou Lan street",
"address2": "Lou Lan street 2"
},
"customer": {
"address": {
"zipCode": "344104",
"region": "US",
"city": "ShangHai",
"state": "ShangHai",
"phone": "18817536697",
"email": "string",
"address1": "Lou Lan street",
"address2": "Lou Lan street 2"
},
"certificate": {
"number": "string",
"type": "string"
}
},
"subMerchantId": "string",
"userAgent": "string",
"goods": [
{
"referenceGoodsId": "M1006",
"goodsName": "单品惠-6",
"goodsCategory": "1001",
"goodsQuantity": "100",
"goodsUnitAmount": "100.01"
}
],
"store": {
"storeTerminalId": "0001"
},
"browserInfo": {
"acceptHeader": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"javaEnabled": "true",
"language": "en-US",
"colorDepth": "160",
"screenHeight": "1024",
"screenWidth": "648",
"browserTz": "string",
"browserIp": "8.8.8.8",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
}
}
'import requests
url = "https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth"
payload = {
"charset": "UTF-8",
"version": "2.0.0",
"transType": "PAY",
"accessType": "s2s",
"signType": "RSA",
"memberId": "2023010558663764",
"merchantId": "2023010558663764",
"threeDsType": "2.0",
"deviceChannel": "string",
"transChannel": "WEIXIN",
"transTimeout": "string",
"carrierId": "carrierId",
"currency": "USD",
"transAmt": "20.01",
"goodsName": "Iphone15",
"dcc": "DCC",
"notifyUrl": "http://example.com",
"redirectUrl": "http://www.gogole.com",
"merchantOrderId": "20230424141154",
"customerIp": "18.277.26.154",
"payMode": "QRCODE",
"payMethodInfo": {
"cardNo": "444433******1111",
"expirationMonth": "01",
"expirationYear": "2026",
"cvv": "123",
"firstName": "Bren",
"lastName": "Qiu",
"phone": "18817536697"
},
"merchantOrderTime": "2019-08-24T14:15:22Z",
"osType": "IOS",
"merchantRegion": "US",
"authCode": "133788758877188822",
"appId": "wxd678efh567hg6787",
"openId": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"reqReserved": "reqReserved",
"reserved": "reserved",
"buyerId": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
"address": {
"zipCode": "344104",
"region": "US",
"city": "ShangHai",
"state": "ShangHai",
"phone": "18817536697",
"email": "string",
"address1": "Lou Lan street",
"address2": "Lou Lan street 2"
},
"customer": {
"address": {
"zipCode": "344104",
"region": "US",
"city": "ShangHai",
"state": "ShangHai",
"phone": "18817536697",
"email": "string",
"address1": "Lou Lan street",
"address2": "Lou Lan street 2"
},
"certificate": {
"number": "string",
"type": "string"
}
},
"subMerchantId": "string",
"userAgent": "string",
"goods": [
{
"referenceGoodsId": "M1006",
"goodsName": "单品惠-6",
"goodsCategory": "1001",
"goodsQuantity": "100",
"goodsUnitAmount": "100.01"
}
],
"store": { "storeTerminalId": "0001" },
"browserInfo": {
"acceptHeader": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"javaEnabled": "true",
"language": "en-US",
"colorDepth": "160",
"screenHeight": "1024",
"screenWidth": "648",
"browserTz": "string",
"browserIp": "8.8.8.8",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
}
}
headers = {
"signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {signature: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
charset: 'UTF-8',
version: '2.0.0',
transType: 'PAY',
accessType: 's2s',
signType: 'RSA',
memberId: '2023010558663764',
merchantId: '2023010558663764',
threeDsType: '2.0',
deviceChannel: 'string',
transChannel: 'WEIXIN',
transTimeout: 'string',
carrierId: 'carrierId',
currency: 'USD',
transAmt: '20.01',
goodsName: 'Iphone15',
dcc: 'DCC',
notifyUrl: 'http://example.com',
redirectUrl: 'http://www.gogole.com',
merchantOrderId: '20230424141154',
customerIp: '18.277.26.154',
payMode: 'QRCODE',
payMethodInfo: {
cardNo: '444433******1111',
expirationMonth: '01',
expirationYear: '2026',
cvv: '123',
firstName: 'Bren',
lastName: 'Qiu',
phone: '18817536697'
},
merchantOrderTime: '2019-08-24T14:15:22Z',
osType: 'IOS',
merchantRegion: 'US',
authCode: '133788758877188822',
appId: 'wxd678efh567hg6787',
openId: 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
reqReserved: 'reqReserved',
reserved: 'reserved',
buyerId: 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
address: {
zipCode: '344104',
region: 'US',
city: 'ShangHai',
state: 'ShangHai',
phone: '18817536697',
email: 'string',
address1: 'Lou Lan street',
address2: 'Lou Lan street 2'
},
customer: {
address: {
zipCode: '344104',
region: 'US',
city: 'ShangHai',
state: 'ShangHai',
phone: '18817536697',
email: 'string',
address1: 'Lou Lan street',
address2: 'Lou Lan street 2'
},
certificate: {number: 'string', type: 'string'}
},
subMerchantId: 'string',
userAgent: 'string',
goods: [
{
referenceGoodsId: 'M1006',
goodsName: '单品惠-6',
goodsCategory: '1001',
goodsQuantity: '100',
goodsUnitAmount: '100.01'
}
],
store: {storeTerminalId: '0001'},
browserInfo: {
acceptHeader: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
javaEnabled: 'true',
language: 'en-US',
colorDepth: '160',
screenHeight: '1024',
screenWidth: '648',
browserTz: 'string',
browserIp: '8.8.8.8',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
}
})
};
fetch('https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'charset' => 'UTF-8',
'version' => '2.0.0',
'transType' => 'PAY',
'accessType' => 's2s',
'signType' => 'RSA',
'memberId' => '2023010558663764',
'merchantId' => '2023010558663764',
'threeDsType' => '2.0',
'deviceChannel' => 'string',
'transChannel' => 'WEIXIN',
'transTimeout' => 'string',
'carrierId' => 'carrierId',
'currency' => 'USD',
'transAmt' => '20.01',
'goodsName' => 'Iphone15',
'dcc' => 'DCC',
'notifyUrl' => 'http://example.com',
'redirectUrl' => 'http://www.gogole.com',
'merchantOrderId' => '20230424141154',
'customerIp' => '18.277.26.154',
'payMode' => 'QRCODE',
'payMethodInfo' => [
'cardNo' => '444433******1111',
'expirationMonth' => '01',
'expirationYear' => '2026',
'cvv' => '123',
'firstName' => 'Bren',
'lastName' => 'Qiu',
'phone' => '18817536697'
],
'merchantOrderTime' => '2019-08-24T14:15:22Z',
'osType' => 'IOS',
'merchantRegion' => 'US',
'authCode' => '133788758877188822',
'appId' => 'wxd678efh567hg6787',
'openId' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'reqReserved' => 'reqReserved',
'reserved' => 'reserved',
'buyerId' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
'address' => [
'zipCode' => '344104',
'region' => 'US',
'city' => 'ShangHai',
'state' => 'ShangHai',
'phone' => '18817536697',
'email' => 'string',
'address1' => 'Lou Lan street',
'address2' => 'Lou Lan street 2'
],
'customer' => [
'address' => [
'zipCode' => '344104',
'region' => 'US',
'city' => 'ShangHai',
'state' => 'ShangHai',
'phone' => '18817536697',
'email' => 'string',
'address1' => 'Lou Lan street',
'address2' => 'Lou Lan street 2'
],
'certificate' => [
'number' => 'string',
'type' => 'string'
]
],
'subMerchantId' => 'string',
'userAgent' => 'string',
'goods' => [
[
'referenceGoodsId' => 'M1006',
'goodsName' => '单品惠-6',
'goodsCategory' => '1001',
'goodsQuantity' => '100',
'goodsUnitAmount' => '100.01'
]
],
'store' => [
'storeTerminalId' => '0001'
],
'browserInfo' => [
'acceptHeader' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
'javaEnabled' => 'true',
'language' => 'en-US',
'colorDepth' => '160',
'screenHeight' => '1024',
'screenWidth' => '648',
'browserTz' => 'string',
'browserIp' => '8.8.8.8',
'userAgent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"signature: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth"
payload := strings.NewReader("{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"transType\": \"PAY\",\n \"accessType\": \"s2s\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"threeDsType\": \"2.0\",\n \"deviceChannel\": \"string\",\n \"transChannel\": \"WEIXIN\",\n \"transTimeout\": \"string\",\n \"carrierId\": \"carrierId\",\n \"currency\": \"USD\",\n \"transAmt\": \"20.01\",\n \"goodsName\": \"Iphone15\",\n \"dcc\": \"DCC\",\n \"notifyUrl\": \"http://example.com\",\n \"redirectUrl\": \"http://www.gogole.com\",\n \"merchantOrderId\": \"20230424141154\",\n \"customerIp\": \"18.277.26.154\",\n \"payMode\": \"QRCODE\",\n \"payMethodInfo\": {\n \"cardNo\": \"444433******1111\",\n \"expirationMonth\": \"01\",\n \"expirationYear\": \"2026\",\n \"cvv\": \"123\",\n \"firstName\": \"Bren\",\n \"lastName\": \"Qiu\",\n \"phone\": \"18817536697\"\n },\n \"merchantOrderTime\": \"2019-08-24T14:15:22Z\",\n \"osType\": \"IOS\",\n \"merchantRegion\": \"US\",\n \"authCode\": \"133788758877188822\",\n \"appId\": \"wxd678efh567hg6787\",\n \"openId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"reqReserved\": \"reqReserved\",\n \"reserved\": \"reserved\",\n \"buyerId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"customer\": {\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"certificate\": {\n \"number\": \"string\",\n \"type\": \"string\"\n }\n },\n \"subMerchantId\": \"string\",\n \"userAgent\": \"string\",\n \"goods\": [\n {\n \"referenceGoodsId\": \"M1006\",\n \"goodsName\": \"单品惠-6\",\n \"goodsCategory\": \"1001\",\n \"goodsQuantity\": \"100\",\n \"goodsUnitAmount\": \"100.01\"\n }\n ],\n \"store\": {\n \"storeTerminalId\": \"0001\"\n },\n \"browserInfo\": {\n \"acceptHeader\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\",\n \"javaEnabled\": \"true\",\n \"language\": \"en-US\",\n \"colorDepth\": \"160\",\n \"screenHeight\": \"1024\",\n \"screenWidth\": \"648\",\n \"browserTz\": \"string\",\n \"browserIp\": \"8.8.8.8\",\n \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("signature", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth")
.header("signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"transType\": \"PAY\",\n \"accessType\": \"s2s\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"threeDsType\": \"2.0\",\n \"deviceChannel\": \"string\",\n \"transChannel\": \"WEIXIN\",\n \"transTimeout\": \"string\",\n \"carrierId\": \"carrierId\",\n \"currency\": \"USD\",\n \"transAmt\": \"20.01\",\n \"goodsName\": \"Iphone15\",\n \"dcc\": \"DCC\",\n \"notifyUrl\": \"http://example.com\",\n \"redirectUrl\": \"http://www.gogole.com\",\n \"merchantOrderId\": \"20230424141154\",\n \"customerIp\": \"18.277.26.154\",\n \"payMode\": \"QRCODE\",\n \"payMethodInfo\": {\n \"cardNo\": \"444433******1111\",\n \"expirationMonth\": \"01\",\n \"expirationYear\": \"2026\",\n \"cvv\": \"123\",\n \"firstName\": \"Bren\",\n \"lastName\": \"Qiu\",\n \"phone\": \"18817536697\"\n },\n \"merchantOrderTime\": \"2019-08-24T14:15:22Z\",\n \"osType\": \"IOS\",\n \"merchantRegion\": \"US\",\n \"authCode\": \"133788758877188822\",\n \"appId\": \"wxd678efh567hg6787\",\n \"openId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"reqReserved\": \"reqReserved\",\n \"reserved\": \"reserved\",\n \"buyerId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"customer\": {\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"certificate\": {\n \"number\": \"string\",\n \"type\": \"string\"\n }\n },\n \"subMerchantId\": \"string\",\n \"userAgent\": \"string\",\n \"goods\": [\n {\n \"referenceGoodsId\": \"M1006\",\n \"goodsName\": \"单品惠-6\",\n \"goodsCategory\": \"1001\",\n \"goodsQuantity\": \"100\",\n \"goodsUnitAmount\": \"100.01\"\n }\n ],\n \"store\": {\n \"storeTerminalId\": \"0001\"\n },\n \"browserInfo\": {\n \"acceptHeader\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\",\n \"javaEnabled\": \"true\",\n \"language\": \"en-US\",\n \"colorDepth\": \"160\",\n \"screenHeight\": \"1024\",\n \"screenWidth\": \"648\",\n \"browserTz\": \"string\",\n \"browserIp\": \"8.8.8.8\",\n \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mpgwpre.payallglobal.com/mp-gateway/api/mapi/v1/payments/open/api/preAuth")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"transType\": \"PAY\",\n \"accessType\": \"s2s\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"threeDsType\": \"2.0\",\n \"deviceChannel\": \"string\",\n \"transChannel\": \"WEIXIN\",\n \"transTimeout\": \"string\",\n \"carrierId\": \"carrierId\",\n \"currency\": \"USD\",\n \"transAmt\": \"20.01\",\n \"goodsName\": \"Iphone15\",\n \"dcc\": \"DCC\",\n \"notifyUrl\": \"http://example.com\",\n \"redirectUrl\": \"http://www.gogole.com\",\n \"merchantOrderId\": \"20230424141154\",\n \"customerIp\": \"18.277.26.154\",\n \"payMode\": \"QRCODE\",\n \"payMethodInfo\": {\n \"cardNo\": \"444433******1111\",\n \"expirationMonth\": \"01\",\n \"expirationYear\": \"2026\",\n \"cvv\": \"123\",\n \"firstName\": \"Bren\",\n \"lastName\": \"Qiu\",\n \"phone\": \"18817536697\"\n },\n \"merchantOrderTime\": \"2019-08-24T14:15:22Z\",\n \"osType\": \"IOS\",\n \"merchantRegion\": \"US\",\n \"authCode\": \"133788758877188822\",\n \"appId\": \"wxd678efh567hg6787\",\n \"openId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"reqReserved\": \"reqReserved\",\n \"reserved\": \"reserved\",\n \"buyerId\": \"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\",\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"customer\": {\n \"address\": {\n \"zipCode\": \"344104\",\n \"region\": \"US\",\n \"city\": \"ShangHai\",\n \"state\": \"ShangHai\",\n \"phone\": \"18817536697\",\n \"email\": \"string\",\n \"address1\": \"Lou Lan street\",\n \"address2\": \"Lou Lan street 2\"\n },\n \"certificate\": {\n \"number\": \"string\",\n \"type\": \"string\"\n }\n },\n \"subMerchantId\": \"string\",\n \"userAgent\": \"string\",\n \"goods\": [\n {\n \"referenceGoodsId\": \"M1006\",\n \"goodsName\": \"单品惠-6\",\n \"goodsCategory\": \"1001\",\n \"goodsQuantity\": \"100\",\n \"goodsUnitAmount\": \"100.01\"\n }\n ],\n \"store\": {\n \"storeTerminalId\": \"0001\"\n },\n \"browserInfo\": {\n \"acceptHeader\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\",\n \"javaEnabled\": \"true\",\n \"language\": \"en-US\",\n \"colorDepth\": \"160\",\n \"screenHeight\": \"1024\",\n \"screenWidth\": \"648\",\n \"browserTz\": \"string\",\n \"browserIp\": \"8.8.8.8\",\n \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\"\n }\n}"
response = http.request(request)
puts response.read_body{
"isSuccess": true,
"errCode": "00000003",
"errMessage": "处理中",
"status": "PENDING",
"traceId": "33fae7b7aed1233f",
"data": {
"orderId": "TR1658354573473091584",
"merchantNo": "2023010558663764",
"merchantOrderId": "20230424141154",
"currency": "USD",
"transAmt": "100.01",
"payMethodResponse": {
"isRedirect": "yes",
"redirectMethod": "get",
"termUrl": "string",
"redirectParam": {},
"codeUrl": "weixin://wxpay/bizpayurl?pr=waUjCuPzz"
}
}
}Authorizations
Example: MIIEpQIBAAKCAQEA...(Base64编码的签名字符串)
加签
加签是开放平台和商户对于交互消息完整性的校验。加签行为主要发生两个部分:
- 商户服务器端针对向PayAllGlobal开放平台发送的请求报文进行加签;
- PayAllGlobal开放平台针对通知商户的异步消息进行加签。 PayAllGlobal平台要求使用 RSA 私钥进行加签, 使用 RSA 公钥进行验签。 因此,在以上两部分描述的交互中, 存在商户公私钥、PayAllGlobal 公私钥,开发者需要使用商户私钥,对第一部分报文进行加签,使用 PayAllGlobal 公钥对第二部分消息进行验签。
加签规则如下:
使用商户私钥对请求体进行 SHA256withRSA 签名后,再进行 Base64 编码的结果。
- 使用 商户私钥对待
request.body进行签名(SHA256WithRSA 计算原始数据的SHA-256哈希值。 使用私钥对哈希值进行签名,即使用私钥对哈希值进行RSA加密。此时得到的加密结果就是数字签名。);
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initSign(privateKey);
// 计算 SHA256withRSA 签名时,需要以 utf-8 的编码转换 byte 流,否则可能导致含中文参数的签名计算不正确
signature.update(request.body);
byte[] signedHash = signature.sign();
- 将加签内容进行 Base64 编码;
String signature = Base64.getEncoder().encodeToString(signedHash);
- 将编码后的内容放在请求头部 signature 参数中。 注意,加签是对 request.body 进行签名,当查询等 request.body 为空时,则无需加签。
Body
交互数据的编码【utf-8】
"UTF-8"
接口版本,当前版本为【2.0.0】,目前只能传2.0.0,不能不传
"2.0.0"
交易类型
PAY: 消费支付, CREDIT_CARD: 信用卡支付, 3D_PREAUTH_VOIDS: 3D 预授权撤销, 3D_PREAUTH_COMPLETION: 3D 预授权完成, REFUND: 退款, VOIDS: 撤销, QUERY: 查询, TRANSFER: 转账, DOWNLOAD: 文件下载, REGISTRATION: 商户注册, FILEUPLOAD: 文件上传, INQUIRYREGISTRATIONSTATUS: 查询注册状态, AUTHORIZE: 授权, CASHIER_PAY: 收银台支付 接口接入类型,固定为服务端到服务端(s2s)模式
"s2s"
报文签名类型,当前支持RSA。
"RSA"
机构号,商户侧唯一标识
"2023010558663764"
商户号,商户唯一标识
"2023010558663764"
支付渠道
WEIXIN, UNIONPAY, ALIPAY_CN, ALIPAY_HK, GCASH, BPI, TNG, BOOST, DANA, KAKAOPAY, TRUEMONEY, BRAZIL_PIX, Ewallet_PicPay, Khipu, RABBIT_LINE_PAY, ALIPAY_INSTORE, NAVERPAY, TOSSPAY, MAYA, BILLEASE, GoPay, OVO, DOKU, Dragonpay, Konbini, PayEasy, GrabPay, PAYCO, MPAY, PROMPT_PAY, HIPAY, TINABA, KREDIVO_ID, AKULAKU_PAYLATER, KPLUS, QRPH, BANK_TRANSFER, KOREAN_CARDS 订单金额 请按照4217币种的最小单位传递 eg.(CNY) 110.86 (JPY) 1110
"20.01"
商户订单号
"20230424141154"
交易类型 更多描述参考 支付方式 [blocked]
QRCODE, MICROPAY, JSAPI, MINIPROGRAM, APP, H5, 3D, FIXEDCODE "QRCODE"
商户订单时间
商户所在地区
"US"
使用3d交易必传(示例值 1.0 2.0)
"2.0"
设备渠道
订单有效时长(整数格式 单位:分钟)
发生交易的网站域名或者APP名称
"carrierId"
商品名称,多个商品 用";"隔开
"Iphone15"
交易是否走DCC 传送:dcc
"DCC"
异步通知地址
10 - 200前台回调地址
"http://www.gogole.com"
用户ip
"18.277.26.154"
Show child attributes
Show child attributes
手机操作系统类型(支付类型为APP时必传)
"IOS"
授权码(支付渠道为WEIXIN且支付类型为MICROPAY时需传值)
"133788758877188822"
公众账号ID
"wxd678efh567hg6787"
应用内用户ID
"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"
商户扩展字段
"reqReserved"
保留字段
"reserved"
商户用户ID(支付渠道为BRAZIL_PIX必传)
"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
OK
是否成功,true表示成功,false表示失败
true
响应状态码,errCode为00000000表示响应成功,其他状态码表示响应失败。具体系统错误码可以参考系统错误码。
"00000003"
错误消息
"处理中"
订单状态(见补充说明)
"PENDING:处理中"
"SUCCESS:成功"
"FAIL:失败"
请求消息唯一标识。traceId为本次调用产生的流水号,接口调用异常,可以提供此流水号用于排查问题。
"33fae7b7aed1233f"
Show child attributes
Show child attributes