Payments

>>>

Retrieves a paginated list of payments. Pagination can be configured with page and per_page parameters.

Payments can be filtered by currency, external_order_num, and status.

A time range can be specified with start_time, and end_time.

Examples

  • cURL
  • Node.js
  • Ruby
curl -X GET https://komoju.com/api/v1/payments \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var get_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments',
  method: 'GET',
  headers: {
    'Authorization': auth
  }
};

var get_req = https.request(get_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

get_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.get(uri.path, headers)
puts res.body
{
  "resource": "list",
  "total": 1,
  "page": 1,
  "per_page": 10,
  "last_page": 1,
  "data": [
    {
      "id": "19bl8anskioyoicavtw6qc39x",
      "resource": "payment",
      "status": "pending",
      "amount": 300,
      "tax": 30,
      "customer": null,
      "payment_deadline": null,
      "payment_details": null,
      "payment_method_fee": 0,
      "total": 330,
      "currency": "JPY",
      "description": null,
      "captured_at": null,
      "external_order_num": "ORDER15",
      "metadata": {
      },
      "created_at": "2020-06-09T07:42:16Z",
      "amount_refunded": 0,
      "locale": "en",
      "refunds": [

      ],
      "refund_requests": [

      ]
    }
  ]
}

Params

Param name Description
start_time
optional

Query for records created after this time.

end_time
optional

Query for records created before this time.

per_page
optional

How many complete objects per page.

page
optional

Page number to query for.

currency
optional

3 letter ISO currency code used to pay.

external_order_num
optional

A unique ID from your application used to track this payment.

status
optional

The status of the payment.

>>>

Retrieves a single payment object by its id.

Examples

  • cURL
  • Node.js
  • Ruby
curl -X GET https://komoju.com/api/v1/payments/dp6f5pozrrh0nypa62joe09sd \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var get_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/dp6f5pozrrh0nypa62joe09sd',
  method: 'GET',
  headers: {
    'Authorization': auth
  }
};

var get_req = https.request(get_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

get_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/dp6f5pozrrh0nypa62joe09sd')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.get(uri.path, headers)
puts res.body
{
  "id": "dp6f5pozrrh0nypa62joe09sd",
  "resource": "payment",
  "status": "pending",
  "amount": 300,
  "tax": 30,
  "customer": null,
  "payment_deadline": "2020-06-12T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "gordon@example.com",
    "store": "lawson",
    "confirmation_code": "1111",
    "receipt": "12345",
    "instructions_url": "https://komoju.com/en/instructions/dp6f5pozrrh0nypa62joe09sd"
  },
  "payment_method_fee": 0,
  "total": 330,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "ORDER14",
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:03Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
>>>

POST /api/v1/payments
Create Payments

Creates a payment for a given amount and currency.

*Must specify exactly one of payment_details or customer.

Examples

  • Credit Card
  • Konbini
  • Bank transfer
  • PayEasy
  • WebMoney
  • BitCash
  • NET CASH
  • Mobile
  • LINE Pay
  • Merpay
  • 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": [

  ]
}
          

Params

Param name Description
amount
required

The amount to be charged before tax. Must be equal or greater than 0. Use a ‘.’ as a decimal separator, and no thousands separator.

currency
required

3 letter ISO currency code used to pay.

payment_details
required*

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

customer
required*

The ID of an existing customer in which to provide payment details for the payment. This or payment_details must be present.

capture
optional

If false, the payment will be authorized but not be captured. This option is ignored if a payment type is not credit_card.

description
optional

Plaintext description for annotating a resource.

tax
optional

The amount of tax to be charged. Defaults to the highest consumption tax rate in Japan if omitted or set to 'auto'. Use a ‘.’ as a decimal separator, and no thousands separator. If the tax is more precise than the currency allows, it will be rounded using a round half up algorithm.

external_order_num
optional

A unique ID from your application used to track this payment.

locale
optional

Sets language of instruction page for supported payment methods. Valid options are 'en', 'ja', and 'ko'.

metadata
optional

A set of key-value pairs.

>>>

Updates a payment. Only a payment's description and metadata can be changed.

Examples

  • cURL
  • Node.js
  • Ruby
curl -X PATCH https://komoju.com/api/v1/payments/ef4ptr6nxrb1kxcw5opvp0uk9 \
  -u sk_123456: \
  -d "description=updated description" \
  -d "metadata[updated]=metadata" 
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var patch_data = querystring.stringify({
  'description': 'updated description',
  'metadata[updated]': 'metadata'
});

var patch_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/ef4ptr6nxrb1kxcw5opvp0uk9',
  method: 'PATCH',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(patch_data)
  }
};

var patch_req = https.request(patch_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

patch_req.write(patch_data);
patch_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/ef4ptr6nxrb1kxcw5opvp0uk9')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  description: "updated description",
  metadata: {
    updated: "metadata"
  }
}

res = https.patch(
  uri.path,
  body.to_json,
  headers
)

puts res.body
{
  "id": "ef4ptr6nxrb1kxcw5opvp0uk9",
  "resource": "payment",
  "status": "pending",
  "amount": 300,
  "tax": 30,
  "customer": null,
  "payment_deadline": "2020-06-12T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "gordon@example.com",
    "store": "family-mart",
    "confirmation_code": "1111",
    "receipt": "12345",
    "instructions_url": "https://komoju.com/en/instructions/ef4ptr6nxrb1kxcw5opvp0uk9"
  },
  "payment_method_fee": 0,
  "total": 330,
  "currency": "JPY",
  "description": "updated description",
  "captured_at": null,
  "external_order_num": "ORDER17",
  "metadata": {
    "updated": "metadata"
  },
  "created_at": "2020-06-09T07:42:23Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [

  ]
}

Params

Param name Description
description
optional

Plaintext description for annotating a resource.

metadata
optional

A set of key-value pairs.

>>>

Captures a payment. Only works on payments with a payment_type of "credit_card".

Examples

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/an707r5zejhfzp9y58ctqn2um/capture \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/an707r5zejhfzp9y58ctqn2um/capture',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/an707r5zejhfzp9y58ctqn2um/capture')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
{
  "id": "an707r5zejhfzp9y58ctqn2um",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-06-24T14:59:59Z",
  "payment_details": {
    "type": "credit_card",
    "email": "test@example.com",
    "brand": "visa",
    "last_four_digits": "1111",
    "month": 1,
    "year": 2025
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-09T07:42:04Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2020-06-09T07:42:03Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
>>>

Refunds an arbitrary amount of money from an existing payment. If no amount is specified, the whole payment is refunded. When the payment has been fully refunded KOMOJU will send payment.refunded webhook.

For cash-based payment methods, Japanese customers must be redirected to redirect_url on the refund object to complete their refund. Upon navigating to redirect_url customers can select a convenience store where they can receive a receipt code for a cash refund. KOMOJU will send payment.refunded webhook once the customer has received their refund.

Examples

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

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/170zsdd53a4mjnxfuj9y7i34h/refund \
  -u sk_123456: \
  -d "amount=1000" \
  -d "email=test@example.com" \
  -d "name=コモジュ太郎" \
  -d "phone=080-1111-1111" 
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',
  'email': 'test@example.com',
  'name': 'コモジュ太郎',
  'phone': '080-1111-1111'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/170zsdd53a4mjnxfuj9y7i34h/refund',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/170zsdd53a4mjnxfuj9y7i34h/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  amount: "1000",
  email: "test@example.com",
  name: "コモジュ太郎",
  phone: "080-1111-1111"
}

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/aa8z1z793likktyihj2qn7llb/refund \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/aa8z1z793likktyihj2qn7llb/refund',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/aa8z1z793likktyihj2qn7llb/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/5vjt0zpvz7ro47rtazb8apyhx/refund \
  -u sk_123456: \
  -d "amount=1000" \
  -d "email=test@example.com" \
  -d "name=コモジュ太郎" \
  -d "phone=080-1111-1111" 
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',
  'email': 'test@example.com',
  'name': 'コモジュ太郎',
  'phone': '080-1111-1111'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/5vjt0zpvz7ro47rtazb8apyhx/refund',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/5vjt0zpvz7ro47rtazb8apyhx/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  amount: "1000",
  email: "test@example.com",
  name: "コモジュ太郎",
  phone: "080-1111-1111"
}

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/0c1xmwpun0bamfdkhjby32qi3/refund \
  -u sk_123456: \
  -d "amount=1000" 
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'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/0c1xmwpun0bamfdkhjby32qi3/refund',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/0c1xmwpun0bamfdkhjby32qi3/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  amount: "1000"
}

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/22qgmp3d9vs8k87799716xbw2/refund \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/22qgmp3d9vs8k87799716xbw2/refund',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/22qgmp3d9vs8k87799716xbw2/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/2rmli70w9qqm3lbi6cs3pj293/refund \
  -u sk_123456: \
  -d "amount=1000" 
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'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/2rmli70w9qqm3lbi6cs3pj293/refund',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/2rmli70w9qqm3lbi6cs3pj293/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  amount: "1000"
}

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/4z3tzkpsh6gh9dod6s2db2tn1/refund \
  -u sk_123456: \
  -d "amount=1000" 
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'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/4z3tzkpsh6gh9dod6s2db2tn1/refund',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/4z3tzkpsh6gh9dod6s2db2tn1/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  amount: "1000"
}

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/agqgnz07wrybzq4q11a650mfa/refund \
  -u sk_123456: \
  -d "amount=1000" \
  -d "email=test@example.com" \
  -d "name=コモジュ太郎" \
  -d "phone=080-1111-1111" 
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',
  'email': 'test@example.com',
  'name': 'コモジュ太郎',
  'phone': '080-1111-1111'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/agqgnz07wrybzq4q11a650mfa/refund',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/agqgnz07wrybzq4q11a650mfa/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  amount: "1000",
  email: "test@example.com",
  name: "コモジュ太郎",
  phone: "080-1111-1111"
}

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/7oqcz8emzgf3fcorfph0y7mu3/refund \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/7oqcz8emzgf3fcorfph0y7mu3/refund',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/7oqcz8emzgf3fcorfph0y7mu3/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/b63kr222rtkvn3z6hhw7i4j3x/refund \
  -u sk_123456: \
  -d "amount=500" 
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
  'amount': '500'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/b63kr222rtkvn3z6hhw7i4j3x/refund',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/b63kr222rtkvn3z6hhw7i4j3x/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  amount: "500"
}

res = https.post(
  uri.path,
  body.to_json,
  headers
)

puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/7mom8rbw56emtroziokdt9q2i/refund \
  -u sk_123456: \
  -d "amount=1000" 
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'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/7mom8rbw56emtroziokdt9q2i/refund',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/7mom8rbw56emtroziokdt9q2i/refund')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  amount: "1000"
}

res = https.post(
  uri.path,
  body.to_json,
  headers
)

puts res.body
            {
  "id": "170zsdd53a4mjnxfuj9y7i34h",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": "2020-06-19T14:59:59Z",
  "payment_details": {
    "type": "pay_easy",
    "email": "test@example.com",
    "bank_id": "QWERTY",
    "customer_id": "ABCD",
    "confirmation_id": "1234",
    "instructions_url": "https://komoju.com/en/instructions/170zsdd53a4mjnxfuj9y7i34h"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER1",
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:49Z",
  "amount_refunded": 1000,
  "locale": "en",
  "refunds": [
    {
      "id": "1lcyjkny7adns747mqdisnohn",
      "resource": "refund",
      "status": "pending",
      "redirect_url": "https://komoju.com/refunds/7gf5v2b9v2n618xhh82fqz5ch",
      "amount": 1000,
      "currency": "JPY",
      "payment": "170zsdd53a4mjnxfuj9y7i34h",
      "description": null,
      "created_at": "2020-06-09T07:41:50Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "aa8z1z793likktyihj2qn7llb",
  "resource": "payment",
  "status": "refunded",
  "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:52Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:51Z",
  "amount_refunded": 110,
  "locale": "ja",
  "refunds": [
    {
      "id": "3xn5fodiq43un812b59u8gyuy",
      "resource": "refund",
      "status": "completed",
      "redirect_url": null,
      "amount": 110,
      "currency": "JPY",
      "payment": "aa8z1z793likktyihj2qn7llb",
      "description": null,
      "created_at": "2020-06-09T07:41:52Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "5vjt0zpvz7ro47rtazb8apyhx",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": "2020-06-16T14:59:59Z",
  "payment_details": {
    "type": "bank_transfer",
    "email": "test@example.com",
    "order_id": "ABCD1",
    "bank_name": "三井住友銀行",
    "account_branch_name": "ひなぎく",
    "account_number": "13",
    "account_type": "普通預金",
    "account_name": "株式会社DEGICA(カブシキガイシャ デジカ)",
    "instructions_url": "https://komoju.com/en/instructions/5vjt0zpvz7ro47rtazb8apyhx"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER2",
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:52Z",
  "amount_refunded": 1000,
  "locale": "en",
  "refunds": [
    {
      "id": "cyvflpwidp91qwv55l5ogrrc4",
      "resource": "refund",
      "status": "pending",
      "redirect_url": "https://komoju.com/refunds/blyn0f6tpb4gxcl5qxno2bw4h",
      "amount": 1000,
      "currency": "JPY",
      "payment": "5vjt0zpvz7ro47rtazb8apyhx",
      "description": null,
      "created_at": "2020-06-09T07:41:52Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "0c1xmwpun0bamfdkhjby32qi3",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": null,
  "payment_details": {
    "type": "line_pay",
    "email": "test@example.com",
    "redirect_url": "https://komoju.com/offsite/new?uuid=4cv3ovhe3hgzkh4wtwaktoqwe"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER6",
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:59Z",
  "amount_refunded": 1000,
  "locale": "en",
  "refunds": [
    {
      "id": "a67dkjyxwg60q3slgvctcktft",
      "resource": "refund",
      "status": "completed",
      "redirect_url": null,
      "amount": 1000,
      "currency": "JPY",
      "payment": "0c1xmwpun0bamfdkhjby32qi3",
      "description": null,
      "created_at": "2020-06-09T07:41:59Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "22qgmp3d9vs8k87799716xbw2",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-06-16T07:41:59Z",
  "payment_details": {
    "type": "net_cash",
    "email": "test@example.com",
    "short_amount": 0,
    "prepaid_cards": [
      {
        "last_four_digits": "cdef",
        "points": 1100
      }
    ]
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-09T07:41:59Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:59Z",
  "amount_refunded": 1100,
  "locale": "ja",
  "refunds": [
    {
      "id": "71aslbh0s4egn6wihjd8aj51f",
      "resource": "refund",
      "status": "completed",
      "redirect_url": null,
      "amount": 1100,
      "currency": "JPY",
      "payment": "22qgmp3d9vs8k87799716xbw2",
      "description": null,
      "created_at": "2020-06-09T07:41:59Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "2rmli70w9qqm3lbi6cs3pj293",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": null,
  "payment_details": {
    "type": "merpay",
    "email": "test@example.com",
    "redirect_url": "https://komoju.com/offsite/new?uuid=4cv3ovhe3hgzkh4wtwaktoqwe"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER7",
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:59Z",
  "amount_refunded": 1000,
  "locale": "en",
  "refunds": [
    {
      "id": "7kwsr1mg3up98p19n3qb37zwh",
      "resource": "refund",
      "status": "completed",
      "redirect_url": null,
      "amount": 1000,
      "currency": "JPY",
      "payment": "2rmli70w9qqm3lbi6cs3pj293",
      "description": null,
      "created_at": "2020-06-09T07:41:59Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "4z3tzkpsh6gh9dod6s2db2tn1",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": null,
  "payment_details": {
    "type": "japan_mobile",
    "email": "test@example.com",
    "provider": "docomo",
    "redirect_url": "https://komoju.com/offsite/new?uuid=4cv3ovhe3hgzkh4wtwaktoqwe"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER10",
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:00Z",
  "amount_refunded": 1000,
  "locale": "en",
  "refunds": [
    {
      "id": "e6ekzzah6noftkeequj7j3aqt",
      "resource": "refund",
      "status": "completed",
      "redirect_url": null,
      "amount": 1000,
      "currency": "JPY",
      "payment": "4z3tzkpsh6gh9dod6s2db2tn1",
      "description": null,
      "created_at": "2020-06-09T07:42:00Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "agqgnz07wrybzq4q11a650mfa",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": "2020-06-12T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "test@example.com",
    "store": "daily-yamazaki",
    "confirmation_code": null,
    "receipt": "12345",
    "instructions_url": "https://komoju.com/en/instructions/agqgnz07wrybzq4q11a650mfa"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER13",
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:02Z",
  "amount_refunded": 1000,
  "locale": "en",
  "refunds": [
    {
      "id": "a5e4a1y2qts7f0w8vj7ov5q2e",
      "resource": "refund",
      "status": "pending",
      "redirect_url": "https://komoju.com/refunds/0rmqrsqktf31wnmhbb82hfdsn",
      "amount": 1000,
      "currency": "JPY",
      "payment": "agqgnz07wrybzq4q11a650mfa",
      "description": null,
      "created_at": "2020-06-09T07:42:02Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "7oqcz8emzgf3fcorfph0y7mu3",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-06-16T07:42:02Z",
  "payment_details": {
    "type": "nanaco",
    "email": "test@example.com",
    "short_amount": 0,
    "prepaid_cards": [
      {
        "last_four_digits": "cdef",
        "points": 1100
      }
    ]
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-09T07:42:02Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:02Z",
  "amount_refunded": 1100,
  "locale": "ja",
  "refunds": [
    {
      "id": "6qf8idfj4fwldg2f8xaxonn12",
      "resource": "refund",
      "status": "completed",
      "redirect_url": null,
      "amount": 1100,
      "currency": "JPY",
      "payment": "7oqcz8emzgf3fcorfph0y7mu3",
      "description": null,
      "created_at": "2020-06-09T07:42:02Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "b63kr222rtkvn3z6hhw7i4j3x",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-06-16T14:59:59Z",
  "payment_details": {
    "type": "credit_card",
    "email": "test@example.com",
    "brand": "visa",
    "last_four_digits": "1111",
    "month": 1,
    "year": 2025
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-09T07:42:20Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:19Z",
  "amount_refunded": 500,
  "locale": "ja",
  "refunds": [
    {
      "id": "3iytpjriy703rjjd50jco87nm",
      "resource": "refund",
      "status": "completed",
      "redirect_url": null,
      "amount": 500,
      "currency": "JPY",
      "payment": "b63kr222rtkvn3z6hhw7i4j3x",
      "description": null,
      "created_at": "2020-06-09T07:42:20Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "7mom8rbw56emtroziokdt9q2i",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": null,
  "payment_details": {
    "type": "paidy",
    "email": "test@example.com",
    "redirect_url": "https://komoju.com/offsite/new?uuid=4cv3ovhe3hgzkh4wtwaktoqwe"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER19",
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:23Z",
  "amount_refunded": 1000,
  "locale": "en",
  "refunds": [
    {
      "id": "0tiab9hqx25hevdpockz35258",
      "resource": "refund",
      "status": "completed",
      "redirect_url": null,
      "amount": 1000,
      "currency": "JPY",
      "payment": "7mom8rbw56emtroziokdt9q2i",
      "description": null,
      "created_at": "2020-06-09T07:42:24Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          

Params

Param name Description
amount
optional

The amount to be charged before tax. Must be equal or greater than 0. Use a ‘.’ as a decimal separator, and no thousands separator.

description
optional

Plaintext description for annotating a resource.

name
optional

The name of the customer.

email
optional

The e-mail address of the customer.

phone
optional

The phone number of the customer.

>>>

Refund requests can be used for payment methods that do not support refunds e.g. cash-based payment methods like Convenience Store, Bank Transfer, etc.

This provides an alternative refund option for cash based payments through a bank transfer.

Examples

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request \
  -u sk_123456: \
  -d "account_number=12345678" \
  -d "account_type=normal" \
  -d "amount=1000" \
  -d "bank_name=KOMOJU BANK" \
  -d "branch_number=1234" \
  -d "customer_name=John Doe" \
  -d "include_payment_method_fee=true" 
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
  'account_number': '12345678',
  'account_type': 'normal',
  'amount': '1000',
  'bank_name': 'KOMOJU BANK',
  'branch_number': '1234',
  'customer_name': 'John Doe',
  'include_payment_method_fee': 'true'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  account_number: "12345678",
  account_type: "normal",
  amount: "1000",
  bank_name: "KOMOJU BANK",
  branch_number: "1234",
  customer_name: "John Doe",
  include_payment_method_fee: "true"
}

res = https.post(
  uri.path,
  body.to_json,
  headers
)

puts res.body
{
  "id": "7czbdbavjdbl3jjkrd7c65wi5",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": "2020-06-12T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "gordon@example.com",
    "store": "circle-k",
    "confirmation_code": null,
    "receipt": "12345",
    "instructions_url": "https://komoju.com/en/instructions/7czbdbavjdbl3jjkrd7c65wi5"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER4",
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:58Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [
    {
      "id": "4f1jtn1rafgrrg9t23waobawp",
      "payment": "7czbdbavjdbl3jjkrd7c65wi5",
      "customer_name": "John Doe",
      "bank_name": "KOMOJU BANK",
      "branch_number": "1234",
      "account_number": "12345678",
      "status": "pending",
      "created_at": "2020-06-09T07:41:58Z"
    }
  ]
}

Params

Param name Description
amount
required

The amount to be charged before tax. Must be equal or greater than 0. Use a ‘.’ as a decimal separator, and no thousands separator.

customer_name
required

The name of the customer.

bank_name
required

The name of the bank.

branch_number
required

The bank branch number.

account_type
required

Bank account type normal or checking

account_number
required

Bank account number.

include_payment_method_fee
required

Whether or not to refund the payment's paymentmethodfee (also known as customer fee or kiosk fee). This fee is charged to customers for some payment methods e.g. Konbini, PayEasy, Bank Transfer, etc. Please note that when true the paymentmethodfee will be charged to your account.

description
optional

Plaintext description for annotating a resource.

>>>

Cancels a payment. The given payment must have a state of pending or authorized in order to be canceled.

Examples

  • Credit Card
  • Konbini
  • Bank transfer
  • PayEasy
  • Mobile
  • LINE Pay
  • Merpay
  • Paidy

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/80q0a0aocrhx9nltrx4vwz1g2/cancel \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/80q0a0aocrhx9nltrx4vwz1g2/cancel',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/80q0a0aocrhx9nltrx4vwz1g2/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/5kl9rbiwlsdz2eajjks50wu1p/cancel \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/5kl9rbiwlsdz2eajjks50wu1p/cancel',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/5kl9rbiwlsdz2eajjks50wu1p/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/3tfcal1ilctwka012p5l79g71/cancel \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/3tfcal1ilctwka012p5l79g71/cancel',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/3tfcal1ilctwka012p5l79g71/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/2fnl8uwn2tm9d9iy17vk3rtvy/cancel \
  -u sk_123456: \
  -d "debug=true" 
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
  'debug': 'true'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/2fnl8uwn2tm9d9iy17vk3rtvy/cancel',
  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/2fnl8uwn2tm9d9iy17vk3rtvy/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

body = {
  debug: "true"
}

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/2pa7pn3wq87vvfz9f9yyomfs3/cancel \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/2pa7pn3wq87vvfz9f9yyomfs3/cancel',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/2pa7pn3wq87vvfz9f9yyomfs3/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/75kzlhy1huv10db2qw5kdtkm3/cancel \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/75kzlhy1huv10db2qw5kdtkm3/cancel',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/75kzlhy1huv10db2qw5kdtkm3/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/551p58bphju7vj657gcbc9iq8/cancel \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/551p58bphju7vj657gcbc9iq8/cancel',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/551p58bphju7vj657gcbc9iq8/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/3u6c2md57kkn6p4blvcstqomy/cancel \
  -u sk_123456:
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/3u6c2md57kkn6p4blvcstqomy/cancel',
  method: 'POST',
  headers: {
    'Authorization': auth
  }
};

var post_req = https.request(post_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/3u6c2md57kkn6p4blvcstqomy/cancel')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
secret_key = 'sk_123456'
auth = Base64.encode64("#{secret_key}:")
headers = {
  'Content-Type' => 'application/json',
  'Authorization' => "Basic #{auth}"
}

res = https.post(uri.path, '{}', headers)
puts res.body
            {
  "id": "80q0a0aocrhx9nltrx4vwz1g2",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 0,
  "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": 3,
    "year": 2021
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "ORDER3",
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:58Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "5kl9rbiwlsdz2eajjks50wu1p",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": null,
  "payment_details": {
    "type": "line_pay",
    "email": "test@example.com",
    "redirect_url": "https://komoju.com/offsite/new?uuid=4cv3ovhe3hgzkh4wtwaktoqwe"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "ORDER5",
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:58Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "3tfcal1ilctwka012p5l79g71",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": null,
  "payment_details": {
    "type": "merpay",
    "email": "test@example.com",
    "redirect_url": "https://komoju.com/offsite/new?uuid=4cv3ovhe3hgzkh4wtwaktoqwe"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "ORDER8",
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:00Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "2fnl8uwn2tm9d9iy17vk3rtvy",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": null,
  "payment_details": {
    "type": "japan_mobile",
    "email": "test@example.com",
    "provider": "docomo",
    "redirect_url": "https://komoju.com/offsite/new?uuid=4cv3ovhe3hgzkh4wtwaktoqwe"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "ORDER9",
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:00Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "2pa7pn3wq87vvfz9f9yyomfs3",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-06-19T14:59:59Z",
  "payment_details": {
    "type": "pay_easy",
    "email": "test@example.com",
    "bank_id": "rl1rc",
    "customer_id": "xzrq3glweo",
    "confirmation_id": "4eiv923zvn",
    "instructions_url": "https://komoju.com/ja/instructions/2pa7pn3wq87vvfz9f9yyomfs3"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:17Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "75kzlhy1huv10db2qw5kdtkm3",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-06-16T14:59:59Z",
  "payment_details": {
    "type": "bank_transfer",
    "email": "test@example.com",
    "order_id": "B5536394549",
    "bank_name": "三井住友銀行",
    "account_branch_name": "ひなぎく",
    "account_number": "130",
    "account_type": "普通預金",
    "account_name": "株式会社DEGICA(カブシキガイシャ デジカ)",
    "instructions_url": "https://komoju.com/ja/instructions/75kzlhy1huv10db2qw5kdtkm3"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:18Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "551p58bphju7vj657gcbc9iq8",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-06-12T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "test@example.com",
    "store": "lawson",
    "confirmation_code": "ek9e2",
    "receipt": "a8y03rvi8k",
    "instructions_url": "https://komoju.com/ja/instructions/551p58bphju7vj657gcbc9iq8"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2020-06-09T07:42:18Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

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

  ],
  "refund_requests": [

  ]
}