收银台-下单
curl --request POST \
--url https://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout \
--header 'Content-Type: application/json' \
--header 'signature: <api-key>' \
--data '
{
"charset": "UTF-8",
"version": "2.0.0",
"signType": "RSA",
"memberId": "2023010558663764",
"merchantId": "2023010558663764",
"requestTime": "2024-05-24T14:29:32.682+08:00",
"keyVersion": "1",
"data": {
"merchantOrderId": "ORD202604231532478921",
"integrate": "Direct",
"captureMode": "MANUAL",
"subject": "Iphone 16",
"totalAmount": "10.01",
"currency": "USD",
"country": "US",
"userId": "U123333333",
"expireTime": "1800",
"paymentDetail": {
"paymentMethodType": "WALLET",
"targetOrg": "KLARNA",
"buyerInfo": {
"firstName": "John",
"middleName": "Michael",
"email": "john.tan@example.com",
"lastName": "Tan",
"phoneNo": "+6591234567",
"phoneNoRegion": "+65",
"idType": "PASSPORT",
"idNo": "E12345678",
"taxType": "CPF",
"taxNo": "123.456.789-09",
"address": "10 Anson Road, #25-08 International Plaza",
"city": "Singapore",
"region": "Central",
"zipCode": "079903",
"clientIp": "203.0.113.42",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15"
},
"paymentTokenID": "ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a",
"tokenForFutureUse": true,
"merchantInitiated": "false",
"mitType": "SCHEDULED",
"info3DSecure": {
"threeDSVersion": "2.2.0",
"eci": "05",
"cavv": "AAABBBCCCDDDEEE111222333",
"dsTransactionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"xid": "MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=="
},
"carrierId": "qiye"
},
"goodsDetails": [
{
"goodsId": "SKU_1000001",
"goodsName": "Wireless Bluetooth Earbuds",
"quantity": "1",
"price": "10.01",
"goodsCurrency": "USD",
"showUrl": "https://example.com/product/sku_1000001",
"goodsCategory": "Electronics"
}
],
"subMerchant": {
"subMerchantNo": "SM202604270001"
},
"shippingInfo": {
"firstName": "John",
"middleName": "string",
"lastName": "John",
"phoneNo": "+6598765432",
"email": "john.tan@example.com",
"address1": "10 Anson Road",
"city": "Singapore",
"region": "Central",
"state": "string",
"country": "SG",
"zipCode": "079903",
"address2": "#25-08 International Plaza",
"address3": "string"
},
"billingInfo": {
"firstName": "John",
"middleName": "Michael",
"lastName": "Tan",
"phoneNo": "+6591234567",
"email": "john.tan@example.com",
"address1": "10 Anson Road",
"city": "Singapore",
"country": "SG",
"region": "Central",
"state": "string",
"zipCode": "079903",
"address2": "#25-08 International Plaza",
"address3": "string"
},
"envInfo": {
"deviceId": "a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f",
"deviceLanguage": "en-US",
"screenHeight": "956",
"screenWidth": "440",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
},
"language": "EN",
"riskParams": {},
"terminalType": "APP",
"osType": "ANDROID",
"reference": "goods reference",
"frontCallbackUrl": "https://www.google.com",
"notifyUrl": "https://www.google.com",
"subscriptionPlan": {
"subscriptionNo": "SUB_202604270001"
}
}
}
'import requests
url = "https://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout"
payload = {
"charset": "UTF-8",
"version": "2.0.0",
"signType": "RSA",
"memberId": "2023010558663764",
"merchantId": "2023010558663764",
"requestTime": "2024-05-24T14:29:32.682+08:00",
"keyVersion": "1",
"data": {
"merchantOrderId": "ORD202604231532478921",
"integrate": "Direct",
"captureMode": "MANUAL",
"subject": "Iphone 16",
"totalAmount": "10.01",
"currency": "USD",
"country": "US",
"userId": "U123333333",
"expireTime": "1800",
"paymentDetail": {
"paymentMethodType": "WALLET",
"targetOrg": "KLARNA",
"buyerInfo": {
"firstName": "John",
"middleName": "Michael",
"email": "john.tan@example.com",
"lastName": "Tan",
"phoneNo": "+6591234567",
"phoneNoRegion": "+65",
"idType": "PASSPORT",
"idNo": "E12345678",
"taxType": "CPF",
"taxNo": "123.456.789-09",
"address": "10 Anson Road, #25-08 International Plaza",
"city": "Singapore",
"region": "Central",
"zipCode": "079903",
"clientIp": "203.0.113.42",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15"
},
"paymentTokenID": "ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a",
"tokenForFutureUse": True,
"merchantInitiated": "false",
"mitType": "SCHEDULED",
"info3DSecure": {
"threeDSVersion": "2.2.0",
"eci": "05",
"cavv": "AAABBBCCCDDDEEE111222333",
"dsTransactionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"xid": "MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=="
},
"carrierId": "qiye"
},
"goodsDetails": [
{
"goodsId": "SKU_1000001",
"goodsName": "Wireless Bluetooth Earbuds",
"quantity": "1",
"price": "10.01",
"goodsCurrency": "USD",
"showUrl": "https://example.com/product/sku_1000001",
"goodsCategory": "Electronics"
}
],
"subMerchant": { "subMerchantNo": "SM202604270001" },
"shippingInfo": {
"firstName": "John",
"middleName": "string",
"lastName": "John",
"phoneNo": "+6598765432",
"email": "john.tan@example.com",
"address1": "10 Anson Road",
"city": "Singapore",
"region": "Central",
"state": "string",
"country": "SG",
"zipCode": "079903",
"address2": "#25-08 International Plaza",
"address3": "string"
},
"billingInfo": {
"firstName": "John",
"middleName": "Michael",
"lastName": "Tan",
"phoneNo": "+6591234567",
"email": "john.tan@example.com",
"address1": "10 Anson Road",
"city": "Singapore",
"country": "SG",
"region": "Central",
"state": "string",
"zipCode": "079903",
"address2": "#25-08 International Plaza",
"address3": "string"
},
"envInfo": {
"deviceId": "a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f",
"deviceLanguage": "en-US",
"screenHeight": "956",
"screenWidth": "440",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
},
"language": "EN",
"riskParams": {},
"terminalType": "APP",
"osType": "ANDROID",
"reference": "goods reference",
"frontCallbackUrl": "https://www.google.com",
"notifyUrl": "https://www.google.com",
"subscriptionPlan": { "subscriptionNo": "SUB_202604270001" }
}
}
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',
signType: 'RSA',
memberId: '2023010558663764',
merchantId: '2023010558663764',
requestTime: '2024-05-24T14:29:32.682+08:00',
keyVersion: '1',
data: {
merchantOrderId: 'ORD202604231532478921',
integrate: 'Direct',
captureMode: 'MANUAL',
subject: 'Iphone 16',
totalAmount: '10.01',
currency: 'USD',
country: 'US',
userId: 'U123333333',
expireTime: '1800',
paymentDetail: {
paymentMethodType: 'WALLET',
targetOrg: 'KLARNA',
buyerInfo: {
firstName: 'John',
middleName: 'Michael',
email: 'john.tan@example.com',
lastName: 'Tan',
phoneNo: '+6591234567',
phoneNoRegion: '+65',
idType: 'PASSPORT',
idNo: 'E12345678',
taxType: 'CPF',
taxNo: '123.456.789-09',
address: '10 Anson Road, #25-08 International Plaza',
city: 'Singapore',
region: 'Central',
zipCode: '079903',
clientIp: '203.0.113.42',
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15'
},
paymentTokenID: 'ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a',
tokenForFutureUse: true,
merchantInitiated: 'false',
mitType: 'SCHEDULED',
info3DSecure: {
threeDSVersion: '2.2.0',
eci: '05',
cavv: 'AAABBBCCCDDDEEE111222333',
dsTransactionId: 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
xid: 'MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=='
},
carrierId: 'qiye'
},
goodsDetails: [
{
goodsId: 'SKU_1000001',
goodsName: 'Wireless Bluetooth Earbuds',
quantity: '1',
price: '10.01',
goodsCurrency: 'USD',
showUrl: 'https://example.com/product/sku_1000001',
goodsCategory: 'Electronics'
}
],
subMerchant: {subMerchantNo: 'SM202604270001'},
shippingInfo: {
firstName: 'John',
middleName: 'string',
lastName: 'John',
phoneNo: '+6598765432',
email: 'john.tan@example.com',
address1: '10 Anson Road',
city: 'Singapore',
region: 'Central',
state: 'string',
country: 'SG',
zipCode: '079903',
address2: '#25-08 International Plaza',
address3: 'string'
},
billingInfo: {
firstName: 'John',
middleName: 'Michael',
lastName: 'Tan',
phoneNo: '+6591234567',
email: 'john.tan@example.com',
address1: '10 Anson Road',
city: 'Singapore',
country: 'SG',
region: 'Central',
state: 'string',
zipCode: '079903',
address2: '#25-08 International Plaza',
address3: 'string'
},
envInfo: {
deviceId: 'a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f',
deviceLanguage: 'en-US',
screenHeight: '956',
screenWidth: '440',
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1'
},
language: 'EN',
riskParams: {},
terminalType: 'APP',
osType: 'ANDROID',
reference: 'goods reference',
frontCallbackUrl: 'https://www.google.com',
notifyUrl: 'https://www.google.com',
subscriptionPlan: {subscriptionNo: 'SUB_202604270001'}
}
})
};
fetch('https://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout', 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://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout",
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',
'signType' => 'RSA',
'memberId' => '2023010558663764',
'merchantId' => '2023010558663764',
'requestTime' => '2024-05-24T14:29:32.682+08:00',
'keyVersion' => '1',
'data' => [
'merchantOrderId' => 'ORD202604231532478921',
'integrate' => 'Direct',
'captureMode' => 'MANUAL',
'subject' => 'Iphone 16',
'totalAmount' => '10.01',
'currency' => 'USD',
'country' => 'US',
'userId' => 'U123333333',
'expireTime' => '1800',
'paymentDetail' => [
'paymentMethodType' => 'WALLET',
'targetOrg' => 'KLARNA',
'buyerInfo' => [
'firstName' => 'John',
'middleName' => 'Michael',
'email' => 'john.tan@example.com',
'lastName' => 'Tan',
'phoneNo' => '+6591234567',
'phoneNoRegion' => '+65',
'idType' => 'PASSPORT',
'idNo' => 'E12345678',
'taxType' => 'CPF',
'taxNo' => '123.456.789-09',
'address' => '10 Anson Road, #25-08 International Plaza',
'city' => 'Singapore',
'region' => 'Central',
'zipCode' => '079903',
'clientIp' => '203.0.113.42',
'userAgent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15'
],
'paymentTokenID' => 'ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a',
'tokenForFutureUse' => true,
'merchantInitiated' => 'false',
'mitType' => 'SCHEDULED',
'info3DSecure' => [
'threeDSVersion' => '2.2.0',
'eci' => '05',
'cavv' => 'AAABBBCCCDDDEEE111222333',
'dsTransactionId' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'xid' => 'MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=='
],
'carrierId' => 'qiye'
],
'goodsDetails' => [
[
'goodsId' => 'SKU_1000001',
'goodsName' => 'Wireless Bluetooth Earbuds',
'quantity' => '1',
'price' => '10.01',
'goodsCurrency' => 'USD',
'showUrl' => 'https://example.com/product/sku_1000001',
'goodsCategory' => 'Electronics'
]
],
'subMerchant' => [
'subMerchantNo' => 'SM202604270001'
],
'shippingInfo' => [
'firstName' => 'John',
'middleName' => 'string',
'lastName' => 'John',
'phoneNo' => '+6598765432',
'email' => 'john.tan@example.com',
'address1' => '10 Anson Road',
'city' => 'Singapore',
'region' => 'Central',
'state' => 'string',
'country' => 'SG',
'zipCode' => '079903',
'address2' => '#25-08 International Plaza',
'address3' => 'string'
],
'billingInfo' => [
'firstName' => 'John',
'middleName' => 'Michael',
'lastName' => 'Tan',
'phoneNo' => '+6591234567',
'email' => 'john.tan@example.com',
'address1' => '10 Anson Road',
'city' => 'Singapore',
'country' => 'SG',
'region' => 'Central',
'state' => 'string',
'zipCode' => '079903',
'address2' => '#25-08 International Plaza',
'address3' => 'string'
],
'envInfo' => [
'deviceId' => 'a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f',
'deviceLanguage' => 'en-US',
'screenHeight' => '956',
'screenWidth' => '440',
'userAgent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1'
],
'language' => 'EN',
'riskParams' => [
],
'terminalType' => 'APP',
'osType' => 'ANDROID',
'reference' => 'goods reference',
'frontCallbackUrl' => 'https://www.google.com',
'notifyUrl' => 'https://www.google.com',
'subscriptionPlan' => [
'subscriptionNo' => 'SUB_202604270001'
]
]
]),
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://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout"
payload := strings.NewReader("{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"requestTime\": \"2024-05-24T14:29:32.682+08:00\",\n \"keyVersion\": \"1\",\n \"data\": {\n \"merchantOrderId\": \"ORD202604231532478921\",\n \"integrate\": \"Direct\",\n \"captureMode\": \"MANUAL\",\n \"subject\": \"Iphone 16\",\n \"totalAmount\": \"10.01\",\n \"currency\": \"USD\",\n \"country\": \"US\",\n \"userId\": \"U123333333\",\n \"expireTime\": \"1800\",\n \"paymentDetail\": {\n \"paymentMethodType\": \"WALLET\",\n \"targetOrg\": \"KLARNA\",\n \"buyerInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"email\": \"john.tan@example.com\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"phoneNoRegion\": \"+65\",\n \"idType\": \"PASSPORT\",\n \"idNo\": \"E12345678\",\n \"taxType\": \"CPF\",\n \"taxNo\": \"123.456.789-09\",\n \"address\": \"10 Anson Road, #25-08 International Plaza\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"zipCode\": \"079903\",\n \"clientIp\": \"203.0.113.42\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15\"\n },\n \"paymentTokenID\": \"ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a\",\n \"tokenForFutureUse\": true,\n \"merchantInitiated\": \"false\",\n \"mitType\": \"SCHEDULED\",\n \"info3DSecure\": {\n \"threeDSVersion\": \"2.2.0\",\n \"eci\": \"05\",\n \"cavv\": \"AAABBBCCCDDDEEE111222333\",\n \"dsTransactionId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"xid\": \"MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw==\"\n },\n \"carrierId\": \"qiye\"\n },\n \"goodsDetails\": [\n {\n \"goodsId\": \"SKU_1000001\",\n \"goodsName\": \"Wireless Bluetooth Earbuds\",\n \"quantity\": \"1\",\n \"price\": \"10.01\",\n \"goodsCurrency\": \"USD\",\n \"showUrl\": \"https://example.com/product/sku_1000001\",\n \"goodsCategory\": \"Electronics\"\n }\n ],\n \"subMerchant\": {\n \"subMerchantNo\": \"SM202604270001\"\n },\n \"shippingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"string\",\n \"lastName\": \"John\",\n \"phoneNo\": \"+6598765432\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"country\": \"SG\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"billingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"country\": \"SG\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"envInfo\": {\n \"deviceId\": \"a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f\",\n \"deviceLanguage\": \"en-US\",\n \"screenHeight\": \"956\",\n \"screenWidth\": \"440\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1\"\n },\n \"language\": \"EN\",\n \"riskParams\": {},\n \"terminalType\": \"APP\",\n \"osType\": \"ANDROID\",\n \"reference\": \"goods reference\",\n \"frontCallbackUrl\": \"https://www.google.com\",\n \"notifyUrl\": \"https://www.google.com\",\n \"subscriptionPlan\": {\n \"subscriptionNo\": \"SUB_202604270001\"\n }\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://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout")
.header("signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"requestTime\": \"2024-05-24T14:29:32.682+08:00\",\n \"keyVersion\": \"1\",\n \"data\": {\n \"merchantOrderId\": \"ORD202604231532478921\",\n \"integrate\": \"Direct\",\n \"captureMode\": \"MANUAL\",\n \"subject\": \"Iphone 16\",\n \"totalAmount\": \"10.01\",\n \"currency\": \"USD\",\n \"country\": \"US\",\n \"userId\": \"U123333333\",\n \"expireTime\": \"1800\",\n \"paymentDetail\": {\n \"paymentMethodType\": \"WALLET\",\n \"targetOrg\": \"KLARNA\",\n \"buyerInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"email\": \"john.tan@example.com\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"phoneNoRegion\": \"+65\",\n \"idType\": \"PASSPORT\",\n \"idNo\": \"E12345678\",\n \"taxType\": \"CPF\",\n \"taxNo\": \"123.456.789-09\",\n \"address\": \"10 Anson Road, #25-08 International Plaza\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"zipCode\": \"079903\",\n \"clientIp\": \"203.0.113.42\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15\"\n },\n \"paymentTokenID\": \"ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a\",\n \"tokenForFutureUse\": true,\n \"merchantInitiated\": \"false\",\n \"mitType\": \"SCHEDULED\",\n \"info3DSecure\": {\n \"threeDSVersion\": \"2.2.0\",\n \"eci\": \"05\",\n \"cavv\": \"AAABBBCCCDDDEEE111222333\",\n \"dsTransactionId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"xid\": \"MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw==\"\n },\n \"carrierId\": \"qiye\"\n },\n \"goodsDetails\": [\n {\n \"goodsId\": \"SKU_1000001\",\n \"goodsName\": \"Wireless Bluetooth Earbuds\",\n \"quantity\": \"1\",\n \"price\": \"10.01\",\n \"goodsCurrency\": \"USD\",\n \"showUrl\": \"https://example.com/product/sku_1000001\",\n \"goodsCategory\": \"Electronics\"\n }\n ],\n \"subMerchant\": {\n \"subMerchantNo\": \"SM202604270001\"\n },\n \"shippingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"string\",\n \"lastName\": \"John\",\n \"phoneNo\": \"+6598765432\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"country\": \"SG\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"billingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"country\": \"SG\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"envInfo\": {\n \"deviceId\": \"a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f\",\n \"deviceLanguage\": \"en-US\",\n \"screenHeight\": \"956\",\n \"screenWidth\": \"440\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1\"\n },\n \"language\": \"EN\",\n \"riskParams\": {},\n \"terminalType\": \"APP\",\n \"osType\": \"ANDROID\",\n \"reference\": \"goods reference\",\n \"frontCallbackUrl\": \"https://www.google.com\",\n \"notifyUrl\": \"https://www.google.com\",\n \"subscriptionPlan\": {\n \"subscriptionNo\": \"SUB_202604270001\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout")
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 \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"requestTime\": \"2024-05-24T14:29:32.682+08:00\",\n \"keyVersion\": \"1\",\n \"data\": {\n \"merchantOrderId\": \"ORD202604231532478921\",\n \"integrate\": \"Direct\",\n \"captureMode\": \"MANUAL\",\n \"subject\": \"Iphone 16\",\n \"totalAmount\": \"10.01\",\n \"currency\": \"USD\",\n \"country\": \"US\",\n \"userId\": \"U123333333\",\n \"expireTime\": \"1800\",\n \"paymentDetail\": {\n \"paymentMethodType\": \"WALLET\",\n \"targetOrg\": \"KLARNA\",\n \"buyerInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"email\": \"john.tan@example.com\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"phoneNoRegion\": \"+65\",\n \"idType\": \"PASSPORT\",\n \"idNo\": \"E12345678\",\n \"taxType\": \"CPF\",\n \"taxNo\": \"123.456.789-09\",\n \"address\": \"10 Anson Road, #25-08 International Plaza\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"zipCode\": \"079903\",\n \"clientIp\": \"203.0.113.42\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15\"\n },\n \"paymentTokenID\": \"ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a\",\n \"tokenForFutureUse\": true,\n \"merchantInitiated\": \"false\",\n \"mitType\": \"SCHEDULED\",\n \"info3DSecure\": {\n \"threeDSVersion\": \"2.2.0\",\n \"eci\": \"05\",\n \"cavv\": \"AAABBBCCCDDDEEE111222333\",\n \"dsTransactionId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"xid\": \"MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw==\"\n },\n \"carrierId\": \"qiye\"\n },\n \"goodsDetails\": [\n {\n \"goodsId\": \"SKU_1000001\",\n \"goodsName\": \"Wireless Bluetooth Earbuds\",\n \"quantity\": \"1\",\n \"price\": \"10.01\",\n \"goodsCurrency\": \"USD\",\n \"showUrl\": \"https://example.com/product/sku_1000001\",\n \"goodsCategory\": \"Electronics\"\n }\n ],\n \"subMerchant\": {\n \"subMerchantNo\": \"SM202604270001\"\n },\n \"shippingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"string\",\n \"lastName\": \"John\",\n \"phoneNo\": \"+6598765432\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"country\": \"SG\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"billingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"country\": \"SG\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"envInfo\": {\n \"deviceId\": \"a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f\",\n \"deviceLanguage\": \"en-US\",\n \"screenHeight\": \"956\",\n \"screenWidth\": \"440\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1\"\n },\n \"language\": \"EN\",\n \"riskParams\": {},\n \"terminalType\": \"APP\",\n \"osType\": \"ANDROID\",\n \"reference\": \"goods reference\",\n \"frontCallbackUrl\": \"https://www.google.com\",\n \"notifyUrl\": \"https://www.google.com\",\n \"subscriptionPlan\": {\n \"subscriptionNo\": \"SUB_202604270001\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": "00000003",
"message": "处理中",
"traceId": "33fae7b7aed1233f",
"data": {
"status": "SUCCESS",
"merchantId": "2023010558663764",
"merchantOrderId": "167812677182888888",
"orderId": "TR1658354573473091584",
"currency": "USD",
"totalAmount": "10.01",
"nextAction": {
"method": "GET",
"type": "redirect",
"url": "https://checkout1.uat.payloco.com/standalone/checkout?intent_id=int1973308631638400&client_secret=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJpbnQxOTczMzA4NjMxNjM4NDAwIiwiaWF0IjoxNzg1ODMwMTE0LCJleHAiOjE3ODY4MzAxMTQsImtleSI6IjA1NmM3YjQxLWJmNTAtNDk1Mi1iZjdlLTZkYzNiOTFmYzM2OSIsInRhcmdldE9yZyI6IiIsImNvdW50cnlfY29kZSI6IklEIiwib3JkZXJBbW91bnQiOiIxMDAwMC4wMCIsIm9yZGVyQ3VycmVuY3kiOiJJRFIiLCJtZXJjaGFudElkIjoiODUxMjczMDAwMDcyIiwibWVyY2hhbnRPcmRlcklkIjoiMTc4NTgzMDEwOTI2NSIsInR4bk9yZGVySWQiOiJpbnQxOTczMzA4NjMxNjM4NDAwIn0.6njUs7zNuL3HFvGTS6Y_TwyoKZWJ9se9PF-hDaDQRvA&mode=payment¤cy=IDR&timeOut=10000000&targetOrg=&appVersion=v1.938.2"
}
}
}Authorizations
加签(Signature)
加签是 Payloco 开放平台与商户之间用于保障报文完整性和防篡改的安全机制。
适用场景
- 商户请求 Payloco:商户使用自身私钥对请求报文进行加签。
- Payloco 返回响应:商户使用 Payloco 公钥 对响应报文进行验签。
加签规则(商户请求端)
商户需对 HTTP 请求的 Body 进行签名,具体步骤如下:
1. 计算签名(SHA256withRSA)
Signature signature = Signature.getInstance("SHA256withRSA"); signature.initSign(merchantPrivateKey); // 必须使用 UTF-8 编码 byte[] bodyBytes = requestBody.getBytes(StandardCharsets.UTF_8); signature.update(bodyBytes); byte[] signedBytes = signature.sign();
2. 将加签内容进行 Base64 编码;
String signature = Base64.getEncoder().encodeToString(signedHash);
3. 将编码后的内容放在请求头部 signature 参数中。
POST /v2/payments/open/api/pay HTTP/1.1 Content-Type: application/json signature: MIIC8jCCAdqgAwIBAgI...
Headers
签名
"FPFVT3o227JrFRbqu19boZCpVVTF9KznxyRawUmxpfXilHV/0yK46haPhAjNu1hPUMy7Vw/ILXhfzffNm4Fj0apWknlTY9OJxnSoQxS9BTFtc61tn5yV1q69x/kkBl82/qwg+XTJ4fOzy7Mar3VaC1E2PlDA6RkkKBUyNE6RYgsdB+Su7an4+4HVTNAnoe74WyvBgxTLMNg28igBTdqxaO3w/UBY6ObVp7vkqkQGdL1Y+HgmMYaAVwrM3+ALWGId0sJ+YqTY4WJ+0xCRGhaSnybiIjZsQEYyID68WNUfuavDLDsEhaMm/HfQvf5p0R1Ltovp3wwJnEbQcjY458iX5A=="
Body
交互数据的编码【utf-8】
"UTF-8"
接口版本,当前版本为【2.0.0】,目前只能传2.0.0,不能不传
8"2.0.0"
报文签名类型
"RSA"
机构号
"2023010558663764"
商户号
32"2023010558663764"
请求时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ssSSS+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2026-05-20T13:29:35.262+08:00表示,北京时间2026年5月20日13点29分35秒。
32"2026-05-24T14:29:32.682+08:00"
密钥版本 当前值为:1
8"1"
请求数据体
Hide child attributes
Hide child attributes
商户订单号,唯一标识商户的一笔交易,不能重复,只能包含字母、数字、下划线且不支持大小写敏感。如:AAA和AAa被认为是相同的。
64"ORD202604231532478921"
商户自行进行付款方支付信息的收集后,传送给Payloco进行交易处理,需传入参数:Cashier
Cashier, Direct, DropIn, PayLink, Token "Cashier"
订单标题或产品信息,会展示在用户支付页面,避免使用纯数字。注:巴西钱包Pix不能超过43位
256"Iphone 16"
订单币种ISO4217币种的字母码 eg. USD, CNY, EUR
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SLL, SOS, SRD, SSP, STD, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL "USD"
国家代码,大写字母
AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BQ, BA, BW, BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL, CN, CX, CC, CO, KM, CG, CD, CK, CR, CI, HR, CU, CW, CY, CZ, DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI, FR, GF, PF, TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW, KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, MO, MK, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, NL, NC, NZ, NI, NE, NG, NU, NF, MP, NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RE, RO, RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, ES, LK, SD, SR, SJ, SZ, SE, CH, SY, TW, TJ, TZ, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, UG, UA, AE, GB, UM, UY, UZ, VU, VE, VN, VG, VI, WF, EH, YE, ZM, ZW, US "US"
支付信息
Hide child attributes
Hide child attributes
目标机构除paymentMethodType为CARD外均必填
KLARNA, PIX, DANA, BANKTRANSFER, JKOPAY, GASH, OKMART, HILIFE, FAMILYMART, 7-ELEVEN, TAIWANMOBILE, FETNET, YUSHANEPAYMENT, YUSHANBANK, SHOPEEPAY, PAOTANGPAY, LINEPAY, PROMPTPAY_CS, PROMPTPAY, SCB_TH, KRUNGTHAI, KASIKORN, BANGKOK, QRPH, GCASH, TRUEMONEY, SMBILL, GRABPAY, TNG, FPX, OXXO, TOSS, SSGPAY, SAMSUNGPAY, PAYCO, NAVERPAY, KAKAOPAY, DOMESTICCARD, TMONEY, EGGMONEY, CULTURELAND, TOSS, PAYPAY, WEBMONEY, LAWSON, FAMILYMART, DAILYYAMAZAKI, 7-ELEVEN, PAYEASY, KLARNA, SHOPEEPAY, OVO, GOPAY, DANA, CARDPAY, QRIS, MINISTOP 卡信息
Hide child attributes
Hide child attributes
卡号
19"4111111111111111"
持卡人姓名
64"John Tan"
卡有效期-月,两位月份
2"12"
卡有效期-年,只取后两位年份
2"28"
卡cvv,Visa和MasterCard为3位数字,AEMX为4位数字
4"123"
代表该笔卡支付交易是否已存卡。 已存卡:Y 未存卡:不填或者其他值
4"true"
动态3ds(参数不区分大小写) do3DS:为此订单执行3DS Secure no3DS:不为此订单执行3DS Secure ext3DS:使用外部3DS结果,适用于已经对接了其他3DS服务的商户,指定该值时,则必须同时传入info3DSecure对象
未传或传入其他值,由Payloco判断是否发起3ds
64"true"
用户基本信息
Hide child attributes
Hide child attributes
用户名 注:巴西HIPERCAR、ELO卡支付时必传
64"John"
用户中间名
64"Michael"
用户邮箱 注:巴西HIPERCAR、ELO卡支付时必传
255"john.tan@example.com"
用户姓 注:巴西HIPERCAR、ELO卡支付时必传
64"Tan"
用户手机号 注:土耳其卡支付时必传
32"+6591234567"
手机号区号 注:土耳其卡支付时必传
16"+65"
证件类型
32"PASSPORT"
证件号
64"E12345678"
税类型,参见【[各国税类型和税号规则] 注:巴西国家该字段必须传入CPF
32"CPF"
税号,参见[各国税类型和税号规则] 注:巴西国家该字段必填,为巴西身份证号
"123.456.789-09"
用户地址
1024"10 Anson Road, #25-08 International Plaza"
用户所在城市
64"Singapore"
用户所在区域
64"Central"
邮编
32"079903"
用户IP地址,须为标准IPv4或IPv6格式。
"203.0.113.42"
用户浏览器信息
"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15"
Payloco token,授权成功后支付
"ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a"
true代表用户已授权进行支付信息绑定,用于后续使用,默认为false
代表是否为MIT交易,不传默认为false
"false"
代扣类型。
SCHEDULED, UNSCHEDULED Hide child attributes
Hide child attributes
3ds版本号
"2.2.0"
eci值
"05"
cavv值
"AAABBBCCCDDDEEE111222333"
dsTransactionId值
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
xid值
"MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=="
发生交易的网站域名或者APP名称
"qiye"
设备终端,WEB,WAP,APP
WEB, WAP, APP "APP"
请款模式:MANUAL
"MANUAL"
商户内部的用户Id,需要保证每个ID唯一性。
64"U123333333"
指定关单时间(单位:秒)。
1)expireTime 传值时:
- 当expireTime<=30min:则关单时间为30min
- 当24hour>=expireTime>=30min:则关单时间为expireTime
- 当expireTime>=24hour:则关单时间为24hour
2)expireTime 未传值时:
- 除纯API模式和前置组件的card/applepay/googlepay 关单时间为30min外,其他取这笔订单发起过的支付方式关单时间 [blocked]的最大值。
"1800"
商品信息,支持传多个。注意:电商场景下需要上送。如果传入该对象,则内层必填字段必须传入
Hide child attributes
Hide child attributes
商品ID
"SKU_1000001"
商品名称
"Wireless Bluetooth Earbuds"
商品数量
"2"
商品价格,商户系统的报价
"59.99"
商品报价币种,大写字母
"USD"
商品链接地址。注:电商场景下需要上送。
"https://example.com/product/sku_1000001"
商品类别。注:电商场景下需要上送。
"Electronics"
邮寄信息 注:电商场景下需要上送。如果传入该对象,则内层必填字段必须传入
Hide child attributes
Hide child attributes
收货人中间名
"John"
收货人中间名
收货人姓
"John"
收货人手机号
"+6598765432"
收货邮箱地址
"john.tan@example.com"
收货地址1
"10 Anson Road"
收货地址所在城市
"Singapore"
收货地址所在区域
"Central"
收货地址所在州 送货到加拿大,美国,英国,澳大利亚时必填
收货地址邮编
"SG"
收货地址邮编
"079903"
收货地址2
"#25-08 International Plaza"
收货地址3
信用卡账单信息。注:如果传入该对象,则内层必填字段必须传入
Hide child attributes
Hide child attributes
账单人名
"John"
账单人中间名
"Michael"
账单人姓
"Tan"
账单人手机号
"+6591234567"
账单邮箱地址
"john.tan@example.com"
账单地址1
"10 Anson Road"
账单地址所在城市
"Singapore"
账单地址所在国家
"SG"
账单地址所在区域
"Central"
账单地址所在州 送货到加拿大,美国,英国,澳大利亚时需要上送
账单地址邮编
"079903"
账单地址2
"#25-08 International Plaza"
账单地址3
设备信息
Hide child attributes
Hide child attributes
商户设备唯一标识
"a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f"
设备默认语言
"en-US"
设备高度
"956"
设备宽度
"440"
"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
收银台页面语言。 优先级:用户上次使用的语言 > 用户浏览器语言 > 用户ip国家语言 > 商户下单传的语言 > 默认EN
"EN"
详见风控业务数据:[商户上送信息],该部分信息通常作为定制风控的补充信息,如未开通定制风控可不填。
设备操作系统,当设备终端为Wap和App时,设备操作系统可以为ANDROID或IOS
"ANDROID"
商户自定义附加数据,可支持商户自定义并在响应中返回
"goods reference"
商户指定的跳转URL,用户完成支付后会被跳转到该地址,以http/https开头或者商户应用的scheme地址,纯API支付下frontCallbackUrl是必填的,用于支持需要跳转外部的异步交易
"https://www.google.com"
服务端回调通知URL,以http/https开头 可以通过MerchantDashboard平台配置商户通知地址,如果交易中上送,则以交易为准,即优先使用接口中传的url。注:如商户平台未配置通知地址,交易也没上送地址,则无法进行回调通知
"https://www.google.com"
Response
OK
响应状态码,’00000000’代表成功。’00000003’代表受理中,只代表接口请求成功,不代表订单状态。
"00000003"
返回描述,’SUCCESS.’ 。只代表接口请求成功,不代表订单状态。
"SUCCESS"
请求消息唯一标识。traceId为本次调用产生的流水号,接口调用异常,可以提供此流水号用于排查问题。
"33fae7b7aed1233f"
Hide child attributes
Hide child attributes
交易状态
SUCCESS, PENDING, FAILED, CLOSED 商户号
"2023010558663764"
商户订单号
"167812677182888888"
交易订单号
"TR1658354573473091584"
交易金额
10.01
商家下一步行动
Hide child attributes
Hide child attributes
当操作类型为重定向(redirect)时使用的重定向方法。可选值为 GET 或 POST。
GET, POST 下一步操作类型。可选值包括:render_qrcode、call_sdk、redirect、redirect_iframe 或 request_pin。
render_qrcode, call_sdk, redirect, redirect_iframe, request_pin "redirect"
重定向网址
"https://checkout1.payloco.com/standalone/checkout?intent_id=int1973308631638400&client_secret=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJpbnQxOTczMzA4NjMxNjM4NDAwIiwiaWF0IjoxNzg1ODMwMTE0LCJleHAiOjE3ODY4MzAxMTQsImtleSI6IjA1NmM3YjQxLWJmNTAtNDk1Mi1iZjdlLTZkYzNiOTFmYzM2OSIsInRhcmdldE9yZyI6IiIsImNvdW50cnlfY29kZSI6IklEIiwib3JkZXJBbW91bnQiOiIxMDAwMC4wMCIsIm9yZGVyQ3VycmVuY3kiOiJJRFIiLCJtZXJjaGFudElkIjoiODUxMjczMDAwMDcyIiwibWVyY2hhbnRPcmRlcklkIjoiMTc4NTgzMDEwOTI2NSIsInR4bk9yZGVySWQiOiJpbnQxOTczMzA4NjMxNjM4NDAwIn0.6njUs7zNuL3HFvGTS6Y_TwyoKZWJ9se9PF-hDaDQRvA&mode=payment¤cy=IDR&timeOut=10000000&targetOrg=&appVersion=v1.938.2"
curl --request POST \
--url https://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout \
--header 'Content-Type: application/json' \
--header 'signature: <api-key>' \
--data '
{
"charset": "UTF-8",
"version": "2.0.0",
"signType": "RSA",
"memberId": "2023010558663764",
"merchantId": "2023010558663764",
"requestTime": "2024-05-24T14:29:32.682+08:00",
"keyVersion": "1",
"data": {
"merchantOrderId": "ORD202604231532478921",
"integrate": "Direct",
"captureMode": "MANUAL",
"subject": "Iphone 16",
"totalAmount": "10.01",
"currency": "USD",
"country": "US",
"userId": "U123333333",
"expireTime": "1800",
"paymentDetail": {
"paymentMethodType": "WALLET",
"targetOrg": "KLARNA",
"buyerInfo": {
"firstName": "John",
"middleName": "Michael",
"email": "john.tan@example.com",
"lastName": "Tan",
"phoneNo": "+6591234567",
"phoneNoRegion": "+65",
"idType": "PASSPORT",
"idNo": "E12345678",
"taxType": "CPF",
"taxNo": "123.456.789-09",
"address": "10 Anson Road, #25-08 International Plaza",
"city": "Singapore",
"region": "Central",
"zipCode": "079903",
"clientIp": "203.0.113.42",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15"
},
"paymentTokenID": "ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a",
"tokenForFutureUse": true,
"merchantInitiated": "false",
"mitType": "SCHEDULED",
"info3DSecure": {
"threeDSVersion": "2.2.0",
"eci": "05",
"cavv": "AAABBBCCCDDDEEE111222333",
"dsTransactionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"xid": "MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=="
},
"carrierId": "qiye"
},
"goodsDetails": [
{
"goodsId": "SKU_1000001",
"goodsName": "Wireless Bluetooth Earbuds",
"quantity": "1",
"price": "10.01",
"goodsCurrency": "USD",
"showUrl": "https://example.com/product/sku_1000001",
"goodsCategory": "Electronics"
}
],
"subMerchant": {
"subMerchantNo": "SM202604270001"
},
"shippingInfo": {
"firstName": "John",
"middleName": "string",
"lastName": "John",
"phoneNo": "+6598765432",
"email": "john.tan@example.com",
"address1": "10 Anson Road",
"city": "Singapore",
"region": "Central",
"state": "string",
"country": "SG",
"zipCode": "079903",
"address2": "#25-08 International Plaza",
"address3": "string"
},
"billingInfo": {
"firstName": "John",
"middleName": "Michael",
"lastName": "Tan",
"phoneNo": "+6591234567",
"email": "john.tan@example.com",
"address1": "10 Anson Road",
"city": "Singapore",
"country": "SG",
"region": "Central",
"state": "string",
"zipCode": "079903",
"address2": "#25-08 International Plaza",
"address3": "string"
},
"envInfo": {
"deviceId": "a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f",
"deviceLanguage": "en-US",
"screenHeight": "956",
"screenWidth": "440",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
},
"language": "EN",
"riskParams": {},
"terminalType": "APP",
"osType": "ANDROID",
"reference": "goods reference",
"frontCallbackUrl": "https://www.google.com",
"notifyUrl": "https://www.google.com",
"subscriptionPlan": {
"subscriptionNo": "SUB_202604270001"
}
}
}
'import requests
url = "https://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout"
payload = {
"charset": "UTF-8",
"version": "2.0.0",
"signType": "RSA",
"memberId": "2023010558663764",
"merchantId": "2023010558663764",
"requestTime": "2024-05-24T14:29:32.682+08:00",
"keyVersion": "1",
"data": {
"merchantOrderId": "ORD202604231532478921",
"integrate": "Direct",
"captureMode": "MANUAL",
"subject": "Iphone 16",
"totalAmount": "10.01",
"currency": "USD",
"country": "US",
"userId": "U123333333",
"expireTime": "1800",
"paymentDetail": {
"paymentMethodType": "WALLET",
"targetOrg": "KLARNA",
"buyerInfo": {
"firstName": "John",
"middleName": "Michael",
"email": "john.tan@example.com",
"lastName": "Tan",
"phoneNo": "+6591234567",
"phoneNoRegion": "+65",
"idType": "PASSPORT",
"idNo": "E12345678",
"taxType": "CPF",
"taxNo": "123.456.789-09",
"address": "10 Anson Road, #25-08 International Plaza",
"city": "Singapore",
"region": "Central",
"zipCode": "079903",
"clientIp": "203.0.113.42",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15"
},
"paymentTokenID": "ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a",
"tokenForFutureUse": True,
"merchantInitiated": "false",
"mitType": "SCHEDULED",
"info3DSecure": {
"threeDSVersion": "2.2.0",
"eci": "05",
"cavv": "AAABBBCCCDDDEEE111222333",
"dsTransactionId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"xid": "MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=="
},
"carrierId": "qiye"
},
"goodsDetails": [
{
"goodsId": "SKU_1000001",
"goodsName": "Wireless Bluetooth Earbuds",
"quantity": "1",
"price": "10.01",
"goodsCurrency": "USD",
"showUrl": "https://example.com/product/sku_1000001",
"goodsCategory": "Electronics"
}
],
"subMerchant": { "subMerchantNo": "SM202604270001" },
"shippingInfo": {
"firstName": "John",
"middleName": "string",
"lastName": "John",
"phoneNo": "+6598765432",
"email": "john.tan@example.com",
"address1": "10 Anson Road",
"city": "Singapore",
"region": "Central",
"state": "string",
"country": "SG",
"zipCode": "079903",
"address2": "#25-08 International Plaza",
"address3": "string"
},
"billingInfo": {
"firstName": "John",
"middleName": "Michael",
"lastName": "Tan",
"phoneNo": "+6591234567",
"email": "john.tan@example.com",
"address1": "10 Anson Road",
"city": "Singapore",
"country": "SG",
"region": "Central",
"state": "string",
"zipCode": "079903",
"address2": "#25-08 International Plaza",
"address3": "string"
},
"envInfo": {
"deviceId": "a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f",
"deviceLanguage": "en-US",
"screenHeight": "956",
"screenWidth": "440",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
},
"language": "EN",
"riskParams": {},
"terminalType": "APP",
"osType": "ANDROID",
"reference": "goods reference",
"frontCallbackUrl": "https://www.google.com",
"notifyUrl": "https://www.google.com",
"subscriptionPlan": { "subscriptionNo": "SUB_202604270001" }
}
}
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',
signType: 'RSA',
memberId: '2023010558663764',
merchantId: '2023010558663764',
requestTime: '2024-05-24T14:29:32.682+08:00',
keyVersion: '1',
data: {
merchantOrderId: 'ORD202604231532478921',
integrate: 'Direct',
captureMode: 'MANUAL',
subject: 'Iphone 16',
totalAmount: '10.01',
currency: 'USD',
country: 'US',
userId: 'U123333333',
expireTime: '1800',
paymentDetail: {
paymentMethodType: 'WALLET',
targetOrg: 'KLARNA',
buyerInfo: {
firstName: 'John',
middleName: 'Michael',
email: 'john.tan@example.com',
lastName: 'Tan',
phoneNo: '+6591234567',
phoneNoRegion: '+65',
idType: 'PASSPORT',
idNo: 'E12345678',
taxType: 'CPF',
taxNo: '123.456.789-09',
address: '10 Anson Road, #25-08 International Plaza',
city: 'Singapore',
region: 'Central',
zipCode: '079903',
clientIp: '203.0.113.42',
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15'
},
paymentTokenID: 'ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a',
tokenForFutureUse: true,
merchantInitiated: 'false',
mitType: 'SCHEDULED',
info3DSecure: {
threeDSVersion: '2.2.0',
eci: '05',
cavv: 'AAABBBCCCDDDEEE111222333',
dsTransactionId: 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
xid: 'MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=='
},
carrierId: 'qiye'
},
goodsDetails: [
{
goodsId: 'SKU_1000001',
goodsName: 'Wireless Bluetooth Earbuds',
quantity: '1',
price: '10.01',
goodsCurrency: 'USD',
showUrl: 'https://example.com/product/sku_1000001',
goodsCategory: 'Electronics'
}
],
subMerchant: {subMerchantNo: 'SM202604270001'},
shippingInfo: {
firstName: 'John',
middleName: 'string',
lastName: 'John',
phoneNo: '+6598765432',
email: 'john.tan@example.com',
address1: '10 Anson Road',
city: 'Singapore',
region: 'Central',
state: 'string',
country: 'SG',
zipCode: '079903',
address2: '#25-08 International Plaza',
address3: 'string'
},
billingInfo: {
firstName: 'John',
middleName: 'Michael',
lastName: 'Tan',
phoneNo: '+6591234567',
email: 'john.tan@example.com',
address1: '10 Anson Road',
city: 'Singapore',
country: 'SG',
region: 'Central',
state: 'string',
zipCode: '079903',
address2: '#25-08 International Plaza',
address3: 'string'
},
envInfo: {
deviceId: 'a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f',
deviceLanguage: 'en-US',
screenHeight: '956',
screenWidth: '440',
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1'
},
language: 'EN',
riskParams: {},
terminalType: 'APP',
osType: 'ANDROID',
reference: 'goods reference',
frontCallbackUrl: 'https://www.google.com',
notifyUrl: 'https://www.google.com',
subscriptionPlan: {subscriptionNo: 'SUB_202604270001'}
}
})
};
fetch('https://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout', 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://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout",
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',
'signType' => 'RSA',
'memberId' => '2023010558663764',
'merchantId' => '2023010558663764',
'requestTime' => '2024-05-24T14:29:32.682+08:00',
'keyVersion' => '1',
'data' => [
'merchantOrderId' => 'ORD202604231532478921',
'integrate' => 'Direct',
'captureMode' => 'MANUAL',
'subject' => 'Iphone 16',
'totalAmount' => '10.01',
'currency' => 'USD',
'country' => 'US',
'userId' => 'U123333333',
'expireTime' => '1800',
'paymentDetail' => [
'paymentMethodType' => 'WALLET',
'targetOrg' => 'KLARNA',
'buyerInfo' => [
'firstName' => 'John',
'middleName' => 'Michael',
'email' => 'john.tan@example.com',
'lastName' => 'Tan',
'phoneNo' => '+6591234567',
'phoneNoRegion' => '+65',
'idType' => 'PASSPORT',
'idNo' => 'E12345678',
'taxType' => 'CPF',
'taxNo' => '123.456.789-09',
'address' => '10 Anson Road, #25-08 International Plaza',
'city' => 'Singapore',
'region' => 'Central',
'zipCode' => '079903',
'clientIp' => '203.0.113.42',
'userAgent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15'
],
'paymentTokenID' => 'ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a',
'tokenForFutureUse' => true,
'merchantInitiated' => 'false',
'mitType' => 'SCHEDULED',
'info3DSecure' => [
'threeDSVersion' => '2.2.0',
'eci' => '05',
'cavv' => 'AAABBBCCCDDDEEE111222333',
'dsTransactionId' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'xid' => 'MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw=='
],
'carrierId' => 'qiye'
],
'goodsDetails' => [
[
'goodsId' => 'SKU_1000001',
'goodsName' => 'Wireless Bluetooth Earbuds',
'quantity' => '1',
'price' => '10.01',
'goodsCurrency' => 'USD',
'showUrl' => 'https://example.com/product/sku_1000001',
'goodsCategory' => 'Electronics'
]
],
'subMerchant' => [
'subMerchantNo' => 'SM202604270001'
],
'shippingInfo' => [
'firstName' => 'John',
'middleName' => 'string',
'lastName' => 'John',
'phoneNo' => '+6598765432',
'email' => 'john.tan@example.com',
'address1' => '10 Anson Road',
'city' => 'Singapore',
'region' => 'Central',
'state' => 'string',
'country' => 'SG',
'zipCode' => '079903',
'address2' => '#25-08 International Plaza',
'address3' => 'string'
],
'billingInfo' => [
'firstName' => 'John',
'middleName' => 'Michael',
'lastName' => 'Tan',
'phoneNo' => '+6591234567',
'email' => 'john.tan@example.com',
'address1' => '10 Anson Road',
'city' => 'Singapore',
'country' => 'SG',
'region' => 'Central',
'state' => 'string',
'zipCode' => '079903',
'address2' => '#25-08 International Plaza',
'address3' => 'string'
],
'envInfo' => [
'deviceId' => 'a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f',
'deviceLanguage' => 'en-US',
'screenHeight' => '956',
'screenWidth' => '440',
'userAgent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1'
],
'language' => 'EN',
'riskParams' => [
],
'terminalType' => 'APP',
'osType' => 'ANDROID',
'reference' => 'goods reference',
'frontCallbackUrl' => 'https://www.google.com',
'notifyUrl' => 'https://www.google.com',
'subscriptionPlan' => [
'subscriptionNo' => 'SUB_202604270001'
]
]
]),
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://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout"
payload := strings.NewReader("{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"requestTime\": \"2024-05-24T14:29:32.682+08:00\",\n \"keyVersion\": \"1\",\n \"data\": {\n \"merchantOrderId\": \"ORD202604231532478921\",\n \"integrate\": \"Direct\",\n \"captureMode\": \"MANUAL\",\n \"subject\": \"Iphone 16\",\n \"totalAmount\": \"10.01\",\n \"currency\": \"USD\",\n \"country\": \"US\",\n \"userId\": \"U123333333\",\n \"expireTime\": \"1800\",\n \"paymentDetail\": {\n \"paymentMethodType\": \"WALLET\",\n \"targetOrg\": \"KLARNA\",\n \"buyerInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"email\": \"john.tan@example.com\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"phoneNoRegion\": \"+65\",\n \"idType\": \"PASSPORT\",\n \"idNo\": \"E12345678\",\n \"taxType\": \"CPF\",\n \"taxNo\": \"123.456.789-09\",\n \"address\": \"10 Anson Road, #25-08 International Plaza\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"zipCode\": \"079903\",\n \"clientIp\": \"203.0.113.42\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15\"\n },\n \"paymentTokenID\": \"ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a\",\n \"tokenForFutureUse\": true,\n \"merchantInitiated\": \"false\",\n \"mitType\": \"SCHEDULED\",\n \"info3DSecure\": {\n \"threeDSVersion\": \"2.2.0\",\n \"eci\": \"05\",\n \"cavv\": \"AAABBBCCCDDDEEE111222333\",\n \"dsTransactionId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"xid\": \"MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw==\"\n },\n \"carrierId\": \"qiye\"\n },\n \"goodsDetails\": [\n {\n \"goodsId\": \"SKU_1000001\",\n \"goodsName\": \"Wireless Bluetooth Earbuds\",\n \"quantity\": \"1\",\n \"price\": \"10.01\",\n \"goodsCurrency\": \"USD\",\n \"showUrl\": \"https://example.com/product/sku_1000001\",\n \"goodsCategory\": \"Electronics\"\n }\n ],\n \"subMerchant\": {\n \"subMerchantNo\": \"SM202604270001\"\n },\n \"shippingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"string\",\n \"lastName\": \"John\",\n \"phoneNo\": \"+6598765432\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"country\": \"SG\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"billingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"country\": \"SG\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"envInfo\": {\n \"deviceId\": \"a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f\",\n \"deviceLanguage\": \"en-US\",\n \"screenHeight\": \"956\",\n \"screenWidth\": \"440\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1\"\n },\n \"language\": \"EN\",\n \"riskParams\": {},\n \"terminalType\": \"APP\",\n \"osType\": \"ANDROID\",\n \"reference\": \"goods reference\",\n \"frontCallbackUrl\": \"https://www.google.com\",\n \"notifyUrl\": \"https://www.google.com\",\n \"subscriptionPlan\": {\n \"subscriptionNo\": \"SUB_202604270001\"\n }\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://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout")
.header("signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"charset\": \"UTF-8\",\n \"version\": \"2.0.0\",\n \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"requestTime\": \"2024-05-24T14:29:32.682+08:00\",\n \"keyVersion\": \"1\",\n \"data\": {\n \"merchantOrderId\": \"ORD202604231532478921\",\n \"integrate\": \"Direct\",\n \"captureMode\": \"MANUAL\",\n \"subject\": \"Iphone 16\",\n \"totalAmount\": \"10.01\",\n \"currency\": \"USD\",\n \"country\": \"US\",\n \"userId\": \"U123333333\",\n \"expireTime\": \"1800\",\n \"paymentDetail\": {\n \"paymentMethodType\": \"WALLET\",\n \"targetOrg\": \"KLARNA\",\n \"buyerInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"email\": \"john.tan@example.com\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"phoneNoRegion\": \"+65\",\n \"idType\": \"PASSPORT\",\n \"idNo\": \"E12345678\",\n \"taxType\": \"CPF\",\n \"taxNo\": \"123.456.789-09\",\n \"address\": \"10 Anson Road, #25-08 International Plaza\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"zipCode\": \"079903\",\n \"clientIp\": \"203.0.113.42\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15\"\n },\n \"paymentTokenID\": \"ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a\",\n \"tokenForFutureUse\": true,\n \"merchantInitiated\": \"false\",\n \"mitType\": \"SCHEDULED\",\n \"info3DSecure\": {\n \"threeDSVersion\": \"2.2.0\",\n \"eci\": \"05\",\n \"cavv\": \"AAABBBCCCDDDEEE111222333\",\n \"dsTransactionId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"xid\": \"MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw==\"\n },\n \"carrierId\": \"qiye\"\n },\n \"goodsDetails\": [\n {\n \"goodsId\": \"SKU_1000001\",\n \"goodsName\": \"Wireless Bluetooth Earbuds\",\n \"quantity\": \"1\",\n \"price\": \"10.01\",\n \"goodsCurrency\": \"USD\",\n \"showUrl\": \"https://example.com/product/sku_1000001\",\n \"goodsCategory\": \"Electronics\"\n }\n ],\n \"subMerchant\": {\n \"subMerchantNo\": \"SM202604270001\"\n },\n \"shippingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"string\",\n \"lastName\": \"John\",\n \"phoneNo\": \"+6598765432\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"country\": \"SG\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"billingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"country\": \"SG\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"envInfo\": {\n \"deviceId\": \"a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f\",\n \"deviceLanguage\": \"en-US\",\n \"screenHeight\": \"956\",\n \"screenWidth\": \"440\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1\"\n },\n \"language\": \"EN\",\n \"riskParams\": {},\n \"terminalType\": \"APP\",\n \"osType\": \"ANDROID\",\n \"reference\": \"goods reference\",\n \"frontCallbackUrl\": \"https://www.google.com\",\n \"notifyUrl\": \"https://www.google.com\",\n \"subscriptionPlan\": {\n \"subscriptionNo\": \"SUB_202604270001\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gate.uat.payloco.com/gateway/v2/payments/open/api/checkout")
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 \"signType\": \"RSA\",\n \"memberId\": \"2023010558663764\",\n \"merchantId\": \"2023010558663764\",\n \"requestTime\": \"2024-05-24T14:29:32.682+08:00\",\n \"keyVersion\": \"1\",\n \"data\": {\n \"merchantOrderId\": \"ORD202604231532478921\",\n \"integrate\": \"Direct\",\n \"captureMode\": \"MANUAL\",\n \"subject\": \"Iphone 16\",\n \"totalAmount\": \"10.01\",\n \"currency\": \"USD\",\n \"country\": \"US\",\n \"userId\": \"U123333333\",\n \"expireTime\": \"1800\",\n \"paymentDetail\": {\n \"paymentMethodType\": \"WALLET\",\n \"targetOrg\": \"KLARNA\",\n \"buyerInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"email\": \"john.tan@example.com\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"phoneNoRegion\": \"+65\",\n \"idType\": \"PASSPORT\",\n \"idNo\": \"E12345678\",\n \"taxType\": \"CPF\",\n \"taxNo\": \"123.456.789-09\",\n \"address\": \"10 Anson Road, #25-08 International Plaza\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"zipCode\": \"079903\",\n \"clientIp\": \"203.0.113.42\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15\"\n },\n \"paymentTokenID\": \"ptok_9f1c2e7a6b5d4c3a8e0f1b2c3d4e5f6a\",\n \"tokenForFutureUse\": true,\n \"merchantInitiated\": \"false\",\n \"mitType\": \"SCHEDULED\",\n \"info3DSecure\": {\n \"threeDSVersion\": \"2.2.0\",\n \"eci\": \"05\",\n \"cavv\": \"AAABBBCCCDDDEEE111222333\",\n \"dsTransactionId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"xid\": \"MDAwMDAwMDAwMDAwMDAwMDAwWDEyMw==\"\n },\n \"carrierId\": \"qiye\"\n },\n \"goodsDetails\": [\n {\n \"goodsId\": \"SKU_1000001\",\n \"goodsName\": \"Wireless Bluetooth Earbuds\",\n \"quantity\": \"1\",\n \"price\": \"10.01\",\n \"goodsCurrency\": \"USD\",\n \"showUrl\": \"https://example.com/product/sku_1000001\",\n \"goodsCategory\": \"Electronics\"\n }\n ],\n \"subMerchant\": {\n \"subMerchantNo\": \"SM202604270001\"\n },\n \"shippingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"string\",\n \"lastName\": \"John\",\n \"phoneNo\": \"+6598765432\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"country\": \"SG\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"billingInfo\": {\n \"firstName\": \"John\",\n \"middleName\": \"Michael\",\n \"lastName\": \"Tan\",\n \"phoneNo\": \"+6591234567\",\n \"email\": \"john.tan@example.com\",\n \"address1\": \"10 Anson Road\",\n \"city\": \"Singapore\",\n \"country\": \"SG\",\n \"region\": \"Central\",\n \"state\": \"string\",\n \"zipCode\": \"079903\",\n \"address2\": \"#25-08 International Plaza\",\n \"address3\": \"string\"\n },\n \"envInfo\": {\n \"deviceId\": \"a3f5c9e2-7b4d-4c1a-9f6e-2d8b7a1c0e5f\",\n \"deviceLanguage\": \"en-US\",\n \"screenHeight\": \"956\",\n \"screenWidth\": \"440\",\n \"userAgent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1\"\n },\n \"language\": \"EN\",\n \"riskParams\": {},\n \"terminalType\": \"APP\",\n \"osType\": \"ANDROID\",\n \"reference\": \"goods reference\",\n \"frontCallbackUrl\": \"https://www.google.com\",\n \"notifyUrl\": \"https://www.google.com\",\n \"subscriptionPlan\": {\n \"subscriptionNo\": \"SUB_202604270001\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": "00000003",
"message": "处理中",
"traceId": "33fae7b7aed1233f",
"data": {
"status": "SUCCESS",
"merchantId": "2023010558663764",
"merchantOrderId": "167812677182888888",
"orderId": "TR1658354573473091584",
"currency": "USD",
"totalAmount": "10.01",
"nextAction": {
"method": "GET",
"type": "redirect",
"url": "https://checkout1.uat.payloco.com/standalone/checkout?intent_id=int1973308631638400&client_secret=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJpbnQxOTczMzA4NjMxNjM4NDAwIiwiaWF0IjoxNzg1ODMwMTE0LCJleHAiOjE3ODY4MzAxMTQsImtleSI6IjA1NmM3YjQxLWJmNTAtNDk1Mi1iZjdlLTZkYzNiOTFmYzM2OSIsInRhcmdldE9yZyI6IiIsImNvdW50cnlfY29kZSI6IklEIiwib3JkZXJBbW91bnQiOiIxMDAwMC4wMCIsIm9yZGVyQ3VycmVuY3kiOiJJRFIiLCJtZXJjaGFudElkIjoiODUxMjczMDAwMDcyIiwibWVyY2hhbnRPcmRlcklkIjoiMTc4NTgzMDEwOTI2NSIsInR4bk9yZGVySWQiOiJpbnQxOTczMzA4NjMxNjM4NDAwIn0.6njUs7zNuL3HFvGTS6Y_TwyoKZWJ9se9PF-hDaDQRvA&mode=payment¤cy=IDR&timeOut=10000000&targetOrg=&appVersion=v1.938.2"
}
}
}