curl --request POST \
--url https://sandbox-payment-b2b.singapay.id/api/v1.0/retail-transactions/{account_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-PARTNER-ID: <api-key>' \
--data '
{
"retail_code": "ALFAMART",
"amount": 50000,
"customer_name": "John Doe",
"expired_at": 1787969413000,
"merchant_reff_no": "INV-2026-001",
"customer_id": "CUST-001",
"customer_email": "john.doe@example.com",
"customer_phone": "081234567890"
}
'import requests
url = "https://sandbox-payment-b2b.singapay.id/api/v1.0/retail-transactions/{account_id}"
payload = {
"retail_code": "ALFAMART",
"amount": 50000,
"customer_name": "John Doe",
"expired_at": 1787969413000,
"merchant_reff_no": "INV-2026-001",
"customer_id": "CUST-001",
"customer_email": "john.doe@example.com",
"customer_phone": "081234567890"
}
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({
retail_code: 'ALFAMART',
amount: 50000,
customer_name: 'John Doe',
expired_at: 1787969413000,
merchant_reff_no: 'INV-2026-001',
customer_id: 'CUST-001',
customer_email: 'john.doe@example.com',
customer_phone: '081234567890'
})
};
fetch('https://sandbox-payment-b2b.singapay.id/api/v1.0/retail-transactions/{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/retail-transactions/{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([
'retail_code' => 'ALFAMART',
'amount' => 50000,
'customer_name' => 'John Doe',
'expired_at' => 1787969413000,
'merchant_reff_no' => 'INV-2026-001',
'customer_id' => 'CUST-001',
'customer_email' => 'john.doe@example.com',
'customer_phone' => '081234567890'
]),
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/retail-transactions/{account_id}"
payload := strings.NewReader("{\n \"retail_code\": \"ALFAMART\",\n \"amount\": 50000,\n \"customer_name\": \"John Doe\",\n \"expired_at\": 1787969413000,\n \"merchant_reff_no\": \"INV-2026-001\",\n \"customer_id\": \"CUST-001\",\n \"customer_email\": \"john.doe@example.com\",\n \"customer_phone\": \"081234567890\"\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/retail-transactions/{account_id}")
.header("Authorization", "Bearer <token>")
.header("X-PARTNER-ID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"retail_code\": \"ALFAMART\",\n \"amount\": 50000,\n \"customer_name\": \"John Doe\",\n \"expired_at\": 1787969413000,\n \"merchant_reff_no\": \"INV-2026-001\",\n \"customer_id\": \"CUST-001\",\n \"customer_email\": \"john.doe@example.com\",\n \"customer_phone\": \"081234567890\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-payment-b2b.singapay.id/api/v1.0/retail-transactions/{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 \"retail_code\": \"ALFAMART\",\n \"amount\": 50000,\n \"customer_name\": \"John Doe\",\n \"expired_at\": 1787969413000,\n \"merchant_reff_no\": \"INV-2026-001\",\n \"customer_id\": \"CUST-001\",\n \"customer_email\": \"john.doe@example.com\",\n \"customer_phone\": \"081234567890\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"success": true,
"data": {
"transaction_id": "1272026040210300012345",
"merchant_reff_no": "INV-2026-001",
"payment_code": "8998123456789",
"retail_code": "ALFAMART",
"account": {
"id": "01K946KF851RK7FX075GJHBVKF",
"name": "Main Account"
},
"customer": {
"id": "CUST-001",
"name": "John Doe",
"email": "john.doe@example.com",
"phone": "081234567890"
},
"status": "unpaid",
"fees": {
"name": "Alfamart",
"amount": 3000,
"currency": "IDR"
},
"amount": {
"value": 50000,
"currency": "IDR"
},
"expired_at": "1787969413000",
"processed_timestamp": null,
"post_timestamp": "1787883013000",
"has_settle": false,
"settle_at": null
}
}{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Unauthorized merchant, please sign in"
}
}{
"status": 403,
"success": false,
"error": {
"code": 403,
"message": "Access denied."
}
}{
"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"
]
}
}
}{
"status": 500,
"success": false,
"error": {
"code": 500,
"message": "Internal server error."
}
}Create payment code
Generates a native Retail Store payment code (Alfamart / Indomaret) the customer pays at the cashier. The amount must be within merchant configuration limits for the selected outlet. Retail access is pilot-gated per merchant. Payment confirmation arrives later as a POST callback to callback_urls.transaction_notif_url with event = retail-transaction.
curl --request POST \
--url https://sandbox-payment-b2b.singapay.id/api/v1.0/retail-transactions/{account_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-PARTNER-ID: <api-key>' \
--data '
{
"retail_code": "ALFAMART",
"amount": 50000,
"customer_name": "John Doe",
"expired_at": 1787969413000,
"merchant_reff_no": "INV-2026-001",
"customer_id": "CUST-001",
"customer_email": "john.doe@example.com",
"customer_phone": "081234567890"
}
'import requests
url = "https://sandbox-payment-b2b.singapay.id/api/v1.0/retail-transactions/{account_id}"
payload = {
"retail_code": "ALFAMART",
"amount": 50000,
"customer_name": "John Doe",
"expired_at": 1787969413000,
"merchant_reff_no": "INV-2026-001",
"customer_id": "CUST-001",
"customer_email": "john.doe@example.com",
"customer_phone": "081234567890"
}
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({
retail_code: 'ALFAMART',
amount: 50000,
customer_name: 'John Doe',
expired_at: 1787969413000,
merchant_reff_no: 'INV-2026-001',
customer_id: 'CUST-001',
customer_email: 'john.doe@example.com',
customer_phone: '081234567890'
})
};
fetch('https://sandbox-payment-b2b.singapay.id/api/v1.0/retail-transactions/{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/retail-transactions/{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([
'retail_code' => 'ALFAMART',
'amount' => 50000,
'customer_name' => 'John Doe',
'expired_at' => 1787969413000,
'merchant_reff_no' => 'INV-2026-001',
'customer_id' => 'CUST-001',
'customer_email' => 'john.doe@example.com',
'customer_phone' => '081234567890'
]),
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/retail-transactions/{account_id}"
payload := strings.NewReader("{\n \"retail_code\": \"ALFAMART\",\n \"amount\": 50000,\n \"customer_name\": \"John Doe\",\n \"expired_at\": 1787969413000,\n \"merchant_reff_no\": \"INV-2026-001\",\n \"customer_id\": \"CUST-001\",\n \"customer_email\": \"john.doe@example.com\",\n \"customer_phone\": \"081234567890\"\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/retail-transactions/{account_id}")
.header("Authorization", "Bearer <token>")
.header("X-PARTNER-ID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"retail_code\": \"ALFAMART\",\n \"amount\": 50000,\n \"customer_name\": \"John Doe\",\n \"expired_at\": 1787969413000,\n \"merchant_reff_no\": \"INV-2026-001\",\n \"customer_id\": \"CUST-001\",\n \"customer_email\": \"john.doe@example.com\",\n \"customer_phone\": \"081234567890\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-payment-b2b.singapay.id/api/v1.0/retail-transactions/{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 \"retail_code\": \"ALFAMART\",\n \"amount\": 50000,\n \"customer_name\": \"John Doe\",\n \"expired_at\": 1787969413000,\n \"merchant_reff_no\": \"INV-2026-001\",\n \"customer_id\": \"CUST-001\",\n \"customer_email\": \"john.doe@example.com\",\n \"customer_phone\": \"081234567890\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"success": true,
"data": {
"transaction_id": "1272026040210300012345",
"merchant_reff_no": "INV-2026-001",
"payment_code": "8998123456789",
"retail_code": "ALFAMART",
"account": {
"id": "01K946KF851RK7FX075GJHBVKF",
"name": "Main Account"
},
"customer": {
"id": "CUST-001",
"name": "John Doe",
"email": "john.doe@example.com",
"phone": "081234567890"
},
"status": "unpaid",
"fees": {
"name": "Alfamart",
"amount": 3000,
"currency": "IDR"
},
"amount": {
"value": 50000,
"currency": "IDR"
},
"expired_at": "1787969413000",
"processed_timestamp": null,
"post_timestamp": "1787883013000",
"has_settle": false,
"settle_at": null
}
}{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Unauthorized merchant, please sign in"
}
}{
"status": 403,
"success": false,
"error": {
"code": 403,
"message": "Access denied."
}
}{
"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"
]
}
}
}{
"status": 500,
"success": false,
"error": {
"code": 500,
"message": "Internal server error."
}
}Authorizations
JWT issued by POST /api/v1.1/access-token/b2b. Send Authorization: Bearer <token>.
Merchant API key (Credential.api_key). Required on every request.
Path Parameters
Account identifier in ULID format.
Body
Which retail outlet the customer will pay at.
ALFAMART, INDOMARET "ALFAMART"
Payment amount. Min/max come from merchant configuration (defaults: Rp 15,000 – Rp 2,500,000).
50000
255"John Doe"
Expiry as a unix timestamp in milliseconds (13 digits). Must be in the future.
1787969413000
255"INV-2026-001"
255"CUST-001"
255"john.doe@example.com"
20"081234567890"
