Generate OAuth access token
curl --request POST \
--url https://sandbox-biller-b2b.singapay.id/api/v1.0/access-token/b2b \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: <content-type>' \
--header 'X-PARTNER-ID: <x-partner-id>' \
--data '
{
"grant_type": "client_credentials"
}
'import requests
url = "https://sandbox-biller-b2b.singapay.id/api/v1.0/access-token/b2b"
payload = { "grant_type": "client_credentials" }
headers = {
"X-PARTNER-ID": "<x-partner-id>",
"Content-Type": "<content-type>",
"Authorization": "Basic <encoded-value>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-PARTNER-ID': '<x-partner-id>',
'Content-Type': '<content-type>',
Authorization: 'Basic <encoded-value>'
},
body: JSON.stringify({grant_type: 'client_credentials'})
};
fetch('https://sandbox-biller-b2b.singapay.id/api/v1.0/access-token/b2b', 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-biller-b2b.singapay.id/api/v1.0/access-token/b2b",
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([
'grant_type' => 'client_credentials'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: <content-type>",
"X-PARTNER-ID: <x-partner-id>"
],
]);
$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-biller-b2b.singapay.id/api/v1.0/access-token/b2b"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-PARTNER-ID", "<x-partner-id>")
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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-biller-b2b.singapay.id/api/v1.0/access-token/b2b")
.header("X-PARTNER-ID", "<x-partner-id>")
.header("Content-Type", "<content-type>")
.header("Authorization", "Basic <encoded-value>")
.body("{\n \"grant_type\": \"client_credentials\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-biller-b2b.singapay.id/api/v1.0/access-token/b2b")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-PARTNER-ID"] = '<x-partner-id>'
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Basic <encoded-value>'
request.body = "{\n \"grant_type\": \"client_credentials\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"success": true,
"data": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": "3600"
}
}{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Invalid credentials"
}
}{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Invalid credentials"
}
}Authentication
Generate OAuth access token
Authenticate using client credentials (Basic Auth) and obtain a JWT access token for subsequent API calls. Basic Authentication automatically generates a string encoded in Base64 format by combining the client_id and client_secret with a colon separator.
POST
/
api
/
v1.0
/
access-token
/
b2b
Generate OAuth access token
curl --request POST \
--url https://sandbox-biller-b2b.singapay.id/api/v1.0/access-token/b2b \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: <content-type>' \
--header 'X-PARTNER-ID: <x-partner-id>' \
--data '
{
"grant_type": "client_credentials"
}
'import requests
url = "https://sandbox-biller-b2b.singapay.id/api/v1.0/access-token/b2b"
payload = { "grant_type": "client_credentials" }
headers = {
"X-PARTNER-ID": "<x-partner-id>",
"Content-Type": "<content-type>",
"Authorization": "Basic <encoded-value>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-PARTNER-ID': '<x-partner-id>',
'Content-Type': '<content-type>',
Authorization: 'Basic <encoded-value>'
},
body: JSON.stringify({grant_type: 'client_credentials'})
};
fetch('https://sandbox-biller-b2b.singapay.id/api/v1.0/access-token/b2b', 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-biller-b2b.singapay.id/api/v1.0/access-token/b2b",
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([
'grant_type' => 'client_credentials'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: <content-type>",
"X-PARTNER-ID: <x-partner-id>"
],
]);
$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-biller-b2b.singapay.id/api/v1.0/access-token/b2b"
payload := strings.NewReader("{\n \"grant_type\": \"client_credentials\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-PARTNER-ID", "<x-partner-id>")
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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-biller-b2b.singapay.id/api/v1.0/access-token/b2b")
.header("X-PARTNER-ID", "<x-partner-id>")
.header("Content-Type", "<content-type>")
.header("Authorization", "Basic <encoded-value>")
.body("{\n \"grant_type\": \"client_credentials\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-biller-b2b.singapay.id/api/v1.0/access-token/b2b")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-PARTNER-ID"] = '<x-partner-id>'
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Basic <encoded-value>'
request.body = "{\n \"grant_type\": \"client_credentials\"\n}"
response = http.request(request)
puts response.read_body{
"status": 200,
"success": true,
"data": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": "3600"
}
}{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Invalid credentials"
}
}{
"status": 401,
"success": false,
"error": {
"code": 401,
"message": "Invalid credentials"
}
}Authorizations
Basic authentication using Base64 encoded client_id:client_secret. Format: Authorization: Basic <base64(client_id:client_secret)>
Headers
Merchant API key
Response format
Body
application/json
Available options:
client_credentials Example:
"client_credentials"
⌘I
