POST /api/v1/payments/:id/capture
Capture Payments

Captures a payment. Only works on payments with a payment_type of "credit_card".

サンプル

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/an707r5zejhfzp9y58ctqn2um/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/an707r5zejhfzp9y58ctqn2um/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/an707r5zejhfzp9y58ctqn2um/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": "an707r5zejhfzp9y58ctqn2um",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 100,
  "customer": null,
  "payment_deadline": "2020-06-24T14:59:59Z",
  "payment_details": {
    "type": "credit_card",
    "email": "test@example.com",
    "brand": "visa",
    "last_four_digits": "1111",
    "month": 1,
    "year": 2025
  },
  "payment_method_fee": 0,
  "total": 1100,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-09T07:42:04Z",
  "external_order_num": "123",
  "metadata": {
    "foobar": "hoge"
  },
  "created_at": "2020-06-09T07:42:03Z",
  "amount_refunded": 0,
  "locale": "ja",
  "refunds": [

  ],
  "refund_requests": [

  ]
}