Payments
GET /api/v1/payments
List Payments
Retrieves a paginated list of payments. Pagination can be configured with page
and per_page
parameters.
Payments can be filtered by currency
, external_order_num
, and status
.
A time range can be specified with start_time
, and end_time
.
Examples
- cURL
- Node.js
- Ruby
curl -X GET https://komoju.com/api/v1/payments?per_page=-1 \
-u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var get_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments?per_page=-1',
method: 'GET',
headers: {
'Authorization': auth
}
};
var get_req = https.request(get_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
get_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments?per_page=-1')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
res = https.get(uri.path, headers)
puts res.body
{
"error": {
"code": "invalid_parameter",
"message": "-1.0 must be greater than or equal to 1.",
"param": "per_page",
"details": {
}
}
}
Params
Param name | Description |
---|---|
start_time optional |
Query for records created after this time. |
end_time optional |
Query for records created before this time. |
per_page optional |
How many complete objects per page. |
page optional |
Page number to query for. |
currency optional |
3 letter ISO currency code used to pay. |
external_order_num optional |
A unique ID from your application used to track this payment. |
status optional |
The status of the payment. |
GET /api/v1/payments/:id
Show Payments
Retrieves a single payment object by its id
.
Examples
- cURL
- Node.js
- Ruby
curl -X GET https://komoju.com/api/v1/payments/dp6f5pozrrh0nypa62joe09sd \
-u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var get_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments/dp6f5pozrrh0nypa62joe09sd',
method: 'GET',
headers: {
'Authorization': auth
}
};
var get_req = https.request(get_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
get_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/dp6f5pozrrh0nypa62joe09sd')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
res = https.get(uri.path, headers)
puts res.body
{
"id": "dp6f5pozrrh0nypa62joe09sd",
"resource": "payment",
"status": "pending",
"amount": 300,
"tax": 30,
"customer": null,
"payment_deadline": "2020-06-12T14:59:59Z",
"payment_details": {
"type": "konbini",
"email": "gordon@example.com",
"store": "lawson",
"confirmation_code": "1111",
"receipt": "12345",
"instructions_url": "https://komoju.com/en/instructions/dp6f5pozrrh0nypa62joe09sd"
},
"payment_method_fee": 0,
"total": 330,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": "ORDER14",
"metadata": {
},
"created_at": "2020-06-09T07:42:03Z",
"amount_refunded": 0,
"locale": "en",
"refunds": [
],
"refund_requests": [
]
}
POST /api/v1/payments
Create Payments
Creates a payment for a given amount
and currency
.
*Must specify exactly one of payment_details
or customer
.
Examples
- Credit Card
- Konbini
- Bank transfer
- PayEasy
- WebMoney
- BitCash
- NET CASH
- Mobile
- LINE Pay
- Merpay
- PayPay
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=KRW" \
-d "email=foo@bar.com" \
-d "payment_details[email]=foo@bar.com" \
-d "payment_details[type]=mobile" \
-d "return_url=http://example.com" \
-d "tax=0"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'KRW',
'email': 'foo@bar.com',
'payment_details[email]': 'foo@bar.com',
'payment_details[type]': 'mobile',
'return_url': 'http://example.com',
'tax': '0'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "KRW",
email: "foo@bar.com",
payment_details: {
email: "foo@bar.com",
type: "mobile"
},
return_url: "http://example.com",
tax: "0"
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=100" \
-d "currency=JPY" \
-d "debug=true" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[prepaid_number]=1111111111111111" \
-d "payment_details[type]=bit_cash"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '100',
'currency': 'JPY',
'debug': 'true',
'payment_details[email]': 'test@example.com',
'payment_details[prepaid_number]': '1111111111111111',
'payment_details[type]': 'bit_cash'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "100",
currency: "JPY",
debug: "true",
payment_details: {
email: "test@example.com",
prepaid_number: "1111111111111111",
type: "bit_cash"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[type]=linepay" \
-d "return_url=https://example.com"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'payment_details[email]': 'test@example.com',
'payment_details[type]': 'linepay',
'return_url': 'https://example.com'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
payment_details: {
email: "test@example.com",
type: "linepay"
},
return_url: "https://example.com"
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[type]=merpay" \
-d "return_url=https://example.com"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'payment_details[email]': 'test@example.com',
'payment_details[type]': 'merpay',
'return_url': 'https://example.com'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
payment_details: {
email: "test@example.com",
type: "merpay"
},
return_url: "https://example.com"
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[type]=paypay" \
-d "return_url=https://example.com"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'payment_details[email]': 'test@example.com',
'payment_details[type]': 'paypay',
'return_url': 'https://example.com'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
payment_details: {
email: "test@example.com",
type: "paypay"
},
return_url: "https://example.com"
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "payment_details[brand]=docomo" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[type]=japan_mobile" \
-d "return_url=https://example.com"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'payment_details[brand]': 'docomo',
'payment_details[email]': 'test@example.com',
'payment_details[type]': 'japan_mobile',
'return_url': 'https://example.com'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
payment_details: {
brand: "docomo",
email: "test@example.com",
type: "japan_mobile"
},
return_url: "https://example.com"
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[expiry_days]=3" \
-d "payment_details[phone]=090-1111-2222" \
-d "payment_details[store]=lawson" \
-d "payment_details[type]=konbini"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[email]': 'test@example.com',
'payment_details[expiry_days]': '3',
'payment_details[phone]': '090-1111-2222',
'payment_details[store]': 'lawson',
'payment_details[type]': 'konbini'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
email: "test@example.com",
expiry_days: "3",
phone: "090-1111-2222",
store: "lawson",
type: "konbini"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[family_name]=山田" \
-d "payment_details[family_name_kana]=ヤマダ" \
-d "payment_details[given_name]=太郎" \
-d "payment_details[given_name_kana]=タロウ" \
-d "payment_details[phone]=080-1111-2222" \
-d "payment_details[type]=pay_easy"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[email]': 'test@example.com',
'payment_details[family_name]': '山田',
'payment_details[family_name_kana]': 'ヤマダ',
'payment_details[given_name]': '太郎',
'payment_details[given_name_kana]': 'タロウ',
'payment_details[phone]': '080-1111-2222',
'payment_details[type]': 'pay_easy'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
email: "test@example.com",
family_name: "山田",
family_name_kana: "ヤマダ",
given_name: "太郎",
given_name_kana: "タロウ",
phone: "080-1111-2222",
type: "pay_easy"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[prepaid_number]=1111111111111111" \
-d "payment_details[type]=net_cash"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[email]': 'test@example.com',
'payment_details[prepaid_number]': '1111111111111111',
'payment_details[type]': 'net_cash'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
email: "test@example.com",
prepaid_number: "1111111111111111",
type: "net_cash"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=KRW" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[happy_money_id]=11111111" \
-d "payment_details[happy_money_password]=11111111" \
-d "payment_details[type]=happy_money"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'KRW',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[happy_money_id]': '11111111',
'payment_details[happy_money_password]': '11111111',
'payment_details[type]': 'happy_money'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "KRW",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
happy_money_id: "11111111",
happy_money_password: "11111111",
type: "happy_money"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[expiry_days]=14" \
-d "payment_details[family_name]=山田" \
-d "payment_details[family_name_kana]=ヤマダ" \
-d "payment_details[given_name]=太郎" \
-d "payment_details[given_name_kana]=タロウ" \
-d "payment_details[phone]=080-1111-2222" \
-d "payment_details[type]=bank_transfer"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[email]': 'test@example.com',
'payment_details[expiry_days]': '14',
'payment_details[family_name]': '山田',
'payment_details[family_name_kana]': 'ヤマダ',
'payment_details[given_name]': '太郎',
'payment_details[given_name_kana]': 'タロウ',
'payment_details[phone]': '080-1111-2222',
'payment_details[type]': 'bank_transfer'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
email: "test@example.com",
expiry_days: "14",
family_name: "山田",
family_name_kana: "ヤマダ",
given_name: "太郎",
given_name_kana: "タロウ",
phone: "080-1111-2222",
type: "bank_transfer"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=KRW" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[culture_id]=11111111" \
-d "payment_details[culture_password]=11111111" \
-d "payment_details[type]=culture_voucher"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'KRW',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[culture_id]': '11111111',
'payment_details[culture_password]': '11111111',
'payment_details[type]': 'culture_voucher'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "KRW",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
culture_id: "11111111",
culture_password: "11111111",
type: "culture_voucher"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[month]=01" \
-d "payment_details[name]=Taro Yamada" \
-d "payment_details[number]=4111111111111111" \
-d "payment_details[type]=credit_card" \
-d "payment_details[verification_value]=123" \
-d "payment_details[year]=2025"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[email]': 'test@example.com',
'payment_details[month]': '01',
'payment_details[name]': 'Taro Yamada',
'payment_details[number]': '4111111111111111',
'payment_details[type]': 'credit_card',
'payment_details[verification_value]': '123',
'payment_details[year]': '2025'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
email: "test@example.com",
month: "01",
name: "Taro Yamada",
number: "4111111111111111",
type: "credit_card",
verification_value: "123",
year: "2025"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[prepaid_number]=1111111111111111" \
-d "payment_details[type]=web_money"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[email]': 'test@example.com',
'payment_details[prepaid_number]': '1111111111111111',
'payment_details[type]': 'web_money'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
email: "test@example.com",
prepaid_number: "1111111111111111",
type: "web_money"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments \
-u sk_123456: \
-d "amount=1000" \
-d "currency=JPY" \
-d "external_order_num=123" \
-d "metadata[foobar]=hoge" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[prepaid_number]=1111111111111111" \
-d "payment_details[type]=nanaco"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '1000',
'currency': 'JPY',
'external_order_num': '123',
'metadata[foobar]': 'hoge',
'payment_details[email]': 'test@example.com',
'payment_details[prepaid_number]': '1111111111111111',
'payment_details[type]': 'nanaco'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "1000",
currency: "JPY",
external_order_num: "123",
metadata: {
foobar: "hoge"
},
payment_details: {
email: "test@example.com",
prepaid_number: "1111111111111111",
type: "nanaco"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
{
"id": "bncg5974hoii95erwy2gqx7vz",
"resource": "payment",
"status": "authorized",
"amount": 1000,
"tax": 0,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "mobile",
"email": "foo@bar.com",
"provider": null,
"redirect_url": "https://testpg.payletter.com/PGSVC/DanalMobile/MobileAuthForm.asp?clientparam=1234567890123456%7C001%7C4%7C3230323030363039303734313530303031363631343439333239723e61e87ee88bff89acd0392712dc63fe681e55e361861f09be1b49b562e33c9b5927a28ca068fbcb6f23afe6b466ab77b9c49d8ed4d949d0187d0a2d759e85474bc3c56690d9b753c560800a9d75eccbc9aae3c8d29b108f034872350ac8824027b2fc20b2d9d6178c3fba5bb52deed9f7af9ea575b18011741be5a3492564b66c00cbb161c531b90f5a8f34b353f3d6b1e99eaa7fa21c6879a287f3f01a15dc5b056a3f26c0a16367909fc9abc6e2a40be73e567b0686d4003ddd4cf26c58d611913f15fed1c578c95db551190ea54efdd15f8077053d25a2290775a4d48eeb4cca545fd53ca0c1ca12b9e08f619f7001862699beaa572ce7620a6655a48392e4fe17184f154a30b8c8ac358e26f7feeaca581d26c8f9d2279ad0909c5d4b274bf99456858a0c1e7cdd3975139de043297e4794a5afd0399d77f244f5db"
},
"payment_method_fee": 0,
"total": 1000,
"currency": "KRW",
"description": null,
"captured_at": null,
"external_order_num": null,
"metadata": {
},
"created_at": "2020-06-09T07:41:50Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "73cf3349ch47rdbqjjp2c8oyy",
"resource": "payment",
"status": "captured",
"amount": 100,
"tax": 10,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "bit_cash",
"email": "test@example.com"
},
"payment_method_fee": 0,
"total": 110,
"currency": "JPY",
"description": null,
"captured_at": "2020-06-09T07:41:51Z",
"external_order_num": null,
"metadata": {
},
"created_at": "2020-06-09T07:41:51Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "87rh791klpxxv4rgshn3yu2hf",
"resource": "payment",
"status": "authorized",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "linepay",
"email": "test@example.com",
"redirect_url": "https://komoju.com/offsite/new?uuid=87rh791klpxxv4rgshn3yu2hf"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": null,
"metadata": {
},
"created_at": "2020-06-09T07:41:59Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "5nnvwksll8q299v69i9jdpxzn",
"resource": "payment",
"status": "authorized",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "merpay",
"email": "test@example.com",
"redirect_url": "https://komoju.com/offsite/new?uuid=5nnvwksll8q299v69i9jdpxzn"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": null,
"metadata": {
},
"created_at": "2020-06-09T07:42:00Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "87rh791klpxxv4rgshn3yu2hf",
"resource": "payment",
"status": "authorized",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "paypay",
"email": "test@example.com",
"redirect_url": "https://komoju.com/offsite/new?uuid=87rh791klpxxv4rgshn3yu2hf"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": null,
"metadata": {
},
"created_at": "2020-06-09T07:41:59Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "9adne51m4l3fr498rd40o0xf9",
"resource": "payment",
"status": "authorized",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "japan_mobile",
"email": "test@example.com",
"provider": "docomo",
"redirect_url": "https://komoju.com/offsite/new?uuid=9adne51m4l3fr498rd40o0xf9"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": null,
"metadata": {
},
"created_at": "2020-06-09T07:42:00Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "7h2ywj2xwzqm7g4e0s3ed9tmv",
"resource": "payment",
"status": "authorized",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-12T14:59:59Z",
"payment_details": {
"type": "konbini",
"email": "test@example.com",
"store": "lawson",
"confirmation_code": "2222",
"receipt": "90865708838",
"instructions_url": "https://komoju.com/ja/instructions/7h2ywj2xwzqm7g4e0s3ed9tmv"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:04Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "3pbcqcbd7m5b0ypy8c5lefczh",
"resource": "payment",
"status": "authorized",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-19T14:59:59Z",
"payment_details": {
"type": "pay_easy",
"email": "test@example.com",
"bank_id": "58191",
"customer_id": "20001900030947960025",
"confirmation_id": "288916",
"instructions_url": "https://komoju.com/ja/instructions/3pbcqcbd7m5b0ypy8c5lefczh"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:11Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "ena9brsze3ynkmhkfj5v2foig",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-16T07:42:12Z",
"payment_details": {
"type": "net_cash",
"email": "test@example.com",
"short_amount": 0,
"prepaid_cards": [
{
"last_four_digits": "1111",
"points": 1100
}
]
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": "2020-06-09T07:42:12Z",
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:12Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "c6l9g4murft6tnvig6zxf4q53",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "happy_money",
"email": null,
"happy_money_id": "11111111"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "KRW",
"description": null,
"captured_at": "2020-06-09T07:42:12Z",
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:12Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "36mwqk77p2znfjnwgqci69buc",
"resource": "payment",
"status": "authorized",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-16T14:59:59Z",
"payment_details": {
"type": "bank_transfer",
"email": "test@example.com",
"order_id": "K6685338853",
"bank_name": "三井住友銀行",
"account_branch_name": "ひなぎく",
"account_number": "85",
"account_type": "普通預金",
"account_name": "株式会社DEGICA(カブシキガイシャ デジカ)",
"instructions_url": "https://komoju.com/ja/instructions/36mwqk77p2znfjnwgqci69buc"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:12Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "c2dkawkf0wzg4zl0908n4vuc4",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "culture_voucher",
"email": null,
"culture_id": "11111111"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "KRW",
"description": null,
"captured_at": "2020-06-09T07:42:13Z",
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:13Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "dofcje84ldv0j94wa06ldw71c",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-16T14:59:59Z",
"payment_details": {
"type": "credit_card",
"email": "test@example.com",
"brand": "visa",
"last_four_digits": "1111",
"month": 1,
"year": 2025
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": "2020-06-09T07:42:14Z",
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:14Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "b2kjhznvxhu902067v2iu7rjg",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": null,
"payment_details": {
"type": "web_money",
"email": "test@example.com",
"short_amount": 0,
"prepaid_cards": [
{
"last_four_digits": "1111",
"points": 1100
}
]
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": "2020-06-09T07:42:15Z",
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:15Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
{
"id": "2xo2org21jm66y4o51b18nirt",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-16T07:42:16Z",
"payment_details": {
"type": "nanaco",
"email": "test@example.com",
"short_amount": 0,
"prepaid_cards": [
{
"last_four_digits": "1111",
"points": 1100
}
]
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": "2020-06-09T07:42:16Z",
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:16Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
Params
Param name | Description |
---|---|
amount required |
The amount to be charged before tax. Must be equal or greater than 0. Use a ‘.’ as a decimal separator, and no thousands separator. |
currency required |
3 letter ISO currency code used to pay. |
payment_details required* |
A hash or token describing the payment method used to make the payment. This or |
customer required* |
The ID of an existing customer in which to provide payment details for the payment. This or |
capture optional |
If false, the payment will be authorized but not be captured. This option is ignored if a payment type is not |
description optional |
Plaintext description for annotating a resource. |
tax optional |
The amount of tax to be charged. Defaults to the highest consumption tax rate in Japan if omitted or set to 'auto'. Use a ‘.’ as a decimal separator, and no thousands separator. If the tax is more precise than the currency allows, it will be rounded using a round half up algorithm. |
external_order_num optional |
A unique ID from your application used to track this payment. |
locale optional |
Sets language of instruction page for supported payment methods. Valid options are 'en', 'ja', and 'ko'. |
metadata optional |
A set of key-value pairs. |
PATCH /api/v1/payments/:id
Update Payments
Updates a payment. Only a payment's description
and metadata
can be changed.
Examples
- cURL
- Node.js
- Ruby
curl -X PATCH https://komoju.com/api/v1/payments/ef4ptr6nxrb1kxcw5opvp0uk9 \
-u sk_123456: \
-d "description=updated description" \
-d "metadata[updated]=metadata"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var patch_data = querystring.stringify({
'description': 'updated description',
'metadata[updated]': 'metadata'
});
var patch_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments/ef4ptr6nxrb1kxcw5opvp0uk9',
method: 'PATCH',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(patch_data)
}
};
var patch_req = https.request(patch_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
patch_req.write(patch_data);
patch_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/ef4ptr6nxrb1kxcw5opvp0uk9')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
description: "updated description",
metadata: {
updated: "metadata"
}
}
res = https.patch(
uri.path,
body.to_json,
headers
)
puts res.body
{
"id": "ef4ptr6nxrb1kxcw5opvp0uk9",
"resource": "payment",
"status": "pending",
"amount": 300,
"tax": 30,
"customer": null,
"payment_deadline": "2020-06-12T14:59:59Z",
"payment_details": {
"type": "konbini",
"email": "gordon@example.com",
"store": "family-mart",
"confirmation_code": "1111",
"receipt": "12345",
"instructions_url": "https://komoju.com/en/instructions/ef4ptr6nxrb1kxcw5opvp0uk9"
},
"payment_method_fee": 0,
"total": 330,
"currency": "JPY",
"description": "updated description",
"captured_at": null,
"external_order_num": "ORDER17",
"metadata": {
"updated": "metadata"
},
"created_at": "2020-06-09T07:42:23Z",
"amount_refunded": 0,
"locale": "en",
"refunds": [
],
"refund_requests": [
]
}
Params
Param name | Description |
---|---|
description optional |
Plaintext description for annotating a resource. |
metadata optional |
A set of key-value pairs. |
POST /api/v1/payments/:id/capture
Capture Payments
Captures a payment. Only works on payments with a payment_type
of "credit_card"
.
Examples
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments/an707r5zejhfzp9y58ctqn2um/capture \
-u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments/an707r5zejhfzp9y58ctqn2um/capture',
method: 'POST',
headers: {
'Authorization': auth
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/an707r5zejhfzp9y58ctqn2um/capture')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
res = https.post(uri.path, '{}', headers)
puts res.body
{
"id": "an707r5zejhfzp9y58ctqn2um",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-24T14:59:59Z",
"payment_details": {
"type": "credit_card",
"email": "test@example.com",
"brand": "visa",
"last_four_digits": "1111",
"month": 1,
"year": 2025
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": "2020-06-09T07:42:04Z",
"external_order_num": "123",
"metadata": {
"foobar": "hoge"
},
"created_at": "2020-06-09T07:42:03Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}
POST /api/v1/payments/:id/refund
Refund Payments
Refunds an arbitrary amount of money from an existing payment. If no amount
is specified, the whole payment is refunded. When the payment has been fully refunded KOMOJU will send payment.refunded
webhook.
For cash-based payment methods, Japanese customers must be redirected to redirect_url
on the refund object to complete their refund. Upon navigating to redirect_url
customers can select a convenience store where they can receive a receipt code for a cash refund. KOMOJU will send payment.refunded
webhook once the customer has received their refund.
Examples
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments/b63kr222rtkvn3z6hhw7i4j3x/refund \
-u sk_123456: \
-d "amount=500"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'amount': '500'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments/b63kr222rtkvn3z6hhw7i4j3x/refund',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/b63kr222rtkvn3z6hhw7i4j3x/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
amount: "500"
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
{
"id": "b63kr222rtkvn3z6hhw7i4j3x",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-16T14:59:59Z",
"payment_details": {
"type": "credit_card",
"email": "test@example.com",
"brand": "visa",
"last_four_digits": "1111",
"month": 1,
"year": 2025
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": "2020-06-09T07:42:20Z",
"external_order_num": null,
"metadata": {
},
"created_at": "2020-06-09T07:42:19Z",
"amount_refunded": 500,
"locale": "ja",
"refunds": [
{
"id": "3iytpjriy703rjjd50jco87nm",
"resource": "refund",
"status": "completed",
"redirect_url": null,
"amount": 500,
"currency": "JPY",
"payment": "b63kr222rtkvn3z6hhw7i4j3x",
"description": null,
"created_at": "2020-06-09T07:42:20Z",
"chargeback": false
}
],
"refund_requests": [
]
}
Params
Param name | Description |
---|---|
amount optional |
The amount to be charged before tax. Must be equal or greater than 0. Use a ‘.’ as a decimal separator, and no thousands separator. |
description optional |
Plaintext description for annotating a resource. |
name optional |
The name of the customer. |
email optional |
The e-mail address of the customer. |
phone optional |
The phone number of the customer. |
POST /api/v1/payments/:id/refund_request
Refund Request Payments
Refund requests can be used for payment methods that do not support refunds e.g. cash-based payment methods like Convenience Store, Bank Transfer, etc.
This provides an alternative refund option for cash based payments through a bank transfer.
Examples
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request \
-u sk_123456: \
-d "account_number=12345678" \
-d "account_type=normal" \
-d "amount=1000" \
-d "bank_name=KOMOJU BANK" \
-d "branch_number=1234" \
-d "customer_name=John Doe" \
-d "include_payment_method_fee=true"
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
'account_number': '12345678',
'account_type': 'normal',
'amount': '1000',
'bank_name': 'KOMOJU BANK',
'branch_number': '1234',
'customer_name': 'John Doe',
'include_payment_method_fee': 'true'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request',
method: 'POST',
headers: {
'Authorization': auth,
'Content-Length': Buffer.byteLength(post_data)
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
body = {
account_number: "12345678",
account_type: "normal",
amount: "1000",
bank_name: "KOMOJU BANK",
branch_number: "1234",
customer_name: "John Doe",
include_payment_method_fee: "true"
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
{
"id": "7czbdbavjdbl3jjkrd7c65wi5",
"resource": "payment",
"status": "captured",
"amount": 1000,
"tax": 0,
"customer": null,
"payment_deadline": "2020-06-12T14:59:59Z",
"payment_details": {
"type": "konbini",
"email": "gordon@example.com",
"store": "circle-k",
"confirmation_code": null,
"receipt": "12345",
"instructions_url": "https://komoju.com/en/instructions/7czbdbavjdbl3jjkrd7c65wi5"
},
"payment_method_fee": 0,
"total": 1000,
"currency": "JPY",
"description": null,
"captured_at": "2020-06-07T14:59:59Z",
"external_order_num": "ORDER4",
"metadata": {
},
"created_at": "2020-06-09T07:41:58Z",
"amount_refunded": 0,
"locale": "en",
"refunds": [
],
"refund_requests": [
{
"id": "4f1jtn1rafgrrg9t23waobawp",
"payment": "7czbdbavjdbl3jjkrd7c65wi5",
"customer_name": "John Doe",
"bank_name": "KOMOJU BANK",
"branch_number": "1234",
"account_number": "12345678",
"status": "pending",
"created_at": "2020-06-09T07:41:58Z"
}
]
}
Params
Param name | Description |
---|---|
amount required |
The amount to be charged before tax. Must be equal or greater than 0. Use a ‘.’ as a decimal separator, and no thousands separator. |
customer_name required |
The name of the customer. |
bank_name required |
The name of the bank. |
branch_number required |
The bank branch number. |
account_type required |
Bank account type |
account_number required |
Bank account number. |
include_payment_method_fee required |
Whether or not to refund the payment's paymentmethodfee (also known as customer fee or kiosk fee). This fee is charged to customers for some payment methods e.g. Konbini, PayEasy, Bank Transfer, etc. Please note that when true the paymentmethodfee will be charged to your account. |
description optional |
Plaintext description for annotating a resource. |
POST /api/v1/payments/:id/cancel
Cancel Payments
Cancels a payment. The given payment must have a state
of pending
or authorized
in order to be canceled.
Examples
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/payments/551p58bphju7vj657gcbc9iq8/cancel \
-u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/payments/551p58bphju7vj657gcbc9iq8/cancel',
method: 'POST',
headers: {
'Authorization': auth
}
};
var post_req = https.request(post_options, function(res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log(chunk);
});
});
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/551p58bphju7vj657gcbc9iq8/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Basic #{auth}"
}
res = https.post(uri.path, '{}', headers)
puts res.body
{
"id": "551p58bphju7vj657gcbc9iq8",
"resource": "payment",
"status": "cancelled",
"amount": 1000,
"tax": 100,
"customer": null,
"payment_deadline": "2020-06-12T14:59:59Z",
"payment_details": {
"type": "konbini",
"email": "test@example.com",
"store": "lawson",
"confirmation_code": "ek9e2",
"receipt": "a8y03rvi8k",
"instructions_url": "https://komoju.com/ja/instructions/551p58bphju7vj657gcbc9iq8"
},
"payment_method_fee": 0,
"total": 1100,
"currency": "JPY",
"description": null,
"captured_at": null,
"external_order_num": null,
"metadata": {
},
"created_at": "2020-06-09T07:42:18Z",
"amount_refunded": 0,
"locale": "ja",
"refunds": [
],
"refund_requests": [
]
}