Create QR Payment (PayNow)
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/payment \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": "200",
"currency": "SGD",
"payment_method": {
"type": "paynow"
},
"merchant_txn_ref": "TEST00989012878787878787878787",
"customer_ip": "124.219.163.171",
"merchant_id": "SG00003085",
"return_url": {
"webhook_url": "https://merchant.example.com/webhook",
"success_url": "https://merchant.example.com/success",
"decline_url": "https://merchant.example.com/decline"
},
"billing_address": {
"country": "JP",
"email": "customer@example.com",
"address1": "Chiyoda1-1",
"phone_number": "767676767",
"city": "Minatoku",
"state": "Tokyoto",
"postal_code": "1000001"
},
"shipping_address": {
"country": "JP",
"email": "customer@example.com",
"address1": "Chiyoda1-1",
"phone_number": "08012341234",
"city": "Minatoku",
"state": "Tokyoto",
"postal_code": "1000001"
},
"time_zone": "Asia/Tokyo"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/payment"
payload = {
"amount": "200",
"currency": "SGD",
"payment_method": { "type": "paynow" },
"merchant_txn_ref": "TEST00989012878787878787878787",
"customer_ip": "124.219.163.171",
"merchant_id": "SG00003085",
"return_url": {
"webhook_url": "https://merchant.example.com/webhook",
"success_url": "https://merchant.example.com/success",
"decline_url": "https://merchant.example.com/decline"
},
"billing_address": {
"country": "JP",
"email": "customer@example.com",
"address1": "Chiyoda1-1",
"phone_number": "767676767",
"city": "Minatoku",
"state": "Tokyoto",
"postal_code": "1000001"
},
"shipping_address": {
"country": "JP",
"email": "customer@example.com",
"address1": "Chiyoda1-1",
"phone_number": "08012341234",
"city": "Minatoku",
"state": "Tokyoto",
"postal_code": "1000001"
},
"time_zone": "Asia/Tokyo"
}
headers = {
"Authorization": "<api-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '200',
currency: 'SGD',
payment_method: {type: 'paynow'},
merchant_txn_ref: 'TEST00989012878787878787878787',
customer_ip: '124.219.163.171',
merchant_id: 'SG00003085',
return_url: {
webhook_url: 'https://merchant.example.com/webhook',
success_url: 'https://merchant.example.com/success',
decline_url: 'https://merchant.example.com/decline'
},
billing_address: {
country: 'JP',
email: 'customer@example.com',
address1: 'Chiyoda1-1',
phone_number: '767676767',
city: 'Minatoku',
state: 'Tokyoto',
postal_code: '1000001'
},
shipping_address: {
country: 'JP',
email: 'customer@example.com',
address1: 'Chiyoda1-1',
phone_number: '08012341234',
city: 'Minatoku',
state: 'Tokyoto',
postal_code: '1000001'
},
time_zone: 'Asia/Tokyo'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/payment', 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-dev.paymentoptions.com/api/v1/server-to-server-interface/payment",
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' => '200',
'currency' => 'SGD',
'payment_method' => [
'type' => 'paynow'
],
'merchant_txn_ref' => 'TEST00989012878787878787878787',
'customer_ip' => '124.219.163.171',
'merchant_id' => 'SG00003085',
'return_url' => [
'webhook_url' => 'https://merchant.example.com/webhook',
'success_url' => 'https://merchant.example.com/success',
'decline_url' => 'https://merchant.example.com/decline'
],
'billing_address' => [
'country' => 'JP',
'email' => 'customer@example.com',
'address1' => 'Chiyoda1-1',
'phone_number' => '767676767',
'city' => 'Minatoku',
'state' => 'Tokyoto',
'postal_code' => '1000001'
],
'shipping_address' => [
'country' => 'JP',
'email' => 'customer@example.com',
'address1' => 'Chiyoda1-1',
'phone_number' => '08012341234',
'city' => 'Minatoku',
'state' => 'Tokyoto',
'postal_code' => '1000001'
],
'time_zone' => 'Asia/Tokyo'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-api-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-dev.paymentoptions.com/api/v1/server-to-server-interface/payment"
payload := strings.NewReader("{\n \"amount\": \"200\",\n \"currency\": \"SGD\",\n \"payment_method\": {\n \"type\": \"paynow\"\n },\n \"merchant_txn_ref\": \"TEST00989012878787878787878787\",\n \"customer_ip\": \"124.219.163.171\",\n \"merchant_id\": \"SG00003085\",\n \"return_url\": {\n \"webhook_url\": \"https://merchant.example.com/webhook\",\n \"success_url\": \"https://merchant.example.com/success\",\n \"decline_url\": \"https://merchant.example.com/decline\"\n },\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"767676767\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"08012341234\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"time_zone\": \"Asia/Tokyo\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("x-api-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-dev.paymentoptions.com/api/v1/server-to-server-interface/payment")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"200\",\n \"currency\": \"SGD\",\n \"payment_method\": {\n \"type\": \"paynow\"\n },\n \"merchant_txn_ref\": \"TEST00989012878787878787878787\",\n \"customer_ip\": \"124.219.163.171\",\n \"merchant_id\": \"SG00003085\",\n \"return_url\": {\n \"webhook_url\": \"https://merchant.example.com/webhook\",\n \"success_url\": \"https://merchant.example.com/success\",\n \"decline_url\": \"https://merchant.example.com/decline\"\n },\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"767676767\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"08012341234\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"time_zone\": \"Asia/Tokyo\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"200\",\n \"currency\": \"SGD\",\n \"payment_method\": {\n \"type\": \"paynow\"\n },\n \"merchant_txn_ref\": \"TEST00989012878787878787878787\",\n \"customer_ip\": \"124.219.163.171\",\n \"merchant_id\": \"SG00003085\",\n \"return_url\": {\n \"webhook_url\": \"https://merchant.example.com/webhook\",\n \"success_url\": \"https://merchant.example.com/success\",\n \"decline_url\": \"https://merchant.example.com/decline\"\n },\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"767676767\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"08012341234\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"time_zone\": \"Asia/Tokyo\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cd3c8f8c-75ec-4d63-a90d-10046616c5da",
"url": {
"qrCode": "data:image/png;base64,<BASE64_PNG_DATA>",
"data": "00020101021226490009SG.PAYNOW010120210201213048R0301004082026123152040000530370254032005802SG5919BeanWorks Pte. Ltd.6009SINGAPORE621001063535026304C619"
},
"amount": 200,
"currency": "SGD",
"merchant_txn_ref": "TEST00989012878787878787878787",
"merchant_id": "SG00003085",
"merchant_email": null,
"return_url": {
"webhook_url": "https://merchant.example.com/webhook",
"success_url": "https://merchant.example.com/success",
"decline_url": "https://merchant.example.com/decline"
},
"billing_address": {
"city": "Minatoku",
"email": "customer@example.com",
"state": "Tokyoto",
"country": "JP",
"address1": "Chiyoda1-1",
"postal_code": "1000001",
"phone_number": "767676767"
},
"shipping_address": {},
"redirecturl": {
"qrCode": "data:image/png;base64,<BASE64_PNG_DATA>",
"data": "00020101021226490009SG.PAYNOW010120210201213048R0301004082026123152040000530370254032005802SG5919BeanWorks Pte. Ltd.6009SINGAPORE621001063535026304C619"
}
}Wallet
QR Payment
QR Payment allows customers to complete transactions by scanning a generated QR code using a supported payment application. This section uses PayNow as an example of QR-based payment integration.
POST
/
api
/
v1
/
server-to-server-interface
/
payment
Create QR Payment (PayNow)
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/payment \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": "200",
"currency": "SGD",
"payment_method": {
"type": "paynow"
},
"merchant_txn_ref": "TEST00989012878787878787878787",
"customer_ip": "124.219.163.171",
"merchant_id": "SG00003085",
"return_url": {
"webhook_url": "https://merchant.example.com/webhook",
"success_url": "https://merchant.example.com/success",
"decline_url": "https://merchant.example.com/decline"
},
"billing_address": {
"country": "JP",
"email": "customer@example.com",
"address1": "Chiyoda1-1",
"phone_number": "767676767",
"city": "Minatoku",
"state": "Tokyoto",
"postal_code": "1000001"
},
"shipping_address": {
"country": "JP",
"email": "customer@example.com",
"address1": "Chiyoda1-1",
"phone_number": "08012341234",
"city": "Minatoku",
"state": "Tokyoto",
"postal_code": "1000001"
},
"time_zone": "Asia/Tokyo"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/payment"
payload = {
"amount": "200",
"currency": "SGD",
"payment_method": { "type": "paynow" },
"merchant_txn_ref": "TEST00989012878787878787878787",
"customer_ip": "124.219.163.171",
"merchant_id": "SG00003085",
"return_url": {
"webhook_url": "https://merchant.example.com/webhook",
"success_url": "https://merchant.example.com/success",
"decline_url": "https://merchant.example.com/decline"
},
"billing_address": {
"country": "JP",
"email": "customer@example.com",
"address1": "Chiyoda1-1",
"phone_number": "767676767",
"city": "Minatoku",
"state": "Tokyoto",
"postal_code": "1000001"
},
"shipping_address": {
"country": "JP",
"email": "customer@example.com",
"address1": "Chiyoda1-1",
"phone_number": "08012341234",
"city": "Minatoku",
"state": "Tokyoto",
"postal_code": "1000001"
},
"time_zone": "Asia/Tokyo"
}
headers = {
"Authorization": "<api-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '200',
currency: 'SGD',
payment_method: {type: 'paynow'},
merchant_txn_ref: 'TEST00989012878787878787878787',
customer_ip: '124.219.163.171',
merchant_id: 'SG00003085',
return_url: {
webhook_url: 'https://merchant.example.com/webhook',
success_url: 'https://merchant.example.com/success',
decline_url: 'https://merchant.example.com/decline'
},
billing_address: {
country: 'JP',
email: 'customer@example.com',
address1: 'Chiyoda1-1',
phone_number: '767676767',
city: 'Minatoku',
state: 'Tokyoto',
postal_code: '1000001'
},
shipping_address: {
country: 'JP',
email: 'customer@example.com',
address1: 'Chiyoda1-1',
phone_number: '08012341234',
city: 'Minatoku',
state: 'Tokyoto',
postal_code: '1000001'
},
time_zone: 'Asia/Tokyo'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/payment', 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-dev.paymentoptions.com/api/v1/server-to-server-interface/payment",
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' => '200',
'currency' => 'SGD',
'payment_method' => [
'type' => 'paynow'
],
'merchant_txn_ref' => 'TEST00989012878787878787878787',
'customer_ip' => '124.219.163.171',
'merchant_id' => 'SG00003085',
'return_url' => [
'webhook_url' => 'https://merchant.example.com/webhook',
'success_url' => 'https://merchant.example.com/success',
'decline_url' => 'https://merchant.example.com/decline'
],
'billing_address' => [
'country' => 'JP',
'email' => 'customer@example.com',
'address1' => 'Chiyoda1-1',
'phone_number' => '767676767',
'city' => 'Minatoku',
'state' => 'Tokyoto',
'postal_code' => '1000001'
],
'shipping_address' => [
'country' => 'JP',
'email' => 'customer@example.com',
'address1' => 'Chiyoda1-1',
'phone_number' => '08012341234',
'city' => 'Minatoku',
'state' => 'Tokyoto',
'postal_code' => '1000001'
],
'time_zone' => 'Asia/Tokyo'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-api-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-dev.paymentoptions.com/api/v1/server-to-server-interface/payment"
payload := strings.NewReader("{\n \"amount\": \"200\",\n \"currency\": \"SGD\",\n \"payment_method\": {\n \"type\": \"paynow\"\n },\n \"merchant_txn_ref\": \"TEST00989012878787878787878787\",\n \"customer_ip\": \"124.219.163.171\",\n \"merchant_id\": \"SG00003085\",\n \"return_url\": {\n \"webhook_url\": \"https://merchant.example.com/webhook\",\n \"success_url\": \"https://merchant.example.com/success\",\n \"decline_url\": \"https://merchant.example.com/decline\"\n },\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"767676767\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"08012341234\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"time_zone\": \"Asia/Tokyo\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("x-api-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-dev.paymentoptions.com/api/v1/server-to-server-interface/payment")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"200\",\n \"currency\": \"SGD\",\n \"payment_method\": {\n \"type\": \"paynow\"\n },\n \"merchant_txn_ref\": \"TEST00989012878787878787878787\",\n \"customer_ip\": \"124.219.163.171\",\n \"merchant_id\": \"SG00003085\",\n \"return_url\": {\n \"webhook_url\": \"https://merchant.example.com/webhook\",\n \"success_url\": \"https://merchant.example.com/success\",\n \"decline_url\": \"https://merchant.example.com/decline\"\n },\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"767676767\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"08012341234\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"time_zone\": \"Asia/Tokyo\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"200\",\n \"currency\": \"SGD\",\n \"payment_method\": {\n \"type\": \"paynow\"\n },\n \"merchant_txn_ref\": \"TEST00989012878787878787878787\",\n \"customer_ip\": \"124.219.163.171\",\n \"merchant_id\": \"SG00003085\",\n \"return_url\": {\n \"webhook_url\": \"https://merchant.example.com/webhook\",\n \"success_url\": \"https://merchant.example.com/success\",\n \"decline_url\": \"https://merchant.example.com/decline\"\n },\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"767676767\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"customer@example.com\",\n \"address1\": \"Chiyoda1-1\",\n \"phone_number\": \"08012341234\",\n \"city\": \"Minatoku\",\n \"state\": \"Tokyoto\",\n \"postal_code\": \"1000001\"\n },\n \"time_zone\": \"Asia/Tokyo\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cd3c8f8c-75ec-4d63-a90d-10046616c5da",
"url": {
"qrCode": "data:image/png;base64,<BASE64_PNG_DATA>",
"data": "00020101021226490009SG.PAYNOW010120210201213048R0301004082026123152040000530370254032005802SG5919BeanWorks Pte. Ltd.6009SINGAPORE621001063535026304C619"
},
"amount": 200,
"currency": "SGD",
"merchant_txn_ref": "TEST00989012878787878787878787",
"merchant_id": "SG00003085",
"merchant_email": null,
"return_url": {
"webhook_url": "https://merchant.example.com/webhook",
"success_url": "https://merchant.example.com/success",
"decline_url": "https://merchant.example.com/decline"
},
"billing_address": {
"city": "Minatoku",
"email": "customer@example.com",
"state": "Tokyoto",
"country": "JP",
"address1": "Chiyoda1-1",
"postal_code": "1000001",
"phone_number": "767676767"
},
"shipping_address": {},
"redirecturl": {
"qrCode": "data:image/png;base64,<BASE64_PNG_DATA>",
"data": "00020101021226490009SG.PAYNOW010120210201213048R0301004082026123152040000530370254032005802SG5919BeanWorks Pte. Ltd.6009SINGAPORE621001063535026304C619"
}
}Key Points
Merchant Configuration
- The Merchant ID must be configured to support the selected QR payment method.
- For the PayNow example, the
payment_methodtype must be set topaynow. - The PayNow request example uses SGD as the processing currency.
- QR Payments are supported through both Purchase API (v1) and Purchase API (v2).
- Purchase API (v1):
POST /api/v1/server-to-server-interface/payment - Purchase API (v2):
POST /api/v1/server-to-server-interface/paymentv2 - For new integrations, Purchase API (v2) is recommended, as v1 is scheduled for deprecation.
- The Direct Payment API generates QR code data for the customer to complete the payment.
- For PayNow, the response includes a Base64-encoded QR code image in
url.qrCodeand the corresponding QR payment payload inurl.data. - The merchant can display the QR code for the customer to scan using a supported banking application.
- QR code generation does not indicate that payment has been completed.
Authorizations
Body
application/json
PayNow Direct Payment request. Billing address is required; shipping address is optional.
Response
200 - application/json
QR payment created; QR data returned. This does not indicate payment completion.