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": "1w78hf97p7gf6rkqbo37eg43v",
      "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": "ORDER4",
      "metadata": {
      },
      "created_at": "2019-12-17T05:13:59Z",
      "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/0gkxxnn21xizwxrs14gc1shxy \
  -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/0gkxxnn21xizwxrs14gc1shxy',
  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/0gkxxnn21xizwxrs14gc1shxy')
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": "0gkxxnn21xizwxrs14gc1shxy",
  "resource": "payment",
  "status": "pending",
  "amount": 300,
  "tax": 30,
  "customer": null,
  "payment_deadline": "2019-12-20T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "gordon@example.com",
    "store": "ministop",
    "confirmation_code": "1111",
    "receipt": "12345",
    "instructions_url": "https://komoju.com/en/instructions/0gkxxnn21xizwxrs14gc1shxy"
  },
  "payment_method_fee": 0,
  "total": 330,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "ORDER3",
  "metadata": {
  },
  "created_at": "2019-12-17T05:13:59Z",
  "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

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments \
  -u sk_123456: \
  -d "amount=100" \
  -d "currency=JPY" \
  -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',
  '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",
  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 "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=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 "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]=2024" 
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]': '2024'
});

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

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[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[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[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[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[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
            {
  "id": "0h5jmyjxd53nu1obn6nifvkkg",
  "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": "2019-12-17T05:13:21Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2019-12-17T05:13:21Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "3pxr5gz4v46p7kmaxscrlmb9u",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-24T05:14:03Z",
  "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": "2019-12-17T05:14:03Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:03Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "axifdnyw72yshgn0sl8h6c7k4",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-24T05:14:03Z",
  "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": "2019-12-17T05:14:03Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:03Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "bzwoub9u9n3iwoo1krkz65dd3",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-24T14:59:59Z",
  "payment_details": {
    "type": "credit_card",
    "email": "test@example.com",
    "brand": "visa",
    "last_four_digits": "1111",
    "month": 1,
    "year": 2024
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": "2019-12-17T05:14:04Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:04Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "a53jo2d48baby0waj4nqf2mm1",
  "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": "2019-12-17T05:14:04Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:04Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "cu3h42p0y338wl5u9riwducas",
  "resource": "payment",
  "status": "authorized",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-27T14: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/cu3h42p0y338wl5u9riwducas"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:04Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "asgx3zgto9y4go5kl3go26tok",
  "resource": "payment",
  "status": "authorized",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-20T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "test@example.com",
    "store": "lawson",
    "confirmation_code": "09011112222",
    "receipt": "303001",
    "instructions_url": "https://komoju.com/ja/instructions/asgx3zgto9y4go5kl3go26tok"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:05Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "8ovxtd6casu87mw8yqjg4e6ez",
  "resource": "payment",
  "status": "authorized",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-24T14:59:59Z",
  "payment_details": {
    "type": "bank_transfer",
    "email": "test@example.com",
    "order_id": "F2839633646",
    "bank_name": "三井住友銀行",
    "account_branch_name": "ひなぎく",
    "account_number": "131",
    "account_type": "普通預金",
    "account_name": "株式会社DEGICA(カブシキガイシャ デジカ)",
    "instructions_url": "https://komoju.com/ja/instructions/8ovxtd6casu87mw8yqjg4e6ez"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:07Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "dwptokwa2zt5fqcv4katj8uu8",
  "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": "2019-12-17T05:14:08Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:08Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "1ujaac76boknjx8twmaeillpb",
  "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": "2019-12-17T05:14:08Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14:08Z",
  "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/dnxemn9a0k97rcgtmf6e2uffe \
  -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/dnxemn9a0k97rcgtmf6e2uffe',
  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/dnxemn9a0k97rcgtmf6e2uffe')
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": "dnxemn9a0k97rcgtmf6e2uffe",
  "resource": "payment",
  "status": "pending",
  "amount": 300,
  "tax": 30,
  "customer": null,
  "payment_deadline": "2019-12-20T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "gordon@example.com",
    "store": "ministop",
    "confirmation_code": "1111",
    "receipt": "12345",
    "instructions_url": "https://komoju.com/en/instructions/dnxemn9a0k97rcgtmf6e2uffe"
  },
  "payment_method_fee": 0,
  "total": 330,
  "currency": "JPY",
  "description": "updated description",
  "captured_at": null,
  "external_order_num": "ORDER6",
  "metadata": {
    "updated": "metadata"
  },
  "created_at": "2019-12-17T05:14:02Z",
  "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/3mylgw3teb9l8ox95zomoinsy/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/3mylgw3teb9l8ox95zomoinsy/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/3mylgw3teb9l8ox95zomoinsy/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": "3mylgw3teb9l8ox95zomoinsy",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-01-01T14:59:59Z",
  "payment_details": {
    "type": "credit_card",
    "email": "test@example.com",
    "brand": "visa",
    "last_four_digits": "1111",
    "month": 1,
    "year": 2024
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": "2019-12-17T05:14:03Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2019-12-17T05:14: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.

Examples

  • Credit Card
  • BitCash
  • NET CASH

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/624a2cf71vyex7ibxent99ndu/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/624a2cf71vyex7ibxent99ndu/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/624a2cf71vyex7ibxent99ndu/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/e3d62b2ivo2jy4y0owa93ngv4/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/e3d62b2ivo2jy4y0owa93ngv4/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/e3d62b2ivo2jy4y0owa93ngv4/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/17kc0nxrhbpl8m5z8r8s2htnp/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/17kc0nxrhbpl8m5z8r8s2htnp/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/17kc0nxrhbpl8m5z8r8s2htnp/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/7ige6fulucfo14fz2onlgtiec/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/7ige6fulucfo14fz2onlgtiec/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/7ige6fulucfo14fz2onlgtiec/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
            {
  "id": "624a2cf71vyex7ibxent99ndu",
  "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": "2019-12-17T05:13:22Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2019-12-17T05:13:22Z",
  "amount_refunded": 110,
  "locale": "ja",
  "refunds": [
    {
      "id": "4tmupkt2gcfw7g8z6m1mu3jb7",
      "resource": "refund",
      "amount": 110,
      "currency": "JPY",
      "payment": "624a2cf71vyex7ibxent99ndu",
      "description": null,
      "created_at": "2019-12-17T05:13:22Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "e3d62b2ivo2jy4y0owa93ngv4",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-24T14:59:59Z",
  "payment_details": {
    "type": "credit_card",
    "email": "test@example.com",
    "brand": "visa",
    "last_four_digits": "1111",
    "month": 1,
    "year": 2024
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": "2019-12-17T05:13:59Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2019-12-17T05:13:59Z",
  "amount_refunded": 1100,
  "locale": "ja",
  "refunds": [
    {
      "id": "0r7f3gez42nts36s86gyo0fcy",
      "resource": "refund",
      "amount": 1100,
      "currency": "JPY",
      "payment": "e3d62b2ivo2jy4y0owa93ngv4",
      "description": null,
      "created_at": "2019-12-17T05:14:00Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "17kc0nxrhbpl8m5z8r8s2htnp",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-24T05:14:08Z",
  "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": "2019-12-17T05:14:08Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2019-12-17T05:14:08Z",
  "amount_refunded": 1100,
  "locale": "ja",
  "refunds": [
    {
      "id": "ccapr3wul4kzauwoj35dzq1og",
      "resource": "refund",
      "amount": 1100,
      "currency": "JPY",
      "payment": "17kc0nxrhbpl8m5z8r8s2htnp",
      "description": null,
      "created_at": "2019-12-17T05:14:08Z",
      "chargeback": false
    }
  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "7ige6fulucfo14fz2onlgtiec",
  "resource": "payment",
  "status": "refunded",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-24T05:14:09Z",
  "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": "2019-12-17T05:14:09Z",
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2019-12-17T05:14:09Z",
  "amount_refunded": 1100,
  "locale": "ja",
  "refunds": [
    {
      "id": "b17oxy0pogu3pq7zssebhehsk",
      "resource": "refund",
      "amount": 1100,
      "currency": "JPY",
      "payment": "7ige6fulucfo14fz2onlgtiec",
      "description": null,
      "created_at": "2019-12-17T05:14:09Z",
      "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.

>>>

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

Examples

  • Konbini
  • Bank transfer
  • PayEasy

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/3k1vp0pcloim3rld8tj55wpxg/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/3k1vp0pcloim3rld8tj55wpxg/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/3k1vp0pcloim3rld8tj55wpxg/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/879s7r2h3jaupupjd9tl7441o/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/879s7r2h3jaupupjd9tl7441o/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/879s7r2h3jaupupjd9tl7441o/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/2sn8q79p0bwt615nxml7iglgt/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/2sn8q79p0bwt615nxml7iglgt/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/2sn8q79p0bwt615nxml7iglgt/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": "3k1vp0pcloim3rld8tj55wpxg",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-24T14:59:59Z",
  "payment_details": {
    "type": "bank_transfer",
    "email": "test@example.com",
    "order_id": "U6953224225",
    "bank_name": "三井住友銀行",
    "account_branch_name": "ひなぎく",
    "account_number": "35",
    "account_type": "普通預金",
    "account_name": "株式会社DEGICA(カブシキガイシャ デジカ)",
    "instructions_url": "https://komoju.com/ja/instructions/3k1vp0pcloim3rld8tj55wpxg"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2019-12-17T05:13:26Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "879s7r2h3jaupupjd9tl7441o",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-27T14:59:59Z",
  "payment_details": {
    "type": "pay_easy",
    "email": "test@example.com",
    "bank_id": "pvrad",
    "customer_id": "ia7nzuw3ys",
    "confirmation_id": "fgo7sxr0tp",
    "instructions_url": "https://komoju.com/ja/instructions/879s7r2h3jaupupjd9tl7441o"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2019-12-17T05:13:57Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}
          
            {
  "id": "2sn8q79p0bwt615nxml7iglgt",
  "resource": "payment",
  "status": "cancelled",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2019-12-20T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "test@example.com",
    "store": "lawson",
    "confirmation_code": "2222",
    "receipt": "90865881197",
    "instructions_url": "https://komoju.com/ja/instructions/2sn8q79p0bwt615nxml7iglgt"
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": null,
  "external_order_num": null,
  "metadata": {
  },
  "created_at": "2019-12-17T05:13:58Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}