Overview

The KOMOJU v1 API provides a RESTful HTTP interface for creating payments. You can view a detailed breakdown of each resource in the resources page.

Currently the API supports eight payment methods: Credit Card, Bank Transfer, Konbini, PayEasy, BitCash, NET CASH and WebMoney.

Requests to the API must use HTTPS and use the endpoint https://komoju.com/api/v1. All data returned from the API is in JSON format. Character encoding used to make requests should use UTF-8.

Authentication

KOMOJU provides merchants with secret and publishable API keys for making requests to the API. You can view these keys in your merchant account settings page.

The API uses HTTP Basic Authentication to authenticate API requests. You will need to pass your API key as the username (password is not needed). For example

curl -u secret_key: "https://komoju.com/api/v1/payments"

Secret Key

Your secret key allows access to all API resources. You should store this key securely as it can be used to perform any action on your account.

Publishable Key

Publishable keys are used for creating tokens on the client-side part of your application. You can use this key to avoid processing sensitive payment details such as credit card numbers, prepaid numbers, etc.

Response & Errors

HTTP Status Codes

KOMOJU uses HTTP status codes to indicate the success or failure of a request. Below are the the following status codes your application should handle.

Code Description
200 OK The server successfully processed the request
202 Accepted The resource is successfully created but the process is not finished
204 No Content The server successfully processed the request, but is not returning any content.
401 Not Authorized API key provided was invalid or missing
403 Forbidden API key provided doesn’t have permission to access specified resource
404 Not Found Resource not found
422 Unprocessible Entity Missing or invalid parameters
500 Internal Server Error Something went wrong on our side
502 Bad Gateway Upstream payment processor returned an error
503 Service Unavailable Server maintenance

Errors

Errors are returned in JSON format. A code and message parameter are returned for each error message.

Attributes

Parameter Type Description
message string a string describing the error message
code string error code
param string parameter having the validation error

JSON Object

{
  "error": {
     "message": "A required parameter (amount) is missing",
     "code": "missing_parameter",
     "param": "amount"
  }
}

Error Codes

Error Code HTTP Status Code Example Message
bad_request 400 The server cannot or will not process the request due to something that is perceived to be a client error.
unauthorized 401 User authorization failed.
not_found 404 The requested resource could not be found but may be available again in the future.
internal_server_error 500 We're sorry but something went wrong. Please try your request again.
forbidden 403 You are not authorized to perform that action.
unprocessable_entity 422 The request was well-formed but was unable to be followed due to semantic errors.
bad_gateway 502 We are unable to process your request due to an invalid response from the upstream server.
gateway_timeout 504 When attempting to process your payment, we encountered a gateway timeout. Fear not, we have not processed the payment. Please try your payment again.
service_unavailable 503 The server is down for maintenance. Please try again later.
request_failed 402 The request failed
invalid_payment_type 422 Payment method was invalid. %{provided} is not one of %{allowed}.
invalid_token 422 The token you requested is invalid
invalid_currency 422 The currency you requested is invalid.
not_refundable 422 The payment you requested is not refundable.
not_capturable 422 The payment you requested is not capturable.
not_cancellable 422 This payment is noncancellable.
not_chargebackable 422 translation missing: en.errors.unprocessable_entity.not_chargebackable
fraudulent 422 This payment is fraudulent.
invalid_parameter 422 The value of %{param} is invalid
missing_parameter 422 A required parameter (%{param}) is missing
insufficient_funds 502 Insufficient funds
used_number 502 Used number
card_declined 502 Card declined
invalid_password 502 Invalid password
bad_verification_value 502 Bad verification value
exceeds_limit 502 Exceeds limit
card_expired 502 Card expired
invalid_number 502 The number you requested is invalid.
invalid_account 502 Invalid account
restricted_account 502 translation missing: en.errors.bad_gateway.restricted_account
other_error 502 translation missing: en.errors.bad_gateway.other_error
invalid_user_key 502 translation missing: en.errors.bad_gateway.invalid_user_key
other_invalid 502 Invalid card

Requests containing more that 10 items will be paginated by default. KOMOJU has a page and per_page parameter for use in pagination. Note per_page parameter has a maximum value of 100.

curl -u komoju-mart: "https://komoju.com/api/v1/payments?page=2&per_page=100"

Payments

Payment Resource

Field Description
id string
resource string Value of payment
status string The status of the payment
amount integer The amount to be charged before tax. Must be equal or greater than 0. Use a ‘.’ as a decimal separator, and no thousands separator
tax integer The amount of tax to be charged. Defaults to the highest consumption tax rate in Japan if omitted or set to 'auto'. Use a ‘.’ as a decimal separator, and no thousands separator. If the tax is more precise than the currency allows, it will be rounded using a round half up algorithm.
customer string The ID of the customer the payment was created with.
payment_deadline timestamp Time when the payment will expire. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
payment_details hash or token Describes the payment method used to make the payment
payment_method_fee integer An additional fee added to specific payment types
total integer The payment total, this is the amount + tax + paymentmethodfee
currency string 3 letter ISO currency code of the transaction
description string Description of the payment (used in e-mail receipts if enabled).
captured_at timestamp An ISO 8601 formatted timestamp of when a payment was captured
external_order_num string This is the merchant unique ID for the transaction. It will be included in all callbacks to identify the transaction.
metadata hash A set of key-value pairs
created_at timestamp An ISO 8601 formatted timestamp of when a payment was created
amount_refunded integer The amount in cents refunded
locale string Sets the language to use for e-mail receipts and payment instructions
refunds hash Refund information
refund_requests hash Refund request information

Payment Details

The API attempts to abstract the differences between the different payment methods as much as possible. In order to make it easy to integrate multiple payment methods KOMOJU uses a payments_details hash in requests and responses for payments.

The payment_details hash requires a type parameter which can be one of credit_cardkonbinibank_transferpay_easyweb_moneybit_cashnet_cashjapan_mobileline_paymerpaypaidy

Examples

  • Credit Card
  • Konbini
  • Bank transfer
  • PayEasy
  • WebMoney
  • BitCash
  • NET CASH
  • Mobile
  • LINE Pay
  • Merpay
  • Paidy

  • 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]=line_pay" \
  -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]': 'line_pay',
  '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: "line_pay"
  },
  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[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
  • 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[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" \
  -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[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',
  '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: {
    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"
  },
  return_url: "https://example.com"
}

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": "line_pay",
    "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": "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": [

  ]
}
          
            {
  "id": "09g4gqgy7r52aoun6y5jwjzs7",
  "resource": "payment",
  "status": "authorized",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": null,
  "payment_details": {
    "type": "paidy",
    "email": "test@example.com",
    "redirect_url": "https://komoju.com/offsite/new?uuid=09g4gqgy7r52aoun6y5jwjzs7"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:23Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          

Credit Card

Payment Details

Request Parameter Type Description
type string Value of credit_card
email string The e-mail address used to send the payment receipt to. Note, this value is optional.
number numeric credit card number
month numeric expiry month
year numeric expiry year
verification_value numeric CCV security number
name string Customer name

Fraud Details

Credit card payment requests support an optional fraud_details hash where information about the customer can be given in order to combat fraudulent transactions. While fields other than customer_ip are optional, additional information improves the accuracy of fraud prevention measures.

Request Parameter Type Description
customer_ip string The customer's IP address. Accepts ipv4 and ipv6 format addresses.
customer_email string The e-mail address provided by the customer during the payment process.
customer_id string A unique identifier associated with the customer.
browser_language string The language of the customer's browser session.
browser_user_agent string Information about the user's browser session.
Response Parameter Description
type Value of credit_card
email (optional) The e-mail address used to send payment receipt to.
brand Brand of credit card e.g. visa, mastercard, etc.
last_four_digits Last four digits of the credit card number
month Expiry month of the credit card
year Expiry year of the credit card

Test Cards

Note: These credit card numbers are only available in test mode. If you would like to run a live transaction, you will need to use a real credit card.

Card Number Type
3530111333300000 JCB
378282246310005 American Express
4111111111111111 Visa
5555555555554444 MasterCard
30569309025904 Diners Club
4123111111111000 Insufficient funds
4123111111111018 Exceeds card limit
4123111111111034 Bad verification value
4123111111111042 Card expired
4123111111111059 Cannot use card
4123111111111067 Invalid card

Bank Transfer

Once a payment is created we return a bank_number which the user must send the funds to with the attached order_id as their payee name. Once we receive the payment we will send a webhook indicating the status of the payment.

Restrictions

  • Bank transfers are only captured during regular business hours in Japan
  • Payments expire after 14 days (send a webhook indicating its expired)

Payment Details

Request Parameter Type Description
type string value of bank_transfer
email string The e-mail address used to send the payment receipt and instructions to.
given_name string Customer given name
family_name string Customers family name
given_name_kana string Customer given name in katakana
family_name_kana string Customers family name in katakana
phone string Customers phone number (eg. 080-1111-1111)
expiry_days numeric The number of days before the payment expires (maximum 59 days). Note, this value is optional.
Response Parameter Description
type Value of bank_transfer
email The e-mail address used to send the payment receipt and instructions to.
order_id Remitters/payers name customer needs to use to send money as
bank_name The name of the bank the user needs to wire funds to
account_branch_name The account branch name
account_number The account number
account_type The account type. Allowed values are savings or checking
account_name The account name
instructions_url A URL for an instructions page

Convenience Store (Konbini)

Restrictions

  • Payment total has a minimum of 1 and a maximum of 300,000 JPY. The total is based on the amount + tax + transaction fee
  • Payments expire after 3 days (we send a webhook indicating its expired)

Convenience Stores

When creating a Konbini payment you will need to pass a store parameter inside the payment_details hash. This value is the store slug (shown below) which the customer will make the purchase at.

English Name Japanese Name Store Slug Logo
Daily Yamazaki デイリーヤマザキ daily-yamazaki Daily yamazaki
Family Mart ファミリーマート family-mart Family mart
Lawson ローソン lawson Lawson
Ministop ミニストップ ministop Ministop
Seicomart セイコーマート seicomart Seicomart
7-Eleven セブンイレブン seven-eleven Seven eleven

Payment Details

Request Parameter Type Description
type string value of konbini
email string The e-mail address used to send the payment receipt and instructions to.
store string store slug
phone string Customers phone number (eg. 080-1111-1111). Note, this value is optional.
expiry_days numeric The number of days before the payment expires (maximum 59 days). Note, this value is optional.
Response Parameter Description
type Value of konbini
email The e-mail address used to send the payment receipt and instructions to.
store Store slug name e.g. lawson, family_mart, etc.
confirmation_code A number customers will need when paying at the konbini (used by some konbini)
receipt A number customers will need when paying at the konbini
instructions_url A URL for an instructions page

WebMoney

WebMoney is a popular prepaid card in Japan. The API for WebMoney supports multiple prepaid card requests. For example, if the customer does not have enough funds to cover the cost of the payment you can continue the request by updating the payment and passing a second prepaid_number in the payment_details hash.

Continuing a WebMoney Request

In the case the customer does not have enough funds we return a 202 Accepted status code with the payment status remaining in the pending state. The pending payment can then be updated again using the payment update endpoint and passing an additional prepaid card inside the payment details hash e.g. payment_details[prepaid_number]=XXXXXXXXXXXX.

Payment Details

Request Parameter Type Description
type string Value of web_money
email string The e-mail address used to send the payment receipt to. Note, this value is optional.
prepaid_number string 16-character prepaid card number
Response Parameter Description
type Value of web_money
email The e-mail address used to send the payment receipt to.
short_amount The amount of yen that payment was short by
prepaid_cards A list of prepaid cards used in this transaction

Test Cards

Card Number Type
1111111111111111 WebMoney prepaid card with a 2000 yen balance
e111111111111112 Invalid card number
e111111111111113 Prepaid card has already been used
e111111111111114 Card has been declined due to an unknown error

NET CASH

Similar to WebMoney, NET CASH is another prepaid card in Japan.

Continuing a NET CASH Request

Same case of WebMoney. Please see that for reference.

Payment Details

Request Parameter Type Description
type string Value of net_cash
email string The e-mail address used to send the payment receipt to. Note, this value is optional.
prepaid_number string 16-character prepaid card number
Response Parameter Description
type Value of net_cash
email (optional) The e-mail address used to send the payment receipt to.
short_amount The amount of yen that payment was short by
prepaid_cards A list of prepaid cards used in this transaction

Test Cards

Card Number Type
1111111111111111 NET CASH prepaid card with a 2000 yen balance

BitCash

Similar to WebMoney, BitCash is another prepaid card in Japan. The integration is identical to WebMoney expect BitCash does not support continuing requests with additional prepaid cards. In the case a customer has insuffcient funds they can merge prepaid cards online via the BitCash website.

Payment Details

Request Parameter Type Description
type string Value of bit_cash
email string The e-mail address used to send the payment receipt to. Note, this value is optional.
prepaid_number string 16-character prepaid card number
Response Parameter Description
type Value of bit_cash
email (optional) The e-mail address used to send the payment receipt to.

Test Cards

Card Number Type
1111111111111111 BitCash prepaid card with a 2000 yen balance
e111111111111112 Invalid card number
e111111111111113 Card has been declined due to an unknown error

PayEasy

PayEasy allows customers to pay via online banking.

This is a delayed payment type, which means after a payment is created there is a period of time which elapses before the payment is captured. KOMOJU will send a webhook once the payment has been captured.

Restrictions

  • PayEasy payments have a minimum of ¥1 and a maximum of ¥999,999.
  • Payments expire after 10 days (we send a webhook indicating its expired)

Payment Details

Request Parameter Type Description
type string value of pay_easy
email string The e-mail address used to send the payment receipt and instructions to.
given_name string Customers given name
family_name string Customers family name
given_name_kana string Customers given name in katakana
family_name_kana string Customers family name in katakana
phone string Customers phone number (eg. 080-1111-1111)
Response Parameter Description
type Value of pay_easy
email The e-mail address used to send the payment receipt and instructions to.
bank_id A code required by customers when paying with pay-easy
customer_id A code required by customers when paying with pay-easy
confirmation_id A code required by customers when paying with pay-easy
instructions_url A URL for an instructions page

Japan Mobile

docomo, au, and softbank are supported for carrier billing.

Note, this payment method requires customers to be redirected to the mobile carrier to pay.

Payment Details

Request Parameter Type Description
type string Value of japan_mobile
email string (optional) The e-mail address used to send the payment receipt to.
brand string The mobile carrier slug. Must be au, docomo, or softbank.
return_url string URL where customers are redirected after a payment has been completed.
Response Parameter Description
type Value of japan_mobile
email (optional) The e-mail address used to send the payment receipt to.
provider The mobile carrier slug. Must be au, docomo, or softbank.
redirect_url The URL where customers must be redirected to complete payment.

LINE Pay

NOTE: Support for LINE Pay is currently in development and will be coming to KOMOJU very soon.

LINE Pay is a popular smartphone app which enables QR-code based payment.

Note, this payment method requires customers to be redirected to the LINE Pay website to pay.

Payment Details

Request Parameter Type Description
type string Value of line_pay
email string (optional) The e-mail address used to send the payment receipt to.
return_url string URL where customers are redirected after a payment has been completed.
Response Parameter Description
type Value of line_pay
email (optional) The e-mail address used to send the payment receipt to.
redirect_url The URL where customers must be redirected to complete payment.

Merpay

NOTE: Support for Merpay is currently in development and will be coming to KOMOJU very soon.

Merpay is a popular smartphone app which enables QR-code based payment.

Note, this payment method requires customers to be redirected to the Merpay website to pay.

Restrictions

  • Merpay payments have a minimum of ¥1 and a maximum of ¥1,000,000.

Payment Details

Request Parameter Type Description
type string Value of merpay
email string (optional) The e-mail address used to send the payment receipt to.
return_url string URL where customers are redirected after a payment has been completed.
Response Parameter Description
type Value of merpay
email (optional) The e-mail address used to send the payment receipt to.
redirect_url The URL where customers must be redirected to complete payment.

Paidy

NOTE: Support for Paidy is currently in development and will be coming to KOMOJU very soon.

Paidy is a Japanese payment method which provides instant credit to consumers allowing them to buy now and pay later.

Note, this payment method requires customers to be redirected to the Paidy website to pay.

Payment Details

Request Parameter Type Description
type string Value of paidy
email string (optional) The e-mail address used to send the payment receipt to.
billing_address_city string Name of city, municipality, or village.
billing_address_line1 string For Japanese addresses: building name, apartment number.
billing_address_line2 string For Japanese addresses: district, land number, land number extension.
billing_address_state string Prefecture
billing_address_zip string Japanese postal code; format is NNN-NNNN
customer_age integer Age of the customer
customer_last_order_amount integer Amount (in JPY) of the last order, excluding Paidy payments.
customer_last_order_at integer Time in days since the last order, excluding Paidy payments.
customer_lifetime_value integer The total amount (in JPY) the customer has ordered, excluding canceled, rejected, or refunded transactions. Also excluding Paidy payments.
customer_name string Customer's name in kanji. Family name and first name must be separated by a space.
customer_name_kana string Customer's name in katakana. Family name and first name must be separated by a space, e.g., ヤマダ タロウ
customer_order_count integer Number of orders the customer has made at your store since creating an account
return_url string URL where customers are redirected after a payment has been completed.
Response Parameter Description
type Value of paidy
email (optional) The e-mail address used to send the payment receipt to.
redirect_url The URL where customers must be redirected to complete payment.

Tokens

For security reasons you may want KOMOJU to handle sensitive customer information for you. Tokenization works by collecting your customers payment details and converting them into a token. This token can then be passed to your server and used to process payments ensuring no sensitive data ever touches your server.

KOMOJU exposes a tokens endpoint for this purpose which allows client-side applications to create one-time tokens directly through the KOMOJU API using your publishable key.

Note that tokens can only be used once and expire after 30 days. If you want to store payment details permenantly see the section on Permanent Storage.

Creating a Token

A token can be created using a client-side library like KOMOJU MultiPay using your publishable key. You can also create tokens directly using the tokens endpoint:

  • Credit Card
  • Konbini
  • Bank transfer
  • PayEasy
  • WebMoney
  • BitCash
  • NET CASH
  • Mobile
  • LINE Pay
  • Merpay
  • 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]=line_pay" 
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]': 'line_pay'
});

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: "line_pay"
  }
}

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": "line_pay",
    "email": "test@example.com"
  }
}
          
            {
  "id": "tok_6ivp5ygiqmyh136utf0mqaogg",
  "resource": "token",
  "created_at": "2020-06-09T07:41:58Z",
  "payment_details": {
    "type": "nexus_transfer"
  }
}
          

Using a Token

Once you've created a token it can be used in any API resource that accepts the payment_details parameter. For example, when creating a payment instead of a providing a JSON for payment_details you can simply pass a token:

curl -X POST https://komoju.com/api/v1/payments \
-u komoju-mart: \
-d "amount=1000" \
-d "currency=JPY" \
-d "payment_details=tok_d7d3b7ea7a6910f1076bf025ad3276dac9360c9b3307cb92d77c93b62556077f3ifq39h3wnrlgkttrjm8c6g2e"

Permanent Storage

Payment details can be stored permenantly in KOMOJU by creating a customer resource. When creating a customer you can pass the token in place of the payment_details parameter. For example,

curl -X POST https://komoju.com/api/v1/customers \
-u komoju-mart: \
-d "payment_details=tok_d7d3b7ea7a6910f1076bf025ad3276dac9360c9b3307cb92d77c93b62556077f3ifq39h3wnrlgkttrjm8c6g2e"

Once a customer resource is created you can use the customer parameter in the payments endpoint. This will use the stored payment details to create the payment. For example,

curl -X POST https://komoju.com/api/v1/payments \
-u komoju-mart: \
-d "amount=1000" \
-d "currency=JPY" \
-d "customer=3lz38k1d12sr5e4ggchnhxdgk" \

For more information on updating and deleting customers please see the customer resource.