curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create \
--header 'Content-Type: application/json' \
--header 'x-auth-token: <api-key>' \
--header 'x-client-id: <x-client-id>' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"amount": "10.12",
"currency": "SGD",
"merchant_order_id": "<string>",
"description": "<string>",
"return_url": "<string>",
"payment_method": {
"type": "card",
"card": {
"card_name": "<string>",
"card_number": "<string>",
"expiry_month": "<string>",
"expiry_year": "<string>",
"cvc": "<string>",
"billing": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"address": {
"country_code": "SG",
"city": "Singapore",
"street": "444 Orchard Rd, Midpoint Orchard, Singapore ",
"postcode": "924011",
"state": ""
},
"phone_number": "12025550123"
},
"auto_capture": false,
"three_ds": {
"return_url": "<string>",
"acs_response": "<string>",
"device_data_collection_res": "<string>",
"ds_transaction_id": "<string>"
}
}
},
"ip_address": "212.121.222.123",
"customer_id": "cus_asyknf3wlfxhs1s6plamk80i8v",
"payment_orders": {
"type": "physical_goods",
"products": [
{
"name": "<string>",
"price": "<string>",
"quantity": 123,
"image_url": "<string>"
}
]
},
"metadata": {
"key1": "value1",
"key2": "value2"
}
}
'import requests
url = "https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create"
payload = {
"amount": "10.12",
"currency": "SGD",
"merchant_order_id": "<string>",
"description": "<string>",
"return_url": "<string>",
"payment_method": {
"type": "card",
"card": {
"card_name": "<string>",
"card_number": "<string>",
"expiry_month": "<string>",
"expiry_year": "<string>",
"cvc": "<string>",
"billing": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"address": {
"country_code": "SG",
"city": "Singapore",
"street": "444 Orchard Rd, Midpoint Orchard, Singapore ",
"postcode": "924011",
"state": ""
},
"phone_number": "12025550123"
},
"auto_capture": False,
"three_ds": {
"return_url": "<string>",
"acs_response": "<string>",
"device_data_collection_res": "<string>",
"ds_transaction_id": "<string>"
}
}
},
"ip_address": "212.121.222.123",
"customer_id": "cus_asyknf3wlfxhs1s6plamk80i8v",
"payment_orders": {
"type": "physical_goods",
"products": [
{
"name": "<string>",
"price": "<string>",
"quantity": 123,
"image_url": "<string>"
}
]
},
"metadata": {
"key1": "value1",
"key2": "value2"
}
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"x-client-id": "<x-client-id>",
"x-auth-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
'x-client-id': '<x-client-id>',
'x-auth-token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '10.12',
currency: 'SGD',
merchant_order_id: '<string>',
description: '<string>',
return_url: '<string>',
payment_method: {
type: 'card',
card: {
card_name: '<string>',
card_number: '<string>',
expiry_month: '<string>',
expiry_year: '<string>',
cvc: '<string>',
billing: {
first_name: 'John',
last_name: 'Doe',
email: 'john.doe@example.com',
address: {
country_code: 'SG',
city: 'Singapore',
street: '444 Orchard Rd, Midpoint Orchard, Singapore ',
postcode: '924011',
state: ''
},
phone_number: '12025550123'
},
auto_capture: false,
three_ds: {
return_url: '<string>',
acs_response: '<string>',
device_data_collection_res: '<string>',
ds_transaction_id: '<string>'
}
}
},
ip_address: '212.121.222.123',
customer_id: 'cus_asyknf3wlfxhs1s6plamk80i8v',
payment_orders: {
type: 'physical_goods',
products: [{name: '<string>', price: '<string>', quantity: 123, image_url: '<string>'}]
},
metadata: {key1: 'value1', key2: 'value2'}
})
};
fetch('https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create', 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://api-sandbox.uqpaytech.com/api/v2/payment_intents/create",
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([
'amount' => '10.12',
'currency' => 'SGD',
'merchant_order_id' => '<string>',
'description' => '<string>',
'return_url' => '<string>',
'payment_method' => [
'type' => 'card',
'card' => [
'card_name' => '<string>',
'card_number' => '<string>',
'expiry_month' => '<string>',
'expiry_year' => '<string>',
'cvc' => '<string>',
'billing' => [
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@example.com',
'address' => [
'country_code' => 'SG',
'city' => 'Singapore',
'street' => '444 Orchard Rd, Midpoint Orchard, Singapore ',
'postcode' => '924011',
'state' => ''
],
'phone_number' => '12025550123'
],
'auto_capture' => false,
'three_ds' => [
'return_url' => '<string>',
'acs_response' => '<string>',
'device_data_collection_res' => '<string>',
'ds_transaction_id' => '<string>'
]
]
],
'ip_address' => '212.121.222.123',
'customer_id' => 'cus_asyknf3wlfxhs1s6plamk80i8v',
'payment_orders' => [
'type' => 'physical_goods',
'products' => [
[
'name' => '<string>',
'price' => '<string>',
'quantity' => 123,
'image_url' => '<string>'
]
]
],
'metadata' => [
'key1' => 'value1',
'key2' => 'value2'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-auth-token: <api-key>",
"x-client-id: <x-client-id>",
"x-idempotency-key: <x-idempotency-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://api-sandbox.uqpaytech.com/api/v2/payment_intents/create"
payload := strings.NewReader("{\n \"amount\": \"10.12\",\n \"currency\": \"SGD\",\n \"merchant_order_id\": \"<string>\",\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"payment_method\": {\n \"type\": \"card\",\n \"card\": {\n \"card_name\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiry_month\": \"<string>\",\n \"expiry_year\": \"<string>\",\n \"cvc\": \"<string>\",\n \"billing\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"address\": {\n \"country_code\": \"SG\",\n \"city\": \"Singapore\",\n \"street\": \"444 Orchard Rd, Midpoint Orchard, Singapore \",\n \"postcode\": \"924011\",\n \"state\": \"\"\n },\n \"phone_number\": \"12025550123\"\n },\n \"auto_capture\": false,\n \"three_ds\": {\n \"return_url\": \"<string>\",\n \"acs_response\": \"<string>\",\n \"device_data_collection_res\": \"<string>\",\n \"ds_transaction_id\": \"<string>\"\n }\n }\n },\n \"ip_address\": \"212.121.222.123\",\n \"customer_id\": \"cus_asyknf3wlfxhs1s6plamk80i8v\",\n \"payment_orders\": {\n \"type\": \"physical_goods\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"image_url\": \"<string>\"\n }\n ]\n },\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("x-client-id", "<x-client-id>")
req.Header.Add("x-auth-token", "<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://api-sandbox.uqpaytech.com/api/v2/payment_intents/create")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("x-client-id", "<x-client-id>")
.header("x-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"10.12\",\n \"currency\": \"SGD\",\n \"merchant_order_id\": \"<string>\",\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"payment_method\": {\n \"type\": \"card\",\n \"card\": {\n \"card_name\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiry_month\": \"<string>\",\n \"expiry_year\": \"<string>\",\n \"cvc\": \"<string>\",\n \"billing\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"address\": {\n \"country_code\": \"SG\",\n \"city\": \"Singapore\",\n \"street\": \"444 Orchard Rd, Midpoint Orchard, Singapore \",\n \"postcode\": \"924011\",\n \"state\": \"\"\n },\n \"phone_number\": \"12025550123\"\n },\n \"auto_capture\": false,\n \"three_ds\": {\n \"return_url\": \"<string>\",\n \"acs_response\": \"<string>\",\n \"device_data_collection_res\": \"<string>\",\n \"ds_transaction_id\": \"<string>\"\n }\n }\n },\n \"ip_address\": \"212.121.222.123\",\n \"customer_id\": \"cus_asyknf3wlfxhs1s6plamk80i8v\",\n \"payment_orders\": {\n \"type\": \"physical_goods\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"image_url\": \"<string>\"\n }\n ]\n },\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["x-client-id"] = '<x-client-id>'
request["x-auth-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"10.12\",\n \"currency\": \"SGD\",\n \"merchant_order_id\": \"<string>\",\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"payment_method\": {\n \"type\": \"card\",\n \"card\": {\n \"card_name\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiry_month\": \"<string>\",\n \"expiry_year\": \"<string>\",\n \"cvc\": \"<string>\",\n \"billing\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"address\": {\n \"country_code\": \"SG\",\n \"city\": \"Singapore\",\n \"street\": \"444 Orchard Rd, Midpoint Orchard, Singapore \",\n \"postcode\": \"924011\",\n \"state\": \"\"\n },\n \"phone_number\": \"12025550123\"\n },\n \"auto_capture\": false,\n \"three_ds\": {\n \"return_url\": \"<string>\",\n \"acs_response\": \"<string>\",\n \"device_data_collection_res\": \"<string>\",\n \"ds_transaction_id\": \"<string>\"\n }\n }\n },\n \"ip_address\": \"212.121.222.123\",\n \"customer_id\": \"cus_asyknf3wlfxhs1s6plamk80i8v\",\n \"payment_orders\": {\n \"type\": \"physical_goods\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"image_url\": \"<string>\"\n }\n ]\n },\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}"
response = http.request(request)
puts response.read_body{
"payment_intent_id": "b1c2d3e4-f5a6-b7c8-d9e0-f1a2b3c4d5e6",
"amount": "10.12",
"currency": "SGD",
"description": "<string>",
"available_payment_method_types": [
"<string>"
],
"captured_amount": "10.12",
"customer": {
"id": "cus_hkduz3gvz1feg25e87fjcahsxq",
"external_customer_id": "CUS_1715740800123",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone_number": "+1 123456789",
"address": {
"country_code": "SG",
"city": "Singapore",
"street": "444 Orchard Rd, Midpoint Orchard, Singapore ",
"postcode": "924011",
"state": ""
},
"metadata": {
"key1": "value1",
"key2": "value2"
},
"create_time": "2025-03-21T17:17:32+08:00",
"update_time": "2025-03-21T17:17:32+08:00"
},
"customer_id": "cus_asyknf3wlfxhs1s6plamk80i8v",
"cancel_time": "2024-03-01T00:00:00+08:00",
"cancellation_reason": "Order cancelled",
"client_secret": "eyJhbGciOiJI***********ujNdZ1DF9CqWEfF1jphxI",
"merchant_order_id": "1bf70d90-9ed0-48ce-9370-9bd7ef6ab9ee",
"metadata": {
"key1": "value1",
"key2": "value2"
},
"next_action": {
"redirect_to_url": {
"url": "https://example.checkout-page.com",
"return_url": "https://example.payment-result-page.com"
},
"redirect_iframe": {
"iframe": "<string>"
},
"display_qr_code": {
"qr_code_url": "https://sg-acquiring-bucket-sandbox.s3.ap-southeast-1.amazonaws.com/payment/20250829/qrcode_PA1961262701099356160?X-Amz-Algorithm=AWS4-HMAC-SHA256\\u0026X-Amz-Credential=ASIAY******f987429",
"expires_at": "2023-11-07T05:31:56Z"
},
"display_bank_details": {
"bank_name": "<string>",
"account_number": "GB71950018692652646598",
"routing_number": "012345678"
}
},
"return_url": "https://127.0.0.1:8080/api/v1/callback",
"create_time": "2024-03-01T00:00:00+08:00",
"complete_time": "2024-03-01T00:00:00+08:00",
"update_time": "2024-03-01T00:00:00+08:00",
"latest_payment_attempt": {
"attempt_id": "24fc62b4-90d1-42e3-96ab-dd54ccc648b3",
"amount": "9.98",
"currency": "SGD",
"captured_amount": "0.00",
"refunded_amount": "0.00",
"create_time": "2025-03-21T17:17:32+08:00",
"update_time": "2025-03-21T17:17:32+08:00",
"complete_time": "2024-03-01T00:00:00+08:00",
"cancellation_reason": "Order cancelled",
"auth_code": "A12B3C",
"arn": "74537604221222132710572",
"rrn": "123456789012",
"advice_code": "01",
"authentication_data": {
"avs_result": "Y",
"three_ds": {
"three_ds_version": "2.2.0",
"eci": "05",
"cavv": "AAABCZIhcQAAAABZlyFxAAAAAAA=",
"three_ds_authentication_status": "Y",
"three_ds_cancellation_reason": "01"
}
},
"payment_method": {
"type": "card",
"card": {
"card_name": "john doe",
"card_number": "541333******4047",
"brand": "visa",
"bin": "541333",
"last4": "4047",
"expiry_month": "12",
"expiry_year": "2027",
"billing": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"address": {
"country_code": "SG",
"city": "Singapore",
"street": "444 Orchard Rd, Midpoint Orchard, Singapore ",
"postcode": "924011",
"state": ""
},
"phone_number": "12025550123"
},
"auto_capture": true
}
},
"failure_code": "",
"attempt_status": "INITIATED"
}
}Create a PaymentIntent
创建一个新的 PaymentIntent 来处理付款。
创建 PaymentIntent 后,附加支付方式并调用 confirm 接口以继续付款。
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create \
--header 'Content-Type: application/json' \
--header 'x-auth-token: <api-key>' \
--header 'x-client-id: <x-client-id>' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"amount": "10.12",
"currency": "SGD",
"merchant_order_id": "<string>",
"description": "<string>",
"return_url": "<string>",
"payment_method": {
"type": "card",
"card": {
"card_name": "<string>",
"card_number": "<string>",
"expiry_month": "<string>",
"expiry_year": "<string>",
"cvc": "<string>",
"billing": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"address": {
"country_code": "SG",
"city": "Singapore",
"street": "444 Orchard Rd, Midpoint Orchard, Singapore ",
"postcode": "924011",
"state": ""
},
"phone_number": "12025550123"
},
"auto_capture": false,
"three_ds": {
"return_url": "<string>",
"acs_response": "<string>",
"device_data_collection_res": "<string>",
"ds_transaction_id": "<string>"
}
}
},
"ip_address": "212.121.222.123",
"customer_id": "cus_asyknf3wlfxhs1s6plamk80i8v",
"payment_orders": {
"type": "physical_goods",
"products": [
{
"name": "<string>",
"price": "<string>",
"quantity": 123,
"image_url": "<string>"
}
]
},
"metadata": {
"key1": "value1",
"key2": "value2"
}
}
'import requests
url = "https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create"
payload = {
"amount": "10.12",
"currency": "SGD",
"merchant_order_id": "<string>",
"description": "<string>",
"return_url": "<string>",
"payment_method": {
"type": "card",
"card": {
"card_name": "<string>",
"card_number": "<string>",
"expiry_month": "<string>",
"expiry_year": "<string>",
"cvc": "<string>",
"billing": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"address": {
"country_code": "SG",
"city": "Singapore",
"street": "444 Orchard Rd, Midpoint Orchard, Singapore ",
"postcode": "924011",
"state": ""
},
"phone_number": "12025550123"
},
"auto_capture": False,
"three_ds": {
"return_url": "<string>",
"acs_response": "<string>",
"device_data_collection_res": "<string>",
"ds_transaction_id": "<string>"
}
}
},
"ip_address": "212.121.222.123",
"customer_id": "cus_asyknf3wlfxhs1s6plamk80i8v",
"payment_orders": {
"type": "physical_goods",
"products": [
{
"name": "<string>",
"price": "<string>",
"quantity": 123,
"image_url": "<string>"
}
]
},
"metadata": {
"key1": "value1",
"key2": "value2"
}
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"x-client-id": "<x-client-id>",
"x-auth-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
'x-client-id': '<x-client-id>',
'x-auth-token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '10.12',
currency: 'SGD',
merchant_order_id: '<string>',
description: '<string>',
return_url: '<string>',
payment_method: {
type: 'card',
card: {
card_name: '<string>',
card_number: '<string>',
expiry_month: '<string>',
expiry_year: '<string>',
cvc: '<string>',
billing: {
first_name: 'John',
last_name: 'Doe',
email: 'john.doe@example.com',
address: {
country_code: 'SG',
city: 'Singapore',
street: '444 Orchard Rd, Midpoint Orchard, Singapore ',
postcode: '924011',
state: ''
},
phone_number: '12025550123'
},
auto_capture: false,
three_ds: {
return_url: '<string>',
acs_response: '<string>',
device_data_collection_res: '<string>',
ds_transaction_id: '<string>'
}
}
},
ip_address: '212.121.222.123',
customer_id: 'cus_asyknf3wlfxhs1s6plamk80i8v',
payment_orders: {
type: 'physical_goods',
products: [{name: '<string>', price: '<string>', quantity: 123, image_url: '<string>'}]
},
metadata: {key1: 'value1', key2: 'value2'}
})
};
fetch('https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create', 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://api-sandbox.uqpaytech.com/api/v2/payment_intents/create",
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([
'amount' => '10.12',
'currency' => 'SGD',
'merchant_order_id' => '<string>',
'description' => '<string>',
'return_url' => '<string>',
'payment_method' => [
'type' => 'card',
'card' => [
'card_name' => '<string>',
'card_number' => '<string>',
'expiry_month' => '<string>',
'expiry_year' => '<string>',
'cvc' => '<string>',
'billing' => [
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@example.com',
'address' => [
'country_code' => 'SG',
'city' => 'Singapore',
'street' => '444 Orchard Rd, Midpoint Orchard, Singapore ',
'postcode' => '924011',
'state' => ''
],
'phone_number' => '12025550123'
],
'auto_capture' => false,
'three_ds' => [
'return_url' => '<string>',
'acs_response' => '<string>',
'device_data_collection_res' => '<string>',
'ds_transaction_id' => '<string>'
]
]
],
'ip_address' => '212.121.222.123',
'customer_id' => 'cus_asyknf3wlfxhs1s6plamk80i8v',
'payment_orders' => [
'type' => 'physical_goods',
'products' => [
[
'name' => '<string>',
'price' => '<string>',
'quantity' => 123,
'image_url' => '<string>'
]
]
],
'metadata' => [
'key1' => 'value1',
'key2' => 'value2'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-auth-token: <api-key>",
"x-client-id: <x-client-id>",
"x-idempotency-key: <x-idempotency-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://api-sandbox.uqpaytech.com/api/v2/payment_intents/create"
payload := strings.NewReader("{\n \"amount\": \"10.12\",\n \"currency\": \"SGD\",\n \"merchant_order_id\": \"<string>\",\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"payment_method\": {\n \"type\": \"card\",\n \"card\": {\n \"card_name\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiry_month\": \"<string>\",\n \"expiry_year\": \"<string>\",\n \"cvc\": \"<string>\",\n \"billing\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"address\": {\n \"country_code\": \"SG\",\n \"city\": \"Singapore\",\n \"street\": \"444 Orchard Rd, Midpoint Orchard, Singapore \",\n \"postcode\": \"924011\",\n \"state\": \"\"\n },\n \"phone_number\": \"12025550123\"\n },\n \"auto_capture\": false,\n \"three_ds\": {\n \"return_url\": \"<string>\",\n \"acs_response\": \"<string>\",\n \"device_data_collection_res\": \"<string>\",\n \"ds_transaction_id\": \"<string>\"\n }\n }\n },\n \"ip_address\": \"212.121.222.123\",\n \"customer_id\": \"cus_asyknf3wlfxhs1s6plamk80i8v\",\n \"payment_orders\": {\n \"type\": \"physical_goods\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"image_url\": \"<string>\"\n }\n ]\n },\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("x-client-id", "<x-client-id>")
req.Header.Add("x-auth-token", "<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://api-sandbox.uqpaytech.com/api/v2/payment_intents/create")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("x-client-id", "<x-client-id>")
.header("x-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"10.12\",\n \"currency\": \"SGD\",\n \"merchant_order_id\": \"<string>\",\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"payment_method\": {\n \"type\": \"card\",\n \"card\": {\n \"card_name\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiry_month\": \"<string>\",\n \"expiry_year\": \"<string>\",\n \"cvc\": \"<string>\",\n \"billing\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"address\": {\n \"country_code\": \"SG\",\n \"city\": \"Singapore\",\n \"street\": \"444 Orchard Rd, Midpoint Orchard, Singapore \",\n \"postcode\": \"924011\",\n \"state\": \"\"\n },\n \"phone_number\": \"12025550123\"\n },\n \"auto_capture\": false,\n \"three_ds\": {\n \"return_url\": \"<string>\",\n \"acs_response\": \"<string>\",\n \"device_data_collection_res\": \"<string>\",\n \"ds_transaction_id\": \"<string>\"\n }\n }\n },\n \"ip_address\": \"212.121.222.123\",\n \"customer_id\": \"cus_asyknf3wlfxhs1s6plamk80i8v\",\n \"payment_orders\": {\n \"type\": \"physical_goods\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"image_url\": \"<string>\"\n }\n ]\n },\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v2/payment_intents/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["x-client-id"] = '<x-client-id>'
request["x-auth-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"10.12\",\n \"currency\": \"SGD\",\n \"merchant_order_id\": \"<string>\",\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"payment_method\": {\n \"type\": \"card\",\n \"card\": {\n \"card_name\": \"<string>\",\n \"card_number\": \"<string>\",\n \"expiry_month\": \"<string>\",\n \"expiry_year\": \"<string>\",\n \"cvc\": \"<string>\",\n \"billing\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"address\": {\n \"country_code\": \"SG\",\n \"city\": \"Singapore\",\n \"street\": \"444 Orchard Rd, Midpoint Orchard, Singapore \",\n \"postcode\": \"924011\",\n \"state\": \"\"\n },\n \"phone_number\": \"12025550123\"\n },\n \"auto_capture\": false,\n \"three_ds\": {\n \"return_url\": \"<string>\",\n \"acs_response\": \"<string>\",\n \"device_data_collection_res\": \"<string>\",\n \"ds_transaction_id\": \"<string>\"\n }\n }\n },\n \"ip_address\": \"212.121.222.123\",\n \"customer_id\": \"cus_asyknf3wlfxhs1s6plamk80i8v\",\n \"payment_orders\": {\n \"type\": \"physical_goods\",\n \"products\": [\n {\n \"name\": \"<string>\",\n \"price\": \"<string>\",\n \"quantity\": 123,\n \"image_url\": \"<string>\"\n }\n ]\n },\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n}"
response = http.request(request)
puts response.read_body{
"payment_intent_id": "b1c2d3e4-f5a6-b7c8-d9e0-f1a2b3c4d5e6",
"amount": "10.12",
"currency": "SGD",
"description": "<string>",
"available_payment_method_types": [
"<string>"
],
"captured_amount": "10.12",
"customer": {
"id": "cus_hkduz3gvz1feg25e87fjcahsxq",
"external_customer_id": "CUS_1715740800123",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone_number": "+1 123456789",
"address": {
"country_code": "SG",
"city": "Singapore",
"street": "444 Orchard Rd, Midpoint Orchard, Singapore ",
"postcode": "924011",
"state": ""
},
"metadata": {
"key1": "value1",
"key2": "value2"
},
"create_time": "2025-03-21T17:17:32+08:00",
"update_time": "2025-03-21T17:17:32+08:00"
},
"customer_id": "cus_asyknf3wlfxhs1s6plamk80i8v",
"cancel_time": "2024-03-01T00:00:00+08:00",
"cancellation_reason": "Order cancelled",
"client_secret": "eyJhbGciOiJI***********ujNdZ1DF9CqWEfF1jphxI",
"merchant_order_id": "1bf70d90-9ed0-48ce-9370-9bd7ef6ab9ee",
"metadata": {
"key1": "value1",
"key2": "value2"
},
"next_action": {
"redirect_to_url": {
"url": "https://example.checkout-page.com",
"return_url": "https://example.payment-result-page.com"
},
"redirect_iframe": {
"iframe": "<string>"
},
"display_qr_code": {
"qr_code_url": "https://sg-acquiring-bucket-sandbox.s3.ap-southeast-1.amazonaws.com/payment/20250829/qrcode_PA1961262701099356160?X-Amz-Algorithm=AWS4-HMAC-SHA256\\u0026X-Amz-Credential=ASIAY******f987429",
"expires_at": "2023-11-07T05:31:56Z"
},
"display_bank_details": {
"bank_name": "<string>",
"account_number": "GB71950018692652646598",
"routing_number": "012345678"
}
},
"return_url": "https://127.0.0.1:8080/api/v1/callback",
"create_time": "2024-03-01T00:00:00+08:00",
"complete_time": "2024-03-01T00:00:00+08:00",
"update_time": "2024-03-01T00:00:00+08:00",
"latest_payment_attempt": {
"attempt_id": "24fc62b4-90d1-42e3-96ab-dd54ccc648b3",
"amount": "9.98",
"currency": "SGD",
"captured_amount": "0.00",
"refunded_amount": "0.00",
"create_time": "2025-03-21T17:17:32+08:00",
"update_time": "2025-03-21T17:17:32+08:00",
"complete_time": "2024-03-01T00:00:00+08:00",
"cancellation_reason": "Order cancelled",
"auth_code": "A12B3C",
"arn": "74537604221222132710572",
"rrn": "123456789012",
"advice_code": "01",
"authentication_data": {
"avs_result": "Y",
"three_ds": {
"three_ds_version": "2.2.0",
"eci": "05",
"cavv": "AAABCZIhcQAAAABZlyFxAAAAAAA=",
"three_ds_authentication_status": "Y",
"three_ds_cancellation_reason": "01"
}
},
"payment_method": {
"type": "card",
"card": {
"card_name": "john doe",
"card_number": "541333******4047",
"brand": "visa",
"bin": "541333",
"last4": "4047",
"expiry_month": "12",
"expiry_year": "2027",
"billing": {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"address": {
"country_code": "SG",
"city": "Singapore",
"street": "444 Orchard Rd, Midpoint Orchard, Singapore ",
"postcode": "924011",
"state": ""
},
"phone_number": "12025550123"
},
"auto_capture": true
}
},
"failure_code": "",
"attempt_status": "INITIATED"
}
}授权
UQPay 提供的登录 API Token。
请求头
指定代表哪个子账户发起该请求。应设置为 account_id,可通过 List Connected Accounts 获取。若省略或为空,则使用主账户执行请求。
更多信息见 Connected Accounts。
用于保持操作幂等性的唯一标识符(UUID),确保同一操作重复执行不会产生意外影响或重复结果。它有助于在网络错误、重试或故障时保持数据一致性。
UQPAY 生成的 API 客户端 ID
请求体
该 PaymentIntent 拟收取的金额。
"10.12"
三位币种代码
"SGD"
商户系统中为该 PaymentIntent 创建的商户参考 ID
36将向客户展示的描述符。最大长度为 32。
32支付认证完成后用于跳转客户的网页 URL 或应用 scheme URI。
1024用于确认 PaymentIntent 的支付方式详情。设置 payment_method 后,PaymentIntent 将自动确认。
- card
- card_present
- applepay
- googlepay
- alipaycn
- alipayhk
- unionpay
- wechatpay
- grabpay
- crypto
- paynow
- truemoney
- tng
- gcash
- dana
- kakaopay
- toss
- naverpay
Show child attributes
Show child attributes
设备的 IPv4 或 IPv6 地址。
当 payment_method.card.three_ds_action=enforce_3ds 时必填。
否则可选。
45"212.121.222.123"
内联的客户详情。为某位购物者创建第一笔 PaymentIntent 时提供此项,可在托管支付页面启用 Card on File(卡片留存)。UQPay 会用这些详情创建一条客户记录,并在响应中返回生成的 customer_id。
当同时提供 customer_id 时本项将被忽略——优先级规则见 customer_id。
Show child attributes
Show child attributes
由先前的 Create PaymentIntent 调用返回的、已存在的 UQPay 客户 ID。为同一购物者的后续支付传入此项,托管支付页面便可提供其已保存的卡片。
当同时提供 customer_id 和 customer 时,以 customer_id 优先。
访客结账时留空(该 PaymentIntent 将不参与 Card on File)。
36"cus_asyknf3wlfxhs1s6plamk80i8v"
与该 PaymentIntent 关联的采购订单
Show child attributes
Show child attributes
为风险与欺诈防控收集的浏览器信息。
当 three_ds_action=enforce_3ds 时必填
Show child attributes
Show child attributes
任意键值对象。最大长度 = 512 字节。必须是合法的 JSON 数据。
Show child attributes
Show child attributes
{ "key1": "value1", "key2": "value2" }
响应
成功创建 PaymentIntent
PaymentIntent 的唯一标识
36"b1c2d3e4-f5a6-b7c8-d9e0-f1a2b3c4d5e6"
支付金额。即你希望向客户收取的订单金额。
"10.12"
三位币种代码
"SGD"
该 PaymentIntent 的状态。
REQUIRES_PAYMENT_METHOD:PaymentIntent 正在等待确认请求。REQUIRES_CUSTOMER_ACTION:PaymentIntent 正在等待客户进一步的认证操作,例如 3DS 验证和扫描二维码。请查看next_action。REQUIRES_CAPTURE:PaymentIntent 正在等待你请款以完成支付。PENDING:PaymentIntent 正在等待支付渠道返回最终结果,无需进一步操作。SUCCEEDED:PaymentIntent 已成功,支付完成。CANCELLED:PaymentIntent 已按你的请求取消,支付已关闭。FAILED:PaymentIntent 已失败。
REQUIRES_PAYMENT_METHOD, REQUIRES_CUSTOMER_ACTION, REQUIRES_CAPTURE, PENDING, SUCCEEDED, CANCELLED, FAILED 创建 PaymentIntent 时的描述符。
255该 PaymentIntent 可用的支付方式类型。
从该 PaymentIntent 已请款的金额。
"10.12"
与该 PaymentIntent 关联的客户快照。在创建时提供了 customer 或 customer_id 时返回。客户的唯一标识在顶层以 customer_id 暴露;该对象内部不包含 id 字段。
Show child attributes
Show child attributes
与该 PaymentIntent 关联的客户 ID。访客结账时为空。
36"cus_asyknf3wlfxhs1s6plamk80i8v"
该 PaymentIntent 最近一次被取消的时间。仅当 PaymentIntent 成功取消(即状态为 CANCELLED)时存在。
"2024-03-01T00:00:00+08:00"
取消该 PaymentIntent 的原因。
"Order cancelled"
用于浏览器或 App 的 PaymentIntent client secret。由 PaymentIntent 创建接口或查询接口返回。返回的 client_secret 有效期为 60 分钟。
"eyJhbGciOiJI***********ujNdZ1DF9CqWEfF1jphxI"
商户系统中为该 PaymentIntent 创建的商户参考 ID
36"1bf70d90-9ed0-48ce-9370-9bd7ef6ab9ee"
任意键值对象。最大长度 = 512 字节。必须是合法的 JSON 数据。
Show child attributes
Show child attributes
{ "key1": "value1", "key2": "value2" }
若存在,该属性会告诉你:为了让客户使用所提供的来源完成支付,你需要采取哪些操作。
Show child attributes
Show child attributes
支付认证完成后用于跳转客户的网页 URL 或应用 scheme URI。
"https://127.0.0.1:8080/api/v1/callback"
该 PaymentIntent 的创建时间。
"2024-03-01T00:00:00+08:00"
该 PaymentIntent 达到最终状态的时间。
"2024-03-01T00:00:00+08:00"
该 PaymentIntent 最近一次更新或操作的时间。
"2024-03-01T00:00:00+08:00"
该 PaymentIntent 下创建的最新 PaymentAttempt。
Show child attributes
Show child attributes

