Create v1 (Legacy)
curl --request POST \
--url https://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-PARTNER-ID: <api-key>' \
--data '
{
"reff_no": "INV20240513001",
"title": "Invoice Payment",
"max_usage": 1,
"total_amount": 150000,
"items": [
{
"name": "Product A",
"quantity": 1,
"unit_price": 150000
}
],
"required_customer_detail": true,
"expired_at": "1705305600000",
"whitelisted_payment_method": [
"<string>"
],
"redirect_url": "https://merchant.example.com/payment/return",
"optional_metadata": {}
}
'import requests
url = "https://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}"
payload = {
"reff_no": "INV20240513001",
"title": "Invoice Payment",
"max_usage": 1,
"total_amount": 150000,
"items": [
{
"name": "Product A",
"quantity": 1,
"unit_price": 150000
}
],
"required_customer_detail": True,
"expired_at": "1705305600000",
"whitelisted_payment_method": ["<string>"],
"redirect_url": "https://merchant.example.com/payment/return",
"optional_metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"X-PARTNER-ID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-PARTNER-ID': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
reff_no: 'INV20240513001',
title: 'Invoice Payment',
max_usage: 1,
total_amount: 150000,
items: [{name: 'Product A', quantity: 1, unit_price: 150000}],
required_customer_detail: true,
expired_at: '1705305600000',
whitelisted_payment_method: ['<string>'],
redirect_url: 'https://merchant.example.com/payment/return',
optional_metadata: {}
})
};
fetch('https://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}', 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://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}",
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([
'reff_no' => 'INV20240513001',
'title' => 'Invoice Payment',
'max_usage' => 1,
'total_amount' => 150000,
'items' => [
[
'name' => 'Product A',
'quantity' => 1,
'unit_price' => 150000
]
],
'required_customer_detail' => true,
'expired_at' => '1705305600000',
'whitelisted_payment_method' => [
'<string>'
],
'redirect_url' => 'https://merchant.example.com/payment/return',
'optional_metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-PARTNER-ID: <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://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}"
payload := strings.NewReader("{\n \"reff_no\": \"INV20240513001\",\n \"title\": \"Invoice Payment\",\n \"max_usage\": 1,\n \"total_amount\": 150000,\n \"items\": [\n {\n \"name\": \"Product A\",\n \"quantity\": 1,\n \"unit_price\": 150000\n }\n ],\n \"required_customer_detail\": true,\n \"expired_at\": \"1705305600000\",\n \"whitelisted_payment_method\": [\n \"<string>\"\n ],\n \"redirect_url\": \"https://merchant.example.com/payment/return\",\n \"optional_metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-PARTNER-ID", "<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://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}")
.header("Authorization", "Bearer <token>")
.header("X-PARTNER-ID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reff_no\": \"INV20240513001\",\n \"title\": \"Invoice Payment\",\n \"max_usage\": 1,\n \"total_amount\": 150000,\n \"items\": [\n {\n \"name\": \"Product A\",\n \"quantity\": 1,\n \"unit_price\": 150000\n }\n ],\n \"required_customer_detail\": true,\n \"expired_at\": \"1705305600000\",\n \"whitelisted_payment_method\": [\n \"<string>\"\n ],\n \"redirect_url\": \"https://merchant.example.com/payment/return\",\n \"optional_metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-PARTNER-ID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reff_no\": \"INV20240513001\",\n \"title\": \"Invoice Payment\",\n \"max_usage\": 1,\n \"total_amount\": 150000,\n \"items\": [\n {\n \"name\": \"Product A\",\n \"quantity\": 1,\n \"unit_price\": 150000\n }\n ],\n \"required_customer_detail\": true,\n \"expired_at\": \"1705305600000\",\n \"whitelisted_payment_method\": [\n \"<string>\"\n ],\n \"redirect_url\": \"https://merchant.example.com/payment/return\",\n \"optional_metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"success": true,
"data": {
"id": 103,
"reff_no": "INV20240513001",
"title": "Invoice Payment",
"description": "Invoice #INV20240513001",
"source": "api v2",
"payment_url": "https://example.com/payment-link",
"status": "open",
"status_computed": "open",
"is_expired": false,
"required_customer_detail": true,
"is_multiple_payment": false,
"is_unlimited_usage": false,
"required_customer_fields": {
"name": true,
"phone": false,
"email": false
},
"customer_pays_fee": false,
"max_usage": 1,
"current_usage": 0,
"expired_at": "2024-05-13T00:00:00Z",
"total_amount": 150000,
"items": [
{
"name": "Product A",
"quantity": 1,
"unit_price": 150000,
"subtotal": 150000
}
],
"whitelisted_payment_method": [
"<string>"
],
"redirect_url": "https://example.com/payment-link",
"success_redirect_url": "https://merchant.example.com/payment/success",
"expired_redirect_url": "https://merchant.example.com/payment/expired",
"customer_name": "Jane Doe",
"customer_email": "jane@example.com",
"customer_phone": "081234567890",
"optional_metadata": {},
"payment_date": "2024-05-13T00:00:00Z",
"created_at": "2024-05-13T00:00:00Z",
"updated_at": "2024-05-13T00:00:00Z",
"account": {
"id": 1,
"name": "Account 1"
}
}
}{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Unauthorized merchant, please sign in"
}
}{
"status": 404,
"success": false,
"error": {
"code": 404,
"message": "Account not found."
}
}{
"status": 405,
"success": false,
"error": {
"code": 4059901,
"message": "The PATCH method is not supported for this route. Supported methods: GET, HEAD, POST."
}
}{
"status": 422,
"success": false,
"error": {
"code": 422,
"message": "Validation error.",
"errors": {
"field": [
"error message"
]
}
},
"data": {
"errors": {
"field": [
"error message"
]
}
}
}Payment Link
Create v1 (Legacy)
Creates a new payment link for an active account. The account must exist and be in active status.
POST
/
api
/
v1.0
/
payment-link-manage
/
{account_id}
Create v1 (Legacy)
curl --request POST \
--url https://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-PARTNER-ID: <api-key>' \
--data '
{
"reff_no": "INV20240513001",
"title": "Invoice Payment",
"max_usage": 1,
"total_amount": 150000,
"items": [
{
"name": "Product A",
"quantity": 1,
"unit_price": 150000
}
],
"required_customer_detail": true,
"expired_at": "1705305600000",
"whitelisted_payment_method": [
"<string>"
],
"redirect_url": "https://merchant.example.com/payment/return",
"optional_metadata": {}
}
'import requests
url = "https://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}"
payload = {
"reff_no": "INV20240513001",
"title": "Invoice Payment",
"max_usage": 1,
"total_amount": 150000,
"items": [
{
"name": "Product A",
"quantity": 1,
"unit_price": 150000
}
],
"required_customer_detail": True,
"expired_at": "1705305600000",
"whitelisted_payment_method": ["<string>"],
"redirect_url": "https://merchant.example.com/payment/return",
"optional_metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"X-PARTNER-ID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-PARTNER-ID': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
reff_no: 'INV20240513001',
title: 'Invoice Payment',
max_usage: 1,
total_amount: 150000,
items: [{name: 'Product A', quantity: 1, unit_price: 150000}],
required_customer_detail: true,
expired_at: '1705305600000',
whitelisted_payment_method: ['<string>'],
redirect_url: 'https://merchant.example.com/payment/return',
optional_metadata: {}
})
};
fetch('https://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}', 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://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}",
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([
'reff_no' => 'INV20240513001',
'title' => 'Invoice Payment',
'max_usage' => 1,
'total_amount' => 150000,
'items' => [
[
'name' => 'Product A',
'quantity' => 1,
'unit_price' => 150000
]
],
'required_customer_detail' => true,
'expired_at' => '1705305600000',
'whitelisted_payment_method' => [
'<string>'
],
'redirect_url' => 'https://merchant.example.com/payment/return',
'optional_metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-PARTNER-ID: <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://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}"
payload := strings.NewReader("{\n \"reff_no\": \"INV20240513001\",\n \"title\": \"Invoice Payment\",\n \"max_usage\": 1,\n \"total_amount\": 150000,\n \"items\": [\n {\n \"name\": \"Product A\",\n \"quantity\": 1,\n \"unit_price\": 150000\n }\n ],\n \"required_customer_detail\": true,\n \"expired_at\": \"1705305600000\",\n \"whitelisted_payment_method\": [\n \"<string>\"\n ],\n \"redirect_url\": \"https://merchant.example.com/payment/return\",\n \"optional_metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-PARTNER-ID", "<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://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}")
.header("Authorization", "Bearer <token>")
.header("X-PARTNER-ID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reff_no\": \"INV20240513001\",\n \"title\": \"Invoice Payment\",\n \"max_usage\": 1,\n \"total_amount\": 150000,\n \"items\": [\n {\n \"name\": \"Product A\",\n \"quantity\": 1,\n \"unit_price\": 150000\n }\n ],\n \"required_customer_detail\": true,\n \"expired_at\": \"1705305600000\",\n \"whitelisted_payment_method\": [\n \"<string>\"\n ],\n \"redirect_url\": \"https://merchant.example.com/payment/return\",\n \"optional_metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-payment-b2b.singapay.id/api/v1.0/payment-link-manage/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-PARTNER-ID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reff_no\": \"INV20240513001\",\n \"title\": \"Invoice Payment\",\n \"max_usage\": 1,\n \"total_amount\": 150000,\n \"items\": [\n {\n \"name\": \"Product A\",\n \"quantity\": 1,\n \"unit_price\": 150000\n }\n ],\n \"required_customer_detail\": true,\n \"expired_at\": \"1705305600000\",\n \"whitelisted_payment_method\": [\n \"<string>\"\n ],\n \"redirect_url\": \"https://merchant.example.com/payment/return\",\n \"optional_metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"success": true,
"data": {
"id": 103,
"reff_no": "INV20240513001",
"title": "Invoice Payment",
"description": "Invoice #INV20240513001",
"source": "api v2",
"payment_url": "https://example.com/payment-link",
"status": "open",
"status_computed": "open",
"is_expired": false,
"required_customer_detail": true,
"is_multiple_payment": false,
"is_unlimited_usage": false,
"required_customer_fields": {
"name": true,
"phone": false,
"email": false
},
"customer_pays_fee": false,
"max_usage": 1,
"current_usage": 0,
"expired_at": "2024-05-13T00:00:00Z",
"total_amount": 150000,
"items": [
{
"name": "Product A",
"quantity": 1,
"unit_price": 150000,
"subtotal": 150000
}
],
"whitelisted_payment_method": [
"<string>"
],
"redirect_url": "https://example.com/payment-link",
"success_redirect_url": "https://merchant.example.com/payment/success",
"expired_redirect_url": "https://merchant.example.com/payment/expired",
"customer_name": "Jane Doe",
"customer_email": "jane@example.com",
"customer_phone": "081234567890",
"optional_metadata": {},
"payment_date": "2024-05-13T00:00:00Z",
"created_at": "2024-05-13T00:00:00Z",
"updated_at": "2024-05-13T00:00:00Z",
"account": {
"id": 1,
"name": "Account 1"
}
}
}{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Unauthorized merchant, please sign in"
}
}{
"status": 404,
"success": false,
"error": {
"code": 404,
"message": "Account not found."
}
}{
"status": 405,
"success": false,
"error": {
"code": 4059901,
"message": "The PATCH method is not supported for this route. Supported methods: GET, HEAD, POST."
}
}{
"status": 422,
"success": false,
"error": {
"code": 422,
"message": "Validation error.",
"errors": {
"field": [
"error message"
]
}
},
"data": {
"errors": {
"field": [
"error message"
]
}
}
}Authorizations
Body
application/json
