Events

>>>

Lists out past webhook events from most-recent to least-recent.

サンプル

  • cURL
  • Node.js
  • Ruby
curl -X GET https://komoju.com/api/v1/events \
  -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/events',
  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/events')
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": 2,
  "page": 1,
  "per_page": 10,
  "last_page": 1,
  "data": [
    {
      "id": "4xwf1falwkeagr4mn0gg6n19d",
      "type": "payment.captured",
      "resource": "event",
      "data": {
        "id": "dvxisyithua801n3vyfb4q0oe",
        "resource": "payment",
        "status": "captured",
        "amount": 300,
        "tax": 30,
        "customer": null,
        "payment_deadline": "2018-11-20T14:59:59Z",
        "payment_details": {
          "type": "credit_card",
          "email": "gordon@example.com",
          "brand": "visa",
          "last_four_digits": "1111",
          "month": 3,
          "year": 2019
        },
        "payment_method_fee": 0,
        "total": 330,
        "currency": "JPY",
        "description": null,
        "captured_at": "2018-11-11T14:59:59Z",
        "external_order_num": "ORDER6",
        "metadata": {
        },
        "created_at": "2018-11-13T06:20:21Z",
        "amount_refunded": 0,
        "locale": "en",
        "refunds": [

        ],
        "refund_requests": [

        ]
      },
      "created_at": "2018-11-13T06:20:21Z"
    },
    {
      "id": "erwjx2l8u1ff38pxw2jvtgc0m",
      "type": "payment.updated",
      "resource": "event",
      "data": {
        "id": "dvxisyithua801n3vyfb4q0oe",
        "resource": "payment",
        "status": "captured",
        "amount": 300,
        "tax": 30,
        "customer": null,
        "payment_deadline": "2018-11-20T14:59:59Z",
        "payment_details": {
          "type": "credit_card",
          "email": "gordon@example.com",
          "brand": "visa",
          "last_four_digits": "1111",
          "month": 3,
          "year": 2019
        },
        "payment_method_fee": 0,
        "total": 330,
        "currency": "JPY",
        "description": null,
        "captured_at": "2018-11-11T14:59:59Z",
        "external_order_num": "ORDER6",
        "metadata": {
        },
        "created_at": "2018-11-13T06:20:21Z",
        "amount_refunded": 0,
        "locale": "en",
        "refunds": [

        ],
        "refund_requests": [

        ]
      },
      "created_at": "2018-11-13T06:20:21Z"
    }
  ]
}

パラメータ

名前 説明
page
任意

Page number to query for.

per_page
任意

How many complete objects per page.

>>>

View an event given an id. Event ids can be saved from a webhook or found by querying all events.

サンプル

  • cURL
  • Node.js
  • Ruby
curl -X GET https://komoju.com/api/v1/events/bmon6b8awbd5wftxlpjxzpjte \
  -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/events/bmon6b8awbd5wftxlpjxzpjte',
  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/events/bmon6b8awbd5wftxlpjxzpjte')
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": "bmon6b8awbd5wftxlpjxzpjte",
  "type": "payment.captured",
  "resource": "event",
  "data": {
    "id": "2g1ret84tfvgi7aii057prbeo",
    "resource": "payment",
    "status": "captured",
    "amount": 300,
    "tax": 30,
    "customer": null,
    "payment_deadline": "2018-11-20T14:59:59Z",
    "payment_details": {
      "type": "credit_card",
      "email": "gordon@example.com",
      "brand": "visa",
      "last_four_digits": "1111",
      "month": 3,
      "year": 2019
    },
    "payment_method_fee": 0,
    "total": 330,
    "currency": "JPY",
    "description": null,
    "captured_at": "2018-11-11T14:59:59Z",
    "external_order_num": "ORDER5",
    "metadata": {
    },
    "created_at": "2018-11-13T06:20:21Z",
    "amount_refunded": 0,
    "locale": "en",
    "refunds": [

    ],
    "refund_requests": [

    ]
  },
  "created_at": "2018-11-13T06:20:21Z"
}