curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/authorization \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": "1000",
"currency": "JPY",
"card": {
"cvc": "100",
"expiry_month": "12",
"expiry_year": "29",
"name": "John Doe",
"number": "5200000000001005"
},
"merchant_id": "< Merchant ID >",
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"shipping_address": {
"country": "JP",
"email": "shipping@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"browser_info": {
"acceptHeader": "text/html",
"screenColorDepth": "48",
"javaEnabled": false,
"language": "en",
"screenHeight": "1200",
"screenWidth": "1600",
"challengeWindow": "4",
"userAgent": "Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)"
},
"time_zone": "Asia/Kuala_Lumpur"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/authorization"
payload = {
"amount": "1000",
"currency": "JPY",
"card": {
"cvc": "100",
"expiry_month": "12",
"expiry_year": "29",
"name": "John Doe",
"number": "5200000000001005"
},
"merchant_id": "< Merchant ID >",
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"shipping_address": {
"country": "JP",
"email": "shipping@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"browser_info": {
"acceptHeader": "text/html",
"screenColorDepth": "48",
"javaEnabled": False,
"language": "en",
"screenHeight": "1200",
"screenWidth": "1600",
"challengeWindow": "4",
"userAgent": "Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)"
},
"time_zone": "Asia/Kuala_Lumpur"
}
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: '1000',
currency: 'JPY',
card: {
cvc: '100',
expiry_month: '12',
expiry_year: '29',
name: 'John Doe',
number: '5200000000001005'
},
merchant_id: '< Merchant ID >',
billing_address: {
country: 'JP',
email: 'billing@testemail.com',
phone_number: '8112345678',
address1: '1-2-3 Shinjuku',
city: 'Shinjuku-ku',
state: 'Tokyo',
postal_code: '1600022'
},
merchant_txn_ref: 'qwe',
customer_ip: '127.0.0.1',
return_url: {
webhook_url: '< Webhook url >',
success_url: 'http://www.successurl.com/',
decline_url: 'http://www.declineurl.com/'
},
shipping_address: {
country: 'JP',
email: 'shipping@testemail.com',
phone_number: '8112345678',
address1: '1-2-3 Shinjuku',
city: 'Shinjuku-ku',
state: 'Tokyo',
postal_code: '1600022'
},
browser_info: {
acceptHeader: 'text/html',
screenColorDepth: '48',
javaEnabled: false,
language: 'en',
screenHeight: '1200',
screenWidth: '1600',
challengeWindow: '4',
userAgent: 'Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)'
},
time_zone: 'Asia/Kuala_Lumpur'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/authorization', 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/authorization",
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' => '1000',
'currency' => 'JPY',
'card' => [
'cvc' => '100',
'expiry_month' => '12',
'expiry_year' => '29',
'name' => 'John Doe',
'number' => '5200000000001005'
],
'merchant_id' => '< Merchant ID >',
'billing_address' => [
'country' => 'JP',
'email' => 'billing@testemail.com',
'phone_number' => '8112345678',
'address1' => '1-2-3 Shinjuku',
'city' => 'Shinjuku-ku',
'state' => 'Tokyo',
'postal_code' => '1600022'
],
'merchant_txn_ref' => 'qwe',
'customer_ip' => '127.0.0.1',
'return_url' => [
'webhook_url' => '< Webhook url >',
'success_url' => 'http://www.successurl.com/',
'decline_url' => 'http://www.declineurl.com/'
],
'shipping_address' => [
'country' => 'JP',
'email' => 'shipping@testemail.com',
'phone_number' => '8112345678',
'address1' => '1-2-3 Shinjuku',
'city' => 'Shinjuku-ku',
'state' => 'Tokyo',
'postal_code' => '1600022'
],
'browser_info' => [
'acceptHeader' => 'text/html',
'screenColorDepth' => '48',
'javaEnabled' => false,
'language' => 'en',
'screenHeight' => '1200',
'screenWidth' => '1600',
'challengeWindow' => '4',
'userAgent' => 'Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)'
],
'time_zone' => 'Asia/Kuala_Lumpur'
]),
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/authorization"
payload := strings.NewReader("{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"100\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"5200000000001005\"\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"shipping@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"browser_info\": {\n \"acceptHeader\": \"text/html\",\n \"screenColorDepth\": \"48\",\n \"javaEnabled\": false,\n \"language\": \"en\",\n \"screenHeight\": \"1200\",\n \"screenWidth\": \"1600\",\n \"challengeWindow\": \"4\",\n \"userAgent\": \"Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\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/authorization")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"100\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"5200000000001005\"\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"shipping@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"browser_info\": {\n \"acceptHeader\": \"text/html\",\n \"screenColorDepth\": \"48\",\n \"javaEnabled\": false,\n \"language\": \"en\",\n \"screenHeight\": \"1200\",\n \"screenWidth\": \"1600\",\n \"challengeWindow\": \"4\",\n \"userAgent\": \"Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/authorization")
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\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"100\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"5200000000001005\"\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"shipping@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"browser_info\": {\n \"acceptHeader\": \"text/html\",\n \"screenColorDepth\": \"48\",\n \"javaEnabled\": false,\n \"language\": \"en\",\n \"screenHeight\": \"1200\",\n \"screenWidth\": \"1600\",\n \"challengeWindow\": \"4\",\n \"userAgent\": \"Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status_code": 201,
"is_live": false,
"transaction_type": "PRE_AUTH",
"gateway_response": {
"version": "1",
"type": "INFO",
"message": "Payment Successful.",
"code": "INFO0000"
},
"merchant_details": {
"legal_name": "Tink15 Factory",
"mid": "< Merchant ID >",
"merchant_txn_ref": "qwe",
"billing_details": {
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
}
},
"device_details": {
"visited_ip": "127.0.0.1",
"merchant_ip": "127.0.0.1",
"customer_ip": "127.0.0.1"
}
},
"payment_details": {
"amount": 1000,
"response_code": 0,
"auth_code": "917290",
"currency": "JPY",
"payment_method": "ECMC-SSL",
"scheme": "MASTERCARD",
"card": {
"name": "John Doe",
"number": "5200000000001005",
"exp_month": "12",
"exp_year": "29"
},
"additional_data": {
"payment_data_source": {
"type": "card"
}
}
},
"transaction_details": {
"id": "ab8444e7-fec0-40dd-994d-0ad813785f74",
"ref": 74797,
"timestamp": "2024-11-25T07:22:48.000Z",
"merchant_txn_ref": "qwe",
"stored_payment_method_id": null
},
"risk-details": {
"risk_score": null
}
}Authorization API (v1)
Authorize a payment by securing funds for a transaction without capturing them immediately.
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/authorization \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": "1000",
"currency": "JPY",
"card": {
"cvc": "100",
"expiry_month": "12",
"expiry_year": "29",
"name": "John Doe",
"number": "5200000000001005"
},
"merchant_id": "< Merchant ID >",
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"shipping_address": {
"country": "JP",
"email": "shipping@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"browser_info": {
"acceptHeader": "text/html",
"screenColorDepth": "48",
"javaEnabled": false,
"language": "en",
"screenHeight": "1200",
"screenWidth": "1600",
"challengeWindow": "4",
"userAgent": "Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)"
},
"time_zone": "Asia/Kuala_Lumpur"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/authorization"
payload = {
"amount": "1000",
"currency": "JPY",
"card": {
"cvc": "100",
"expiry_month": "12",
"expiry_year": "29",
"name": "John Doe",
"number": "5200000000001005"
},
"merchant_id": "< Merchant ID >",
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"shipping_address": {
"country": "JP",
"email": "shipping@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"browser_info": {
"acceptHeader": "text/html",
"screenColorDepth": "48",
"javaEnabled": False,
"language": "en",
"screenHeight": "1200",
"screenWidth": "1600",
"challengeWindow": "4",
"userAgent": "Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)"
},
"time_zone": "Asia/Kuala_Lumpur"
}
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: '1000',
currency: 'JPY',
card: {
cvc: '100',
expiry_month: '12',
expiry_year: '29',
name: 'John Doe',
number: '5200000000001005'
},
merchant_id: '< Merchant ID >',
billing_address: {
country: 'JP',
email: 'billing@testemail.com',
phone_number: '8112345678',
address1: '1-2-3 Shinjuku',
city: 'Shinjuku-ku',
state: 'Tokyo',
postal_code: '1600022'
},
merchant_txn_ref: 'qwe',
customer_ip: '127.0.0.1',
return_url: {
webhook_url: '< Webhook url >',
success_url: 'http://www.successurl.com/',
decline_url: 'http://www.declineurl.com/'
},
shipping_address: {
country: 'JP',
email: 'shipping@testemail.com',
phone_number: '8112345678',
address1: '1-2-3 Shinjuku',
city: 'Shinjuku-ku',
state: 'Tokyo',
postal_code: '1600022'
},
browser_info: {
acceptHeader: 'text/html',
screenColorDepth: '48',
javaEnabled: false,
language: 'en',
screenHeight: '1200',
screenWidth: '1600',
challengeWindow: '4',
userAgent: 'Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)'
},
time_zone: 'Asia/Kuala_Lumpur'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/authorization', 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/authorization",
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' => '1000',
'currency' => 'JPY',
'card' => [
'cvc' => '100',
'expiry_month' => '12',
'expiry_year' => '29',
'name' => 'John Doe',
'number' => '5200000000001005'
],
'merchant_id' => '< Merchant ID >',
'billing_address' => [
'country' => 'JP',
'email' => 'billing@testemail.com',
'phone_number' => '8112345678',
'address1' => '1-2-3 Shinjuku',
'city' => 'Shinjuku-ku',
'state' => 'Tokyo',
'postal_code' => '1600022'
],
'merchant_txn_ref' => 'qwe',
'customer_ip' => '127.0.0.1',
'return_url' => [
'webhook_url' => '< Webhook url >',
'success_url' => 'http://www.successurl.com/',
'decline_url' => 'http://www.declineurl.com/'
],
'shipping_address' => [
'country' => 'JP',
'email' => 'shipping@testemail.com',
'phone_number' => '8112345678',
'address1' => '1-2-3 Shinjuku',
'city' => 'Shinjuku-ku',
'state' => 'Tokyo',
'postal_code' => '1600022'
],
'browser_info' => [
'acceptHeader' => 'text/html',
'screenColorDepth' => '48',
'javaEnabled' => false,
'language' => 'en',
'screenHeight' => '1200',
'screenWidth' => '1600',
'challengeWindow' => '4',
'userAgent' => 'Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)'
],
'time_zone' => 'Asia/Kuala_Lumpur'
]),
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/authorization"
payload := strings.NewReader("{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"100\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"5200000000001005\"\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"shipping@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"browser_info\": {\n \"acceptHeader\": \"text/html\",\n \"screenColorDepth\": \"48\",\n \"javaEnabled\": false,\n \"language\": \"en\",\n \"screenHeight\": \"1200\",\n \"screenWidth\": \"1600\",\n \"challengeWindow\": \"4\",\n \"userAgent\": \"Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\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/authorization")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"100\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"5200000000001005\"\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"shipping@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"browser_info\": {\n \"acceptHeader\": \"text/html\",\n \"screenColorDepth\": \"48\",\n \"javaEnabled\": false,\n \"language\": \"en\",\n \"screenHeight\": \"1200\",\n \"screenWidth\": \"1600\",\n \"challengeWindow\": \"4\",\n \"userAgent\": \"Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/authorization")
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\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"100\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"5200000000001005\"\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"shipping@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"browser_info\": {\n \"acceptHeader\": \"text/html\",\n \"screenColorDepth\": \"48\",\n \"javaEnabled\": false,\n \"language\": \"en\",\n \"screenHeight\": \"1200\",\n \"screenWidth\": \"1600\",\n \"challengeWindow\": \"4\",\n \"userAgent\": \"Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status_code": 201,
"is_live": false,
"transaction_type": "PRE_AUTH",
"gateway_response": {
"version": "1",
"type": "INFO",
"message": "Payment Successful.",
"code": "INFO0000"
},
"merchant_details": {
"legal_name": "Tink15 Factory",
"mid": "< Merchant ID >",
"merchant_txn_ref": "qwe",
"billing_details": {
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
}
},
"device_details": {
"visited_ip": "127.0.0.1",
"merchant_ip": "127.0.0.1",
"customer_ip": "127.0.0.1"
}
},
"payment_details": {
"amount": 1000,
"response_code": 0,
"auth_code": "917290",
"currency": "JPY",
"payment_method": "ECMC-SSL",
"scheme": "MASTERCARD",
"card": {
"name": "John Doe",
"number": "5200000000001005",
"exp_month": "12",
"exp_year": "29"
},
"additional_data": {
"payment_data_source": {
"type": "card"
}
}
},
"transaction_details": {
"id": "ab8444e7-fec0-40dd-994d-0ad813785f74",
"ref": 74797,
"timestamp": "2024-11-25T07:22:48.000Z",
"merchant_txn_ref": "qwe",
"stored_payment_method_id": null
},
"risk-details": {
"risk_score": null
}
}Key Points
- The Authorization API secures the specified amount on the customer’s payment method, but the funds are not transferred until a capture is performed.
- Capture: Finalizes the transaction by transferring the authorized funds from the customer’s account.
- Void: Cancels the authorization, releasing the held funds back to the customer.
- Use cases for this API include scenarios where the exact final amount may vary, such as hotel bookings, car rentals, or pre-order situations.
Flow diagram
Api Parameters
Authorizations
API Key for Authorization. Format: 'Basic YOUR_API_KEY_HERE'
API Key specific to x-api-key.
Body
The request payload to authorize a payment transaction.
The amount of the transaction.
"1000"
The abbreviation of the processing currency of the product (e.g., JPY).
3"JPY"
A JSON object containing the Card Details.
Show child attributes
Show child attributes
The merchant ID (DASMID).
128"< Merchant ID >"
A JSON object containing the billing address of the cardholder.
Show child attributes
Show child attributes
The merchant transaction reference ID.
45"qwe"
The IP address of the cardholder.
45"127.0.0.1"
A JSON object containing the Return URL. (This field is mandatory for 3DS transactions.)
Show child attributes
Show child attributes
A JSON object containing the shipping address of the cardholder (optional).
Show child attributes
Show child attributes
A JSON object containing details about the browser used by the cardholder (optional).
Show child attributes
Show child attributes
The country time zone of the transaction.
128"Asia/Kuala_Lumpur"
Response
Payment authorized successfully
True on successful transaction, false on failure.
true
The status code of the transaction.
201
True if live transaction, false if test transaction.
false
The transaction type (e.g., PRE_AUTH).
"PRE_AUTH"
A JSON object containing the response from the gateway.
Show child attributes
Show child attributes
A JSON object containing the details of the merchant.
Show child attributes
Show child attributes
A JSON object containing the payment details.
Show child attributes
Show child attributes
A JSON object containing details of the transaction.
Show child attributes
Show child attributes
A JSON object containing details of risk.
Show child attributes
Show child attributes