GET /api/v1/subscriptions
List Subscriptions

List existing subscriptions. Paginates with the usual page, per_page, start_time, and end_time parameters.

サンプル

  • cURL
  • Node.js
  • Ruby
curl -X GET https://komoju.com/api/v1/subscriptions \
  -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/subscriptions',
  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/subscriptions')
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": 3,
  "page": 1,
  "per_page": 10,
  "last_page": 1,
  "data": [
    {
      "id": "64lir0fi5z4xfos9szkth62gx",
      "resource": "subscription",
      "status": "pending",
      "amount": 1000,
      "currency": "JPY",
      "customer": {
        "id": 313,
        "uuid": "95s6o99li80x1a7y9srk1rkcz",
        "merchant_id": 2695,
        "created_at": "2020-06-09T16:41:52.617+09:00",
        "updated_at": "2020-06-09T16:41:52.617+09:00",
        "email": "lance@lemkespinka.com",
        "currency": null,
        "metadata": {
          "order_id": "abcdefg"
        }
      },
      "period": "monthly",
      "day": 9,
      "payment_details": {
        "type": "credit_card",
        "month": "01",
        "year": "2025",
        "email": "test@example.com"
      },
      "retry_count": 0,
      "retry_at": null,
      "next_capture_at": null,
      "created_at": "2020-06-09T07:41:52Z",
      "ended_at": null,
      "metadata": {
      },
      "payments": [

      ]
    },
    {
      "id": "4enivatmtr5l36nd0h8512pm4",
      "resource": "subscription",
      "status": "pending",
      "amount": 1000,
      "currency": "JPY",
      "customer": {
        "id": 313,
        "uuid": "95s6o99li80x1a7y9srk1rkcz",
        "merchant_id": 2695,
        "created_at": "2020-06-09T16:41:52.617+09:00",
        "updated_at": "2020-06-09T16:41:52.617+09:00",
        "email": "lance@lemkespinka.com",
        "currency": null,
        "metadata": {
          "order_id": "abcdefg"
        }
      },
      "period": "monthly",
      "day": 9,
      "payment_details": {
        "type": "credit_card",
        "month": "01",
        "year": "2025",
        "email": "test@example.com"
      },
      "retry_count": 0,
      "retry_at": null,
      "next_capture_at": null,
      "created_at": "2020-06-09T07:41:52Z",
      "ended_at": null,
      "metadata": {
      },
      "payments": [

      ]
    },
    {
      "id": "bf38pyacwtcqm3bem932vyefr",
      "resource": "subscription",
      "status": "pending",
      "amount": 1000,
      "currency": "JPY",
      "customer": {
        "id": 313,
        "uuid": "95s6o99li80x1a7y9srk1rkcz",
        "merchant_id": 2695,
        "created_at": "2020-06-09T16:41:52.617+09:00",
        "updated_at": "2020-06-09T16:41:52.617+09:00",
        "email": "lance@lemkespinka.com",
        "currency": null,
        "metadata": {
          "order_id": "abcdefg"
        }
      },
      "period": "monthly",
      "day": 9,
      "payment_details": {
        "type": "credit_card",
        "month": "01",
        "year": "2025",
        "email": "test@example.com"
      },
      "retry_count": 0,
      "retry_at": null,
      "next_capture_at": null,
      "created_at": "2020-06-09T07:41:52Z",
      "ended_at": null,
      "metadata": {
      },
      "payments": [

      ]
    }
  ]
}

パラメータ

名前 説明
start_time
任意

Query for records created after this time.

end_time
任意

Query for records created before this time.

per_page
任意

How many complete objects per page.

page
任意

Page number to query for.