GET /api/v1/sessions/:id
Show Sessions

Retrieves a Session given its ID.

Useful for checking on a session's status, or to inspect the resulting payment.

サンプル

  • cURL
  • Node.js
  • Ruby
curl -X GET https://komoju.com/api/v1/sessions/1kv31jmdp5zweqlr2l2odr8wv \
  -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/sessions/1kv31jmdp5zweqlr2l2odr8wv',
  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/sessions/1kv31jmdp5zweqlr2l2odr8wv')
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": "1kv31jmdp5zweqlr2l2odr8wv",
  "resource": "session",
  "mode": "payment",
  "payment": null,
  "session_url": "https://komoju.com/sessions/1kv31jmdp5zweqlr2l2odr8wv",
  "return_url": "https://example.com/done",
  "default_locale": "en",
  "payment_methods": [
    {
      "type": "bank_transfer"
    }
  ],
  "created_at": "2020-08-17T18:03:53.000+09:00",
  "cancelled_at": null,
  "completed_at": null,
  "status": "pending"
}