概要
KOMOJU API は決済のための RESTful HTTP インターフェースを提供いたします。各リソース毎の詳細な説明は、 リソースページ でご確認ください。
現在 KOMOJU API は次の 8 つの決済方法に対応しております:クレジットカード、 銀行振込、 LINE Pay、 コンビニ決済、 PayEasy、BitCash、NET CASH、および WebMoney
KOMOJU API へのリクエストは HTTPS を使う必要があり、エンドポイントは https://komoju.com/api/v1 である必要があります。API から返ってきたデータはすべて JSON フォーマットになっています。リクエスト作成時の文字コードは UTF-8 を使用してください。
認証
KOMOJU は、秘密 API キーおよび公開 API キーをクライアントに提供しますので、そのキーで API へのリクエストを作成することができます。テスト環境用および本番環境用に 2 本のキーをご用意いたします。このキーは、お使いのクライアントアカウント設定ページでご確認いただけます。
KOMOJU API は、 HTTP ベーシック認証 を使用して API リクエストを認証していますので、お使いの API キーをユーザー名として渡す必要があります。その際パスワードは要りません。例えば、以下のようなコードとなります:
curl -u secret_key: "https://komoju.com/api/v1/payments"
レスポンス & エラー
HTTP ステータスコード
KOMOJU API は HTTP ステータスコードを使用してリクエストの成功または失敗を表現します。次の表は、KOMOJU API が返すステータスコードの一覧です。
ステータスコード | 説明 |
---|---|
200 OK |
サーバーがリクエストを正常に処理しました |
202 Accepted |
リソースは正常に作成されましたが、プロセスは完了していません |
204 No Content |
サーバーはリクエストを正常に処理しましたが、返す情報がありません |
401 Not Authorized |
API キーが無効、または見つかりません |
403 Forbidden |
API キーにはリソースにアクセスする権限がありません |
404 Not Found |
リソースが見つかりません |
422 Unprocessible Entity |
パラメータが不正または不足しています |
500 Internal Server Error |
KOMOJU サーバー内でなんらかの問題が発生しました |
502 Bad Gateway |
上位の決済プロセッサがエラーを返してきました |
503 Service Unavailable |
サーバーメンテナンス中 |
エラー
エラーは JSON フォーマットで返されます。code
および message
パラメータは各エラーメッセージ毎に返されます。
属性
パラメータ | タイプ | 詳細 |
---|---|---|
message |
文字列 | エラーメッセージの内容が記載された文字列 |
code |
文字列 | エラーコード |
param |
文字列 | エラーの発生したパラメータ |
JSON Object
{
"error": {
"message": "A required parameter (amount) is missing",
"code": "missing_parameter",
"param": "amount"
}
}
エラーコード
エラーコード | HTTP ステータスコード | メッセージ例 |
---|---|---|
bad_request |
400 |
不正な要求です。サーバーは要求を処理できません。 |
unauthorized |
401 |
ユーザーの認証に失敗しました。 |
not_found |
404 |
リソースが見つかりませんでした。 |
internal_server_error |
500 |
内部エラーが発生しました。 |
forbidden |
403 |
リソースへのアクセスは許可されていません。 |
unprocessable_entity |
422 |
指定されたパラメータに何らかの不整合があるため処理できません。 |
bad_gateway |
502 |
上位ゲートウェイがエラーを返却しました。 |
gateway_timeout |
504 |
支払いの処理中にゲートウェイタイムアウトが発生しました。請求は行われていません。支払いを再試行してください。 |
service_unavailable |
503 |
メンテナンス中です。しばらくしてからもう一度実行してください。 |
request_failed |
402 |
リクエストが失敗しました。 |
invalid_payment_type |
422 |
支払い方法が無効です。 %{provided} は %{allowed} の一つではありません。 |
invalid_token |
422 |
トークンの値が不正です。 |
invalid_currency |
422 |
指定された通貨が不正です。 |
not_refundable |
422 |
返金できない支払いです。 |
not_capturable |
422 |
入金できない決済です。 |
not_cancellable |
422 |
キャンセルできない支払いです。 |
not_chargebackable |
422 |
translation missing: ja.errors.unprocessable_entity.not_chargebackable |
fraudulent |
422 |
不正行為の疑いのある支払いです。 |
invalid_parameter |
422 |
%{param} の値が不正です。 |
missing_parameter |
422 |
必須パラメータ (%{param}) が指定されていません。 |
insufficient_funds |
502 |
残高不足です。 |
used_number |
502 |
使用済みの番号です。 |
card_declined |
502 |
カードは拒否されました。 |
invalid_password |
502 |
パスワードが不正です。 |
bad_verification_value |
502 |
セキュリティーコードが不正です。 |
exceeds_limit |
502 |
決済可能額を超過しました。 |
card_expired |
502 |
カードは期限切れです。 |
invalid_number |
502 |
指定された番号が不正です。 |
invalid_account |
502 |
アカウントが不正です。 |
restricted_account |
502 |
translation missing: ja.errors.bad_gateway.restricted_account |
other_error |
502 |
translation missing: ja.errors.bad_gateway.other_error |
invalid_user_key |
502 |
translation missing: ja.errors.bad_gateway.invalid_user_key |
other_invalid |
502 |
Invalid card |
ページネーション
10 以上のアイテムを含むリクエストはデフォルトでページ割りされます。KOMOJU では page
および per_page
パラメータを使ってページ割りを行います。per_page
パラメータの最大値は 100 です。
curl -u komoju-mart: "https://komoju.com/api/v1/payments?page=2&per_page=100"
ペイメント
ペイメントリソース
フィールド | 詳細 |
---|---|
id |
文字列 |
resource |
文字列 payment の値 |
status |
文字列 ペイメント状況 |
amount |
整数 課税前の合計金額。0 以上である必要があります。小数点には '.' を使用し、千の単位を表すカンマは使用しません |
tax |
整数 課税する税金の金額、あるいは現在日本で定められている消費税を使用する時は ‘auto’ を設定します。小数点には '.' を使用し、千の単位を表すカンマは使用しません。税金が通貨よりもさらに正確で細かい場合は、四捨五入のアルゴリズムを使用して調整します |
customer |
文字列 顧客ID |
payment_deadline |
タイムスタンプ ペイメントの有効期限が切れる日時です。これは次のような ISO 8601 フォーマットのタイムスタンプで表します:YYYY-MM-DDTHH:MM:SSZ |
payment_details |
ハッシュまたはトークン お支払方法を表します |
payment_method_fee |
整数 特定のお支払方法に追加される手数料など |
total |
整数 お支払合計金額。これは、お支払金額 + 税 + お支払方法による手数料 |
currency |
文字列 決済が行われた 3 文字の ISO 通貨コード |
description |
文字列 お支払方法の詳細 (オプションが有効な場合はメールの文面に使用されます) |
captured_at |
タイムスタンプ ペイメントが保存された日時を表す ISO 8601 フォーマットのタイムスタンプ |
external_order_num |
文字列 決済におけるクライアントのユニーク ID です決済ひとつひとつを特定できるように、すべてのコールバックに必ず含まれます |
metadata |
ハッシュ key-value のペアのセット |
created_at |
タイムスタンプ ペイメントが作成された日時を表す ISO 8601 フォーマットのタイムスタンプ |
amount_refunded |
整数 返金済み金額 |
locale |
文字列 お支払いメールや支払方法の説明などの言語 |
refunds |
ハッシュ 返金情報 |
refund_requests |
ハッシュ 返金申込み情報 |
ペイメントの詳細
複数の支払い方法を抽象化し、統一されたAPIを提供するために、KOMOJU API はリクエストとレスポンスにpayment_details
ハッシュを使用しています。
payment_details
ハッシュは、credit_card
、konbini
、bank_transfer
、pay_easy
、web_money
、bit_cash
、net_cash
、japan_mobile
、linepay
、merpay
、paypay
のうちいずれかの値をとる type
パラメータを含む必要があります。
サンプル
- クレジットカード
- コンビニ
- 銀行振込
- PayEasy
- WebMoney
- ビットキャッシュ
- NET CASH
- キャリア決済
- LINE Pay
- メルペイ
- 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": [
]
}
クレジットカード
ペイメントの詳細
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
type |
文字列 | credit_card の値 |
email |
文字列 | ペイメント受領時に送信するメールアドレス。オプションです。 |
number |
数値 | クレジットカード番号 |
month |
数値 | 有効期限月 |
year |
数値 | 有効期限年 |
verification_value |
数値 | CCV セキュリティ番号 |
name |
文字列 | 顧客の名前 |
不正利用
クレジットカード不正利用防止のため、リクエストにfraud_details
ハッシュを使ってカスタマー情報を入れることができます。 customer_ip
以外のパラメータは必須ではありませんが、
情報が多ければ多いほど不正利用予防プロセスの成功率が上がります。
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
customer_ip |
string | カスタマーのIPアドレス. ipv4とipv6に対応します。 |
customer_email |
string | カスタマーのメイルアドレス。 |
customer_id |
string | カスタマーID |
browser_language |
string | カスタマーが利用しているブラウザの言語。 |
browser_user_agent |
string | カスタマーが利用しているブラウザの情報。 |
レスポンスパラメータ | 詳細 |
---|---|
type |
credit_card の値 |
email |
ペイメント受領時に送信するメールアドレス |
brand |
visa 、mastercard などクレジットカード会社のブランド |
last_four_digits |
クレジットカード番号の末尾 4 桁 |
month |
クレジットカードの有効期限月 |
year |
クレジットカードの有効期限年 |
テストで使用するカード
注: ここで紹介しているカード番号は KOMOJU の Test モードでのみ利用可能です。Live モードでは利用できません。Live モードで購入の動作確認を行いたい場合は、お持ちの本物のクレジットカードをお使いください。
カード番号 | タイプ |
---|---|
3530111333300000 | JCB |
378282246310005 | American Express |
4111111111111111 | Visa |
5555555555554444 | MasterCard |
30569309025904 | Diners Club |
4123111111111000 | 残高不足 |
4123111111111018 | ご利用限度額を超過 |
4123111111111034 | セキュリティ番号が不正 |
4123111111111042 | 期限切れのカード |
4123111111111059 | クレジットカード使用不可 |
4123111111111067 | 無効なカード |
銀行振込
ペイメントが作成されると、bank_number
を返しますので、ユーザーは振込名義人に order_id
パラメータを入力して送金する必要があります。ペイメントを受領すると、 webhook を送信して支払い状況をお知らせいたします。
制限
- 銀行振込は日本で定められている営業時間内でのみ記録・保管されます。
- ペイメントは 14 日が経過すると無効となります。(有効期限が切れると webhook を送信してお知らせします。)
ペイメントの詳細
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
type |
文字列 | bank_transfer の値 |
email |
文字列 | ペイメント受領時にレシートおよびお支払方法を送信するメールアドレス。 |
given_name |
文字列 | 顧客の名前 |
family_name |
文字列 | 顧客の苗字 |
given_name_kana |
文字列 | 顧客のカタカナ名 |
family_name_kana |
文字列 | 顧客のカタカナ名 (苗字) |
phone |
文字列 | 顧客の電話番号 |
expiry_days |
整数 | ペイメントの有効期間の日数(最大 59 日)。オプションです。 |
レスポンスパラメータ | 詳細 |
---|---|
type |
bank_transfer の値 |
email |
ペイメント受領時にレシートおよびお支払方法を送信するメールアドレス |
order_id |
顧客が振込名義に含める振込番号 |
bank_name |
送金する銀行名 |
account_branch_name |
支店名 |
account_number |
送金する銀行口座番号 |
account_type |
口座種別 |
account_name |
口座名義 |
instructions_url |
お支払方法ページへの URL |
LINE Pay
ペイメントの詳細
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
type |
文字列 | linepay の値 |
email |
文字列 | ペイメント受領時にレシートおよびお支払方法を送信するメールアドレス。 |
レスポンスパラメータ | 詳細 |
---|---|
type |
linepay の値 |
email |
ペイメント受領時に送信するメールアドレス |
redirect_url |
ユーザーが決済を完了するためにリダイレクトされるURL |
コンビニ決済
制限
- 支払い合計金額は、最高 300,000 円まで。この合計金額は、支払い金額 + 税 + 手数料すべてを合計した額です。
- ペイメントは 3 日が経過すると無効となります。(有効期限が切れると webhook を送信 してお知らせします。)
コンビニ店舗種別
コンビニ決済を作成する時には、payment_details
ハッシュにある store
パラメータを渡す必要があります。この値は、顧客が実際に支払を行うコンビニの店舗種別です。
英語表記 | 日本語表記 | 店舗種別 | ロゴ |
---|---|---|---|
Daily Yamazaki | デイリーヤマザキ | daily-yamazaki |
|
Family Mart | ファミリーマート | family-mart |
|
Lawson | ローソン | lawson |
|
Ministop | ミニストップ | ministop |
|
Seicomart | セイコーマート | seicomart |
|
7-Eleven | セブンイレブン | seven-eleven |
ペイメントの詳細
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
type |
文字列 | konbini の値 |
email |
文字列 | ペイメント受領時にレシートおよび支払い方法を送信するメールアドレス。 |
store |
文字列 | 店舗種別。店舗種別は上記のコンビニ店舗種別をご覧ください。 |
phone |
文字列 | 顧客の電話番号。オプションです。 |
expiry_days |
整数 | ペイメントの有効期間の日数(最大 59 日)。オプションです。 |
レスポンスパラメータ | 詳細 |
---|---|
type |
konbini の値 |
email |
ペイメント受領時にレシートおよびお支払方法を送信するメールアドレス |
store |
lawson 、family_mart などの店舗種別 |
confirmation_code |
コンビニ支払時に必要となる番号 |
receipt |
コンビニ支払時に必要となる番号 |
instructions_url |
お支払方法ページへの URL |
WebMoney
WebMoney は日本で人気のプリペイドカードの1つです。複数枚のプリペイドカードを利用して支払いをすることができます。
ユーザーが使用した WebMoney プリペイドカードが残高不足だった場合、payment_details
ハッシュ内の prepaid_number
を更新するリクエストを行うことで決済を完了することができます。
複数のプリペイドカードを利用した支払い
プリペイドカードが残高不足だった場合 KOMOJU は 202 Accepted
ステータスを返却し、pending
ステータスのペイメントが作成されます。そのペイメントはPayment更新APIを使用し追加のプリペイドカードを追加することができます。例) payment_details[prepaid_number]=XXXXXXXXXXXX
ペイメントの詳細
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
type |
文字列 | web_money の値 |
email |
文字列 | ペイメント受領時に送信するメールアドレス。オプションです。 |
prepaid_number |
文字列 | 16 桁の WebMoney プリペイドカード番号 |
レスポンスパラメータ | 詳細 |
---|---|
type |
web_money の値 |
email |
ペイメント受領時に送信するメールアドレス |
short_amount |
お支払金額に不足している金額 |
prepaid_cards |
使用されたプリペイドカードの一覧 |
テストで使用するカード
カード番号 | タイプ |
---|---|
1111111111111111 | 2,000円 がチャージされた WebMoney プリペイドカード |
e111111111111112 | 不正なプリペイドカードナンバー |
e111111111111113 | 使用済みプリペイドカード |
e111111111111114 | 不明なエラー |
NET CASH
NET CASH は日本で提供されているプリペイドカードの1つです。 NTT カードソリューションが提供しています。
ペイメントの詳細
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
type |
文字列 | net_cash の値 |
email |
文字列 | ペイメント受領時に送信するメールアドレス。オプションです。 |
prepaid_number |
文字列 | 16 桁の NET CASH プリペイドカード番号 |
レスポンスパラメータ | 詳細 |
---|---|
type |
net_cash の値 |
email |
ペイメント受領時に送信するメールアドレス |
short_amount |
お支払金額に不足している金額 |
prepaid_cards |
使用されたプリペイドカードの一覧 |
テストで使用するカード
カード番号 | タイプ |
---|---|
1111111111111111 | 2,000円 がチャージされた NET CASH プリペイドカード |
BitCash
ビットキャッシュはプリペイドカードの1つです。 KOMOJU では WebMoney とほぼ同じ API を提供していますが、ビットキャッシュの場合一度に複数枚のプリペイドカードを利用できません。 残高が不足している場合ユーザーはビットキャッシュ残高引継ページを利用する必要があります。
ペイメントの詳細
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
type |
文字列 | bit_cash の値 |
email |
文字列 | ペイメント受領時に送信するメールアドレス。オプションです。 |
prepaid_number |
文字列 | 16 桁のビットキャッシュプリペイドカード番号 |
レスポンスパラメータ | 詳細 |
---|---|
type |
bit_cash の値 |
email |
ペイメント受領時に送信するメールアドレス |
テストで使用するカード
カード番号 | タイプ |
---|---|
1111111111111111 | 2,000円 がチャージされたビットキャッシュプリペイドカード |
e111111111111112 | 不正なプリペイドカードナンバー |
e111111111111113 | 不明なエラー |
PayEasy
顧客は PayEasy を利用してオンラインバンキングから支払うことができます。
PayEasy は後払い形式の支払方法であり、ペイメントが作成されたあと、一定の時間が経過してからペイメントが記録されます。KOMOJU は支払いが実行されると webhook を送信 してお知らせします。
制限
- PayEasy 支払い合計金額は、最高 999,999 円 です。
- ペイメントは 10 日が経過すると無効となります。(有効期限が切れると webhook を送信 してお知らせします。)
ペイメントの詳細
リクエストパラメータ | タイプ | 詳細 |
---|---|---|
type |
文字列 | pay_easy の値 |
email |
文字列 | ペイメント受領時にレシートおよび支払い方法を送信するメールアドレス。 |
given_name |
文字列 | 顧客の名前 |
family_name |
文字列 | 顧客の苗字 |
given_name_kana |
文字列 | 顧客のカタカナ名 |
family_name_kana |
文字列 | 顧客のカタカナ名 (苗字) |
phone |
文字列 | 顧客の電話番号 |
レスポンスパラメータ | 詳細 |
---|---|
type |
pay_easy の値 |
email |
ペイメント受領時にレシートおよびお支払方法を送信するメールアドレス |
bank_id |
PayEasy支払い時に必要となるお客様番号 |
customer_id |
PayEasy支払い時に必要となるお客様番号 |
confirmation_id |
PayEasy支払い時に必要となるお客様番号 |
instructions_url |
支払方法ページへの URL |
トークン
セキュリティ上の理由から、重要な顧客情報をクライアントは関与せずに KOMOJU に扱ってもらう必要がある場合があります。これを行うために、顧客の決済情報を収集し、それをトークンに変換します。このトークンを使うことで、顧客の情報があなたのサーバーを通過することなく、決済を行えるようになります。
KOMOJU はTokens APIを公開しています。クライアントアプリケーションは公開キーを使ってこの API を直接実行することでトークンを作成できます。
注: トークンは1度使用するか、30日経過すると使用できなくなります。決済情報を永続的に保持したい場合は、永久保存のセクションをご確認ください。
トークンの作成
トークンは KOMOJU MultiPay のようなクライアント側のライブラリを使って作成できます。また、Tokens APIを使って、直接作成することもできます。
- クレジットカード
- コンビニ
- 銀行振込
- PayEasy
- WebMoney
- ビットキャッシュ
- NET CASH
- キャリア決済
- LINE Pay
- メルペイ
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-d "currency=KRW" \
-d "payment_details[email]=foo@bar.com" \
-d "payment_details[type]=mobile"
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({
'currency': 'KRW',
'payment_details[email]': 'foo@bar.com',
'payment_details[type]': 'mobile'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
currency: "KRW",
payment_details: {
email: "foo@bar.com",
type: "mobile"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-d "payment_details[email]=foo@bar.com" \
-d "payment_details[type]=paysafe_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({
'payment_details[email]': 'foo@bar.com',
'payment_details[type]': 'paysafe_cash'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
email: "foo@bar.com",
type: "paysafe_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/tokens \
-u sk_123456: \
-d "payment_details[type]=dospara" \
-d "payment_details[user_no]=12345" \
-d "payment_details[user_password]=password"
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({
'payment_details[type]': 'dospara',
'payment_details[user_no]': '12345',
'payment_details[user_password]': 'password'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
type: "dospara",
user_no: "12345",
user_password: "password"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-d "payment_details[brand]=au" \
-d "payment_details[email]=test@example.com" \
-d "payment_details[type]=japan_mobile"
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({
'payment_details[brand]': 'au',
'payment_details[email]': 'test@example.com',
'payment_details[type]': 'japan_mobile'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
brand: "au",
email: "test@example.com",
type: "japan_mobile"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-d "payment_details[email]=foo@bar.com" \
-d "payment_details[return_url]=http://example.com" \
-d "payment_details[type]=zgold"
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({
'payment_details[email]': 'foo@bar.com',
'payment_details[return_url]': 'http://example.com',
'payment_details[type]': 'zgold'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
email: "foo@bar.com",
return_url: "http://example.com",
type: "zgold"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
payment_details: {
email: "test@example.com",
prepaid_number: "1111111111111111",
type: "nanaco"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-d "payment_details[email]=foo@bar.com" \
-d "payment_details[type]=paysafe_card"
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({
'payment_details[email]': 'foo@bar.com',
'payment_details[type]': 'paysafe_card'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
email: "foo@bar.com",
type: "paysafe_card"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-d "payment_details[email]=test@example.com" \
-d "payment_details[type]=merpay"
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({
'payment_details[email]': 'test@example.com',
'payment_details[type]': 'merpay'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
email: "test@example.com",
type: "merpay"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-d "payment_details[birthday]=111111" \
-d "payment_details[type]=toss"
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({
'payment_details[birthday]': '111111',
'payment_details[type]': 'toss'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
birthday: "111111",
type: "toss"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-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({
'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/tokens',
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/tokens')
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 = {
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/tokens \
-u sk_123456: \
-d "payment_details[email]=foo@bar.com" \
-d "payment_details[type]=cvs"
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({
'payment_details[email]': 'foo@bar.com',
'payment_details[type]': 'cvs'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
email: "foo@bar.com",
type: "cvs"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-d "payment_details[email]=test@example.com" \
-d "payment_details[prepaid_number]=1111111111111111" \
-d "payment_details[type]=steam_prepaid_card"
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({
'payment_details[email]': 'test@example.com',
'payment_details[prepaid_number]': '1111111111111111',
'payment_details[type]': 'steam_prepaid_card'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
email: "test@example.com",
prepaid_number: "1111111111111111",
type: "steam_prepaid_card"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-d "payment_details[email]=test@example.com" \
-d "payment_details[type]=linepay"
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({
'payment_details[email]': 'test@example.com',
'payment_details[type]': 'linepay'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
email: "test@example.com",
type: "linepay"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
- cURL
- Node.js
- Ruby
curl -X POST https://komoju.com/api/v1/tokens \
-u sk_123456: \
-d "payment_details[provider]=mega-shark" \
-d "payment_details[type]=nexus_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({
'payment_details[provider]': 'mega-shark',
'payment_details[type]': 'nexus_transfer'
});
var post_options = {
host: 'komoju.com',
port: '443',
path: '/api/v1/tokens',
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/tokens')
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 = {
payment_details: {
provider: "mega-shark",
type: "nexus_transfer"
}
}
res = https.post(
uri.path,
body.to_json,
headers
)
puts res.body
{
"id": "tok_5r33l5ghtndrpm4gys7amg3e7",
"resource": "token",
"created_at": "2020-06-09T07:41:53Z",
"payment_details": {
"type": "mobile",
"email": "foo@bar.com"
}
}
{
"id": "tok_d88v4ikpu9rovtcmawbvm4c3o",
"resource": "token",
"created_at": "2020-06-09T07:41:53Z",
"payment_details": {
"type": "konbini",
"store": "lawson",
"email": "test@example.com",
"phone": "090-1111-2222"
}
}
{
"id": "tok_eyqjai9x8ev74cyjm45h78b14",
"resource": "token",
"created_at": "2020-06-09T07:41:54Z",
"payment_details": {
"type": "pay_easy",
"given_name": "太郎",
"family_name": "山田",
"given_name_kana": "タロウ",
"family_name_kana": "ヤマダ",
"phone": "080-1111-2222",
"email": "test@example.com"
}
}
{
"id": "tok_ed0lhhez670qq99jotxf6o1bp",
"resource": "token",
"created_at": "2020-06-09T07:41:54Z",
"payment_details": {
"type": "bit_cash",
"email": "test@example.com"
}
}
{
"id": "tok_1zz7p1bvvyru4mjr6d51z5p9r",
"resource": "token",
"created_at": "2020-06-09T07:41:54Z",
"payment_details": {
"type": "net_cash",
"email": "test@example.com"
}
}
{
"id": "tok_9l670rtg9qn7m30e4e2ny8g8n",
"resource": "token",
"created_at": "2020-06-09T07:41:55Z",
"payment_details": {
"type": "bank_transfer",
"given_name": "太郎",
"family_name": "山田",
"given_name_kana": "タロウ",
"family_name_kana": "ヤマダ",
"phone": "080-1111-2222",
"email": "test@example.com"
}
}
{
"id": "tok_d7cwkj2of6as6h7vjc0wzqcah",
"resource": "token",
"created_at": "2020-06-09T07:41:55Z",
"payment_details": {
"type": "paysafe_cash",
"email": "foo@bar.com"
}
}
{
"id": "tok_ci48yrk7v9z390c7xlakdbm91",
"resource": "token",
"created_at": "2020-06-09T07:41:55Z",
"payment_details": {
"type": "dospara"
}
}
{
"id": "tok_djhm3kf4d9zsvs85cxh0suwoj",
"resource": "token",
"created_at": "2020-06-09T07:41:55Z",
"payment_details": {
"type": "japan_mobile",
"email": "test@example.com"
}
}
{
"id": "tok_2zfo99po34f8qjhdq826xhjec",
"resource": "token",
"created_at": "2020-06-09T07:41:55Z",
"payment_details": {
"type": "zgold",
"email": "foo@bar.com"
}
}
{
"id": "tok_4fgro2k86q3ppi30rb4edwmci",
"resource": "token",
"created_at": "2020-06-09T07:41:55Z",
"payment_details": {
"type": "web_money",
"email": "test@example.com"
}
}
{
"id": "tok_f45b5921cd21wc5anjk9t4uyd",
"resource": "token",
"created_at": "2020-06-09T07:41:56Z",
"payment_details": {
"type": "nanaco",
"email": "test@example.com"
}
}
{
"id": "tok_443oz6yruz1u92lxikbmcxi43",
"resource": "token",
"created_at": "2020-06-09T07:41:56Z",
"payment_details": {
"type": "paysafe_card",
"email": "foo@bar.com"
}
}
{
"id": "tok_2v5gzkkemvgpp58bymr51sreq",
"resource": "token",
"created_at": "2020-06-09T07:41:56Z",
"payment_details": {
"type": "merpay",
"email": "test@example.com"
}
}
{
"id": "tok_7ejp2dq8ei93j0ckbt4va82kb",
"resource": "token",
"created_at": "2020-06-09T07:41:56Z",
"payment_details": {
"type": "culture_voucher"
}
}
{
"id": "tok_6jtgptn0oyc0tfsos19o8wtn3",
"resource": "token",
"created_at": "2020-06-09T07:41:57Z",
"payment_details": {
"type": "toss"
}
}
{
"id": "tok_3swi993oq8w13ebxkz5yszsgv",
"resource": "token",
"created_at": "2020-06-09T07:41:57Z",
"payment_details": {
"type": "happy_money"
}
}
{
"id": "tok_donqjgn5pzgaeepqztogwdjdu",
"resource": "token",
"created_at": "2020-06-09T07:41:57Z",
"payment_details": {
"type": "credit_card",
"email": "test@example.com"
}
}
{
"id": "tok_632przb9tkxnlhfrqpk666wrr",
"resource": "token",
"created_at": "2020-06-09T07:41:57Z",
"payment_details": {
"type": "cvs",
"email": "foo@bar.com"
}
}
{
"id": "tok_dj2gfn1nrtd5apvglzrtz3zvk",
"resource": "token",
"created_at": "2020-06-09T07:41:57Z",
"payment_details": {
"type": "steam_prepaid_card",
"email": "test@example.com"
}
}
{
"id": "tok_0e2k3bbhjlcdg4q08bx2zns4r",
"resource": "token",
"created_at": "2020-06-09T07:41:58Z",
"payment_details": {
"type": "linepay",
"email": "test@example.com"
}
}
{
"id": "tok_6ivp5ygiqmyh136utf0mqaogg",
"resource": "token",
"created_at": "2020-06-09T07:41:58Z",
"payment_details": {
"type": "nexus_transfer"
}
}
トークンの利用
トークン作成後は payment_details
パラメーターを指定できる全ての API で利用できます。
以下のように決済作成時に payment_details
に JSON を指定する代わりに、トークンを指定できます。
curl -X POST https://komoju.com/api/v1/payments \
-u komoju-mart: \
-d "amount=1000" \
-d "currency=JPY" \
-d "payment_details=tok_d7d3b7ea7a6910f1076bf025ad3276dac9360c9b3307cb92d77c93b62556077f3ifq39h3wnrlgkttrjm8c6g2e"
永久保存
カスタマーリソースを作成すると、決済情報を永続的に保存できるようになります。カスタマー作成時に、payment_details
にトークンを指定できます。以下がその例になります。
curl -X POST https://komoju.com/api/v1/customers \
-u komoju-mart: \
-d "payment_details=tok_d7d3b7ea7a6910f1076bf025ad3276dac9360c9b3307cb92d77c93b62556077f3ifq39h3wnrlgkttrjm8c6g2e"
カスタマーリソースが作成済みの場合、以下のように Payments APIに customer
パラメーターを指定できます。そうすることで、保存済みの決済情報をもとに、決済を作成できます。
curl -X POST https://komoju.com/api/v1/payments \
-u komoju-mart: \
-d "amount=1000" \
-d "currency=JPY" \
-d "customer=3lz38k1d12sr5e4ggchnhxdgk" \
カスタマー情報の更新や削除についてはカスタマーリソースをご確認ください。