Tokens

>>>

POST /api/v1/tokens
Create Tokens

Creates a token with the given payment_details.

It is recommended to have a client application make this request directly so that sensitive payment information (e.g. credit card number) doesn't hit your server. Receiving credit card numbers requires your business to be PCI-DSS compliant. Once you turn your customer's details into a token, the token string can safely be sent to your server and used as payment_details to a future KOMOJU API request.

A currency may be optionally specified. When currency is provided, KOMOJU will ensure that the payment made using the new token is in the same currency.

Tokens can't be indexed or deleted via API. Tokens are instead deleted on use, and expire when unused.

サンプル

  • クレジットカード
  • コンビニ
  • 銀行振込
  • PayEasy
  • WebMoney
  • ビットキャッシュ
  • NET CASH
  • キャリア決済
  • LINE Pay
  • メルペイ
  • Paidy

  • 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[billing_address_city]=武蔵野市" \
  -d "payment_details[billing_address_line1]=いちご吉祥寺ビル 4F" \
  -d "payment_details[billing_address_line2]=吉祥寺本町 2 丁目 5 番 10 号" \
  -d "payment_details[billing_address_state]=東京都" \
  -d "payment_details[billing_address_zip]=1800004" \
  -d "payment_details[customer_age]=25" \
  -d "payment_details[customer_last_order_amount]=20000" \
  -d "payment_details[customer_last_order_at]=10" \
  -d "payment_details[customer_lifetime_value]=250000" \
  -d "payment_details[customer_name]=山田太郎" \
  -d "payment_details[customer_name_kana]=マダ タロウ" \
  -d "payment_details[customer_order_count]=2" \
  -d "payment_details[email]=test@example.com" \
  -d "payment_details[type]=paidy" 
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[billing_address_city]': '武蔵野市',
  'payment_details[billing_address_line1]': 'いちご吉祥寺ビル 4F',
  'payment_details[billing_address_line2]': '吉祥寺本町 2 丁目 5 番 10 号',
  'payment_details[billing_address_state]': '東京都',
  'payment_details[billing_address_zip]': '1800004',
  'payment_details[customer_age]': '25',
  'payment_details[customer_last_order_amount]': '20000',
  'payment_details[customer_last_order_at]': '10',
  'payment_details[customer_lifetime_value]': '250000',
  'payment_details[customer_name]': '山田太郎',
  'payment_details[customer_name_kana]': 'マダ タロウ',
  'payment_details[customer_order_count]': '2',
  'payment_details[email]': 'test@example.com',
  'payment_details[type]': 'paidy'
});

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: {
    billing_address_city: "武蔵野市",
    billing_address_line1: "いちご吉祥寺ビル 4F",
    billing_address_line2: "吉祥寺本町 2 丁目 5 番 10 号",
    billing_address_state: "東京都",
    billing_address_zip: "1800004",
    customer_age: "25",
    customer_last_order_amount: "20000",
    customer_last_order_at: "10",
    customer_lifetime_value: "250000",
    customer_name: "山田太郎",
    customer_name_kana: "マダ タロウ",
    customer_order_count: "2",
    email: "test@example.com",
    type: "paidy"
  }
}

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_0598h29mv8gy5gbam53nx7kx4",
  "resource": "token",
  "created_at": "2020-06-09T07:41:53Z",
  "payment_details": {
    "type": "paidy",
    "email": "test@example.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
必須

A hash or token describing the payment method used to make the payment. This or customer must be present when creating a payment.

currency
任意

3 letter ISO currency code used to pay.