GET /api/v1/subscriptions/:id
Show Subscriptions

Show an existing subscription, including its customer and scrubbed payment details.

サンプル

  • cURL
  • Node.js
  • Ruby
curl -X GET https://komoju.com/api/v1/subscriptions/0t8yd4nd2ql5ntq2k9dbe0fdk \
  -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/0t8yd4nd2ql5ntq2k9dbe0fdk',
  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/0t8yd4nd2ql5ntq2k9dbe0fdk')
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": "0t8yd4nd2ql5ntq2k9dbe0fdk",
  "resource": "subscription",
  "status": "pending",
  "amount": 1000,
  "currency": "JPY",
  "customer": {
    "id": 315,
    "uuid": "32vg14fz53dkhqalk1qch6pp4",
    "merchant_id": 2697,
    "created_at": "2020-06-09T16:41:53.021+09:00",
    "updated_at": "2020-06-09T16:41:53.021+09:00",
    "email": "conradschumm@robel.net",
    "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:53Z",
  "ended_at": null,
  "metadata": {
  },
  "payments": [

  ]
}