PayIn
Create PayIn
To be able to successfully create a payment link you would need the following APIs in consideration:
- Step 1: Call the Get PayIn Methods API to retrieve available payment methods.
- Step 2: Call the Create PayIn with the selected method and sender details.
- Step 3: Redirect the customer to the generated
payment_linkto complete the checkout. - Step 4: In the sandbox environment, use the Simulate PayIn API to test payment outcomes.
POST
/
v3
/
payin_links
Create PayIn
curl --request POST \
--url https://api.cleverhub.co/api/v3/payin_links \
--header 'Content-Type: application/json' \
--header 'app-id: <api-key>' \
--header 'secret-key: <api-key>' \
--data '
{
"amount": 100000,
"payin_method_code": "vn_vietqr_vnd",
"expires_in": null,
"description": "Top-up wallet",
"external_id": "123456",
"redirect_url": {
"success": "https://example.com/success"
},
"webhook_notification": {
"endpoint_url": "https://example.com/webhook",
"authorization_header": "Header 123456789"
},
"sender_info": {
"email": "email@gmail.com",
"first_name": "John",
"last_name": "Doe",
"gender": "male",
"contact_type": "individual",
"dob": "1990-01-01",
"reg_no": "A1234567",
"state": "Ho Chi Minh",
"user_id": "user_12345",
"upi_id": "johndoe@upi",
"phone": "0123456789",
"country_code": "VN",
"address": "123 abc",
"city": "Ho Chi Minh City",
"postal_code": "700000",
"account_name": "John Doe",
"account_number": "233240000000",
"bank_code": "VCB",
"document_type": "passport",
"document_number": "P123456789"
},
"metadata": {
"custom_note": "Priority customer"
},
"create_payment_link_jpy_example": {
"amount": 100000,
"payin_method_code": "jp_bank_jpy",
"expires_in": null,
"description": "Top-up wallet",
"external_id": "123456",
"redirect_url": {
"success": "https://example.com/success"
},
"webhook_notification": {
"endpoint_url": "https://example.com/webhook",
"authorization_header": "Header 123456789"
},
"sender_info": {
"first_name": "John",
"last_name": "Doe"
},
"metadata": {
"transliterate": true
}
}
}
'import requests
url = "https://api.cleverhub.co/api/v3/payin_links"
payload = {
"amount": 100000,
"payin_method_code": "vn_vietqr_vnd",
"expires_in": None,
"description": "Top-up wallet",
"external_id": "123456",
"redirect_url": { "success": "https://example.com/success" },
"webhook_notification": {
"endpoint_url": "https://example.com/webhook",
"authorization_header": "Header 123456789"
},
"sender_info": {
"email": "email@gmail.com",
"first_name": "John",
"last_name": "Doe",
"gender": "male",
"contact_type": "individual",
"dob": "1990-01-01",
"reg_no": "A1234567",
"state": "Ho Chi Minh",
"user_id": "user_12345",
"upi_id": "johndoe@upi",
"phone": "0123456789",
"country_code": "VN",
"address": "123 abc",
"city": "Ho Chi Minh City",
"postal_code": "700000",
"account_name": "John Doe",
"account_number": "233240000000",
"bank_code": "VCB",
"document_type": "passport",
"document_number": "P123456789"
},
"metadata": { "custom_note": "Priority customer" },
"create_payment_link_jpy_example": {
"amount": 100000,
"payin_method_code": "jp_bank_jpy",
"expires_in": None,
"description": "Top-up wallet",
"external_id": "123456",
"redirect_url": { "success": "https://example.com/success" },
"webhook_notification": {
"endpoint_url": "https://example.com/webhook",
"authorization_header": "Header 123456789"
},
"sender_info": {
"first_name": "John",
"last_name": "Doe"
},
"metadata": { "transliterate": True }
}
}
headers = {
"app-id": "<api-key>",
"secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'app-id': '<api-key>',
'secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 100000,
payin_method_code: 'vn_vietqr_vnd',
expires_in: null,
description: 'Top-up wallet',
external_id: '123456',
redirect_url: {success: 'https://example.com/success'},
webhook_notification: {
endpoint_url: 'https://example.com/webhook',
authorization_header: 'Header 123456789'
},
sender_info: {
email: 'email@gmail.com',
first_name: 'John',
last_name: 'Doe',
gender: 'male',
contact_type: 'individual',
dob: '1990-01-01',
reg_no: 'A1234567',
state: 'Ho Chi Minh',
user_id: 'user_12345',
upi_id: 'johndoe@upi',
phone: '0123456789',
country_code: 'VN',
address: '123 abc',
city: 'Ho Chi Minh City',
postal_code: '700000',
account_name: 'John Doe',
account_number: '233240000000',
bank_code: 'VCB',
document_type: 'passport',
document_number: 'P123456789'
},
metadata: {custom_note: 'Priority customer'},
create_payment_link_jpy_example: {
amount: 100000,
payin_method_code: 'jp_bank_jpy',
expires_in: null,
description: 'Top-up wallet',
external_id: '123456',
redirect_url: {success: 'https://example.com/success'},
webhook_notification: {
endpoint_url: 'https://example.com/webhook',
authorization_header: 'Header 123456789'
},
sender_info: {first_name: 'John', last_name: 'Doe'},
metadata: {transliterate: true}
}
})
};
fetch('https://api.cleverhub.co/api/v3/payin_links', 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.cleverhub.co/api/v3/payin_links",
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' => 100000,
'payin_method_code' => 'vn_vietqr_vnd',
'expires_in' => null,
'description' => 'Top-up wallet',
'external_id' => '123456',
'redirect_url' => [
'success' => 'https://example.com/success'
],
'webhook_notification' => [
'endpoint_url' => 'https://example.com/webhook',
'authorization_header' => 'Header 123456789'
],
'sender_info' => [
'email' => 'email@gmail.com',
'first_name' => 'John',
'last_name' => 'Doe',
'gender' => 'male',
'contact_type' => 'individual',
'dob' => '1990-01-01',
'reg_no' => 'A1234567',
'state' => 'Ho Chi Minh',
'user_id' => 'user_12345',
'upi_id' => 'johndoe@upi',
'phone' => '0123456789',
'country_code' => 'VN',
'address' => '123 abc',
'city' => 'Ho Chi Minh City',
'postal_code' => '700000',
'account_name' => 'John Doe',
'account_number' => '233240000000',
'bank_code' => 'VCB',
'document_type' => 'passport',
'document_number' => 'P123456789'
],
'metadata' => [
'custom_note' => 'Priority customer'
],
'create_payment_link_jpy_example' => [
'amount' => 100000,
'payin_method_code' => 'jp_bank_jpy',
'expires_in' => null,
'description' => 'Top-up wallet',
'external_id' => '123456',
'redirect_url' => [
'success' => 'https://example.com/success'
],
'webhook_notification' => [
'endpoint_url' => 'https://example.com/webhook',
'authorization_header' => 'Header 123456789'
],
'sender_info' => [
'first_name' => 'John',
'last_name' => 'Doe'
],
'metadata' => [
'transliterate' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"app-id: <api-key>",
"secret-key: <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://api.cleverhub.co/api/v3/payin_links"
payload := strings.NewReader("{\n \"amount\": 100000,\n \"payin_method_code\": \"vn_vietqr_vnd\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"email\": \"email@gmail.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"gender\": \"male\",\n \"contact_type\": \"individual\",\n \"dob\": \"1990-01-01\",\n \"reg_no\": \"A1234567\",\n \"state\": \"Ho Chi Minh\",\n \"user_id\": \"user_12345\",\n \"upi_id\": \"johndoe@upi\",\n \"phone\": \"0123456789\",\n \"country_code\": \"VN\",\n \"address\": \"123 abc\",\n \"city\": \"Ho Chi Minh City\",\n \"postal_code\": \"700000\",\n \"account_name\": \"John Doe\",\n \"account_number\": \"233240000000\",\n \"bank_code\": \"VCB\",\n \"document_type\": \"passport\",\n \"document_number\": \"P123456789\"\n },\n \"metadata\": {\n \"custom_note\": \"Priority customer\"\n },\n \"create_payment_link_jpy_example\": {\n \"amount\": 100000,\n \"payin_method_code\": \"jp_bank_jpy\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\"\n },\n \"metadata\": {\n \"transliterate\": true\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("app-id", "<api-key>")
req.Header.Add("secret-key", "<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.cleverhub.co/api/v3/payin_links")
.header("app-id", "<api-key>")
.header("secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 100000,\n \"payin_method_code\": \"vn_vietqr_vnd\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"email\": \"email@gmail.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"gender\": \"male\",\n \"contact_type\": \"individual\",\n \"dob\": \"1990-01-01\",\n \"reg_no\": \"A1234567\",\n \"state\": \"Ho Chi Minh\",\n \"user_id\": \"user_12345\",\n \"upi_id\": \"johndoe@upi\",\n \"phone\": \"0123456789\",\n \"country_code\": \"VN\",\n \"address\": \"123 abc\",\n \"city\": \"Ho Chi Minh City\",\n \"postal_code\": \"700000\",\n \"account_name\": \"John Doe\",\n \"account_number\": \"233240000000\",\n \"bank_code\": \"VCB\",\n \"document_type\": \"passport\",\n \"document_number\": \"P123456789\"\n },\n \"metadata\": {\n \"custom_note\": \"Priority customer\"\n },\n \"create_payment_link_jpy_example\": {\n \"amount\": 100000,\n \"payin_method_code\": \"jp_bank_jpy\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\"\n },\n \"metadata\": {\n \"transliterate\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cleverhub.co/api/v3/payin_links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["app-id"] = '<api-key>'
request["secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 100000,\n \"payin_method_code\": \"vn_vietqr_vnd\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"email\": \"email@gmail.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"gender\": \"male\",\n \"contact_type\": \"individual\",\n \"dob\": \"1990-01-01\",\n \"reg_no\": \"A1234567\",\n \"state\": \"Ho Chi Minh\",\n \"user_id\": \"user_12345\",\n \"upi_id\": \"johndoe@upi\",\n \"phone\": \"0123456789\",\n \"country_code\": \"VN\",\n \"address\": \"123 abc\",\n \"city\": \"Ho Chi Minh City\",\n \"postal_code\": \"700000\",\n \"account_name\": \"John Doe\",\n \"account_number\": \"233240000000\",\n \"bank_code\": \"VCB\",\n \"document_type\": \"passport\",\n \"document_number\": \"P123456789\"\n },\n \"metadata\": {\n \"custom_note\": \"Priority customer\"\n },\n \"create_payment_link_jpy_example\": {\n \"amount\": 100000,\n \"payin_method_code\": \"jp_bank_jpy\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\"\n },\n \"metadata\": {\n \"transliterate\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"uuid": "Z2Q3FWBW",
"payment_url": "https://example.com/ZSxw187",
"expires_at": "2025-07-24T16:00:00Z"
}{
"errors": {
"code": "REQUIRE_LOGIN",
"message": "Not Authorised"
}
}{
"errors": {
"message": "Email is missing in sender information"
}
}Authorizations
A unique identifier assigned to each application.
A secure token associated with the app-id.
Body
application/json
Transaction amount.
Description of the payment transaction
Information about the customer.
Show child attributes
Show child attributes
Specific payin method code to be used for this payment. You will receive this from the Get payment methods API Optional — if not provided, user will choose from available methods.
Expiration time of transaction (seconds). Default: 1800 (30 min), Min: 900 (15 min).
Custom ID.
Show child attributes
Show child attributes
Webhook configuration for transaction status updates
Show child attributes
Show child attributes
Optional custom metadata to attach to the transaction.
Show child attributes
Show child attributes
⌘I
Create PayIn
curl --request POST \
--url https://api.cleverhub.co/api/v3/payin_links \
--header 'Content-Type: application/json' \
--header 'app-id: <api-key>' \
--header 'secret-key: <api-key>' \
--data '
{
"amount": 100000,
"payin_method_code": "vn_vietqr_vnd",
"expires_in": null,
"description": "Top-up wallet",
"external_id": "123456",
"redirect_url": {
"success": "https://example.com/success"
},
"webhook_notification": {
"endpoint_url": "https://example.com/webhook",
"authorization_header": "Header 123456789"
},
"sender_info": {
"email": "email@gmail.com",
"first_name": "John",
"last_name": "Doe",
"gender": "male",
"contact_type": "individual",
"dob": "1990-01-01",
"reg_no": "A1234567",
"state": "Ho Chi Minh",
"user_id": "user_12345",
"upi_id": "johndoe@upi",
"phone": "0123456789",
"country_code": "VN",
"address": "123 abc",
"city": "Ho Chi Minh City",
"postal_code": "700000",
"account_name": "John Doe",
"account_number": "233240000000",
"bank_code": "VCB",
"document_type": "passport",
"document_number": "P123456789"
},
"metadata": {
"custom_note": "Priority customer"
},
"create_payment_link_jpy_example": {
"amount": 100000,
"payin_method_code": "jp_bank_jpy",
"expires_in": null,
"description": "Top-up wallet",
"external_id": "123456",
"redirect_url": {
"success": "https://example.com/success"
},
"webhook_notification": {
"endpoint_url": "https://example.com/webhook",
"authorization_header": "Header 123456789"
},
"sender_info": {
"first_name": "John",
"last_name": "Doe"
},
"metadata": {
"transliterate": true
}
}
}
'import requests
url = "https://api.cleverhub.co/api/v3/payin_links"
payload = {
"amount": 100000,
"payin_method_code": "vn_vietqr_vnd",
"expires_in": None,
"description": "Top-up wallet",
"external_id": "123456",
"redirect_url": { "success": "https://example.com/success" },
"webhook_notification": {
"endpoint_url": "https://example.com/webhook",
"authorization_header": "Header 123456789"
},
"sender_info": {
"email": "email@gmail.com",
"first_name": "John",
"last_name": "Doe",
"gender": "male",
"contact_type": "individual",
"dob": "1990-01-01",
"reg_no": "A1234567",
"state": "Ho Chi Minh",
"user_id": "user_12345",
"upi_id": "johndoe@upi",
"phone": "0123456789",
"country_code": "VN",
"address": "123 abc",
"city": "Ho Chi Minh City",
"postal_code": "700000",
"account_name": "John Doe",
"account_number": "233240000000",
"bank_code": "VCB",
"document_type": "passport",
"document_number": "P123456789"
},
"metadata": { "custom_note": "Priority customer" },
"create_payment_link_jpy_example": {
"amount": 100000,
"payin_method_code": "jp_bank_jpy",
"expires_in": None,
"description": "Top-up wallet",
"external_id": "123456",
"redirect_url": { "success": "https://example.com/success" },
"webhook_notification": {
"endpoint_url": "https://example.com/webhook",
"authorization_header": "Header 123456789"
},
"sender_info": {
"first_name": "John",
"last_name": "Doe"
},
"metadata": { "transliterate": True }
}
}
headers = {
"app-id": "<api-key>",
"secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'app-id': '<api-key>',
'secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 100000,
payin_method_code: 'vn_vietqr_vnd',
expires_in: null,
description: 'Top-up wallet',
external_id: '123456',
redirect_url: {success: 'https://example.com/success'},
webhook_notification: {
endpoint_url: 'https://example.com/webhook',
authorization_header: 'Header 123456789'
},
sender_info: {
email: 'email@gmail.com',
first_name: 'John',
last_name: 'Doe',
gender: 'male',
contact_type: 'individual',
dob: '1990-01-01',
reg_no: 'A1234567',
state: 'Ho Chi Minh',
user_id: 'user_12345',
upi_id: 'johndoe@upi',
phone: '0123456789',
country_code: 'VN',
address: '123 abc',
city: 'Ho Chi Minh City',
postal_code: '700000',
account_name: 'John Doe',
account_number: '233240000000',
bank_code: 'VCB',
document_type: 'passport',
document_number: 'P123456789'
},
metadata: {custom_note: 'Priority customer'},
create_payment_link_jpy_example: {
amount: 100000,
payin_method_code: 'jp_bank_jpy',
expires_in: null,
description: 'Top-up wallet',
external_id: '123456',
redirect_url: {success: 'https://example.com/success'},
webhook_notification: {
endpoint_url: 'https://example.com/webhook',
authorization_header: 'Header 123456789'
},
sender_info: {first_name: 'John', last_name: 'Doe'},
metadata: {transliterate: true}
}
})
};
fetch('https://api.cleverhub.co/api/v3/payin_links', 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.cleverhub.co/api/v3/payin_links",
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' => 100000,
'payin_method_code' => 'vn_vietqr_vnd',
'expires_in' => null,
'description' => 'Top-up wallet',
'external_id' => '123456',
'redirect_url' => [
'success' => 'https://example.com/success'
],
'webhook_notification' => [
'endpoint_url' => 'https://example.com/webhook',
'authorization_header' => 'Header 123456789'
],
'sender_info' => [
'email' => 'email@gmail.com',
'first_name' => 'John',
'last_name' => 'Doe',
'gender' => 'male',
'contact_type' => 'individual',
'dob' => '1990-01-01',
'reg_no' => 'A1234567',
'state' => 'Ho Chi Minh',
'user_id' => 'user_12345',
'upi_id' => 'johndoe@upi',
'phone' => '0123456789',
'country_code' => 'VN',
'address' => '123 abc',
'city' => 'Ho Chi Minh City',
'postal_code' => '700000',
'account_name' => 'John Doe',
'account_number' => '233240000000',
'bank_code' => 'VCB',
'document_type' => 'passport',
'document_number' => 'P123456789'
],
'metadata' => [
'custom_note' => 'Priority customer'
],
'create_payment_link_jpy_example' => [
'amount' => 100000,
'payin_method_code' => 'jp_bank_jpy',
'expires_in' => null,
'description' => 'Top-up wallet',
'external_id' => '123456',
'redirect_url' => [
'success' => 'https://example.com/success'
],
'webhook_notification' => [
'endpoint_url' => 'https://example.com/webhook',
'authorization_header' => 'Header 123456789'
],
'sender_info' => [
'first_name' => 'John',
'last_name' => 'Doe'
],
'metadata' => [
'transliterate' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"app-id: <api-key>",
"secret-key: <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://api.cleverhub.co/api/v3/payin_links"
payload := strings.NewReader("{\n \"amount\": 100000,\n \"payin_method_code\": \"vn_vietqr_vnd\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"email\": \"email@gmail.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"gender\": \"male\",\n \"contact_type\": \"individual\",\n \"dob\": \"1990-01-01\",\n \"reg_no\": \"A1234567\",\n \"state\": \"Ho Chi Minh\",\n \"user_id\": \"user_12345\",\n \"upi_id\": \"johndoe@upi\",\n \"phone\": \"0123456789\",\n \"country_code\": \"VN\",\n \"address\": \"123 abc\",\n \"city\": \"Ho Chi Minh City\",\n \"postal_code\": \"700000\",\n \"account_name\": \"John Doe\",\n \"account_number\": \"233240000000\",\n \"bank_code\": \"VCB\",\n \"document_type\": \"passport\",\n \"document_number\": \"P123456789\"\n },\n \"metadata\": {\n \"custom_note\": \"Priority customer\"\n },\n \"create_payment_link_jpy_example\": {\n \"amount\": 100000,\n \"payin_method_code\": \"jp_bank_jpy\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\"\n },\n \"metadata\": {\n \"transliterate\": true\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("app-id", "<api-key>")
req.Header.Add("secret-key", "<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.cleverhub.co/api/v3/payin_links")
.header("app-id", "<api-key>")
.header("secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 100000,\n \"payin_method_code\": \"vn_vietqr_vnd\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"email\": \"email@gmail.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"gender\": \"male\",\n \"contact_type\": \"individual\",\n \"dob\": \"1990-01-01\",\n \"reg_no\": \"A1234567\",\n \"state\": \"Ho Chi Minh\",\n \"user_id\": \"user_12345\",\n \"upi_id\": \"johndoe@upi\",\n \"phone\": \"0123456789\",\n \"country_code\": \"VN\",\n \"address\": \"123 abc\",\n \"city\": \"Ho Chi Minh City\",\n \"postal_code\": \"700000\",\n \"account_name\": \"John Doe\",\n \"account_number\": \"233240000000\",\n \"bank_code\": \"VCB\",\n \"document_type\": \"passport\",\n \"document_number\": \"P123456789\"\n },\n \"metadata\": {\n \"custom_note\": \"Priority customer\"\n },\n \"create_payment_link_jpy_example\": {\n \"amount\": 100000,\n \"payin_method_code\": \"jp_bank_jpy\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\"\n },\n \"metadata\": {\n \"transliterate\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cleverhub.co/api/v3/payin_links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["app-id"] = '<api-key>'
request["secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 100000,\n \"payin_method_code\": \"vn_vietqr_vnd\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"email\": \"email@gmail.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"gender\": \"male\",\n \"contact_type\": \"individual\",\n \"dob\": \"1990-01-01\",\n \"reg_no\": \"A1234567\",\n \"state\": \"Ho Chi Minh\",\n \"user_id\": \"user_12345\",\n \"upi_id\": \"johndoe@upi\",\n \"phone\": \"0123456789\",\n \"country_code\": \"VN\",\n \"address\": \"123 abc\",\n \"city\": \"Ho Chi Minh City\",\n \"postal_code\": \"700000\",\n \"account_name\": \"John Doe\",\n \"account_number\": \"233240000000\",\n \"bank_code\": \"VCB\",\n \"document_type\": \"passport\",\n \"document_number\": \"P123456789\"\n },\n \"metadata\": {\n \"custom_note\": \"Priority customer\"\n },\n \"create_payment_link_jpy_example\": {\n \"amount\": 100000,\n \"payin_method_code\": \"jp_bank_jpy\",\n \"expires_in\": null,\n \"description\": \"Top-up wallet\",\n \"external_id\": \"123456\",\n \"redirect_url\": {\n \"success\": \"https://example.com/success\"\n },\n \"webhook_notification\": {\n \"endpoint_url\": \"https://example.com/webhook\",\n \"authorization_header\": \"Header 123456789\"\n },\n \"sender_info\": {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\"\n },\n \"metadata\": {\n \"transliterate\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"uuid": "Z2Q3FWBW",
"payment_url": "https://example.com/ZSxw187",
"expires_at": "2025-07-24T16:00:00Z"
}{
"errors": {
"code": "REQUIRE_LOGIN",
"message": "Not Authorised"
}
}{
"errors": {
"message": "Email is missing in sender information"
}
}