Update a payment

サンプル

  • cURL
  • Node.js
  • Ruby
curl -X PATCH https://komoju.com/api/v1/payments/0jukv29k8px7fuykd6z89321k \
  -u sk_123456: \
  -d "description=updated description" \
  -d "metadata[updated]=metadata" 
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var patch_data = querystring.stringify({
  'description': 'updated description',
  'metadata[updated]': 'metadata'
});

var patch_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/0jukv29k8px7fuykd6z89321k',
  method: 'PATCH',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(patch_data)
  }
};

var patch_req = https.request(patch_options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log(chunk);
    });
});

patch_req.write(patch_data);
patch_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/0jukv29k8px7fuykd6z89321k')
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}"
}

body = {
  description: "updated description",
  metadata: {
    updated: "metadata"
  }
}

res = https.patch(
  uri.path,
  body.to_json,
  headers
)

puts res.body
{
  "id": "0jukv29k8px7fuykd6z89321k",
  "resource": "payment",
  "status": "pending",
  "amount": 300,
  "tax": 30,
  "customer": null,
  "payment_deadline": "2018-11-16T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "gordon@example.com",
    "store": "family-mart",
    "confirmation_code": "1111",
    "receipt": "12345",
    "instructions_url": "https://komoju.com/en/instructions/0jukv29k8px7fuykd6z89321k"
  },
  "payment_method_fee": 0,
  "total": 330,
  "currency": "JPY",
  "description": "updated description",
  "captured_at": null,
  "external_order_num": "ORDER2",
  "metadata": {
    "updated": "metadata"
  },
  "created_at": "2018-11-13T06:20:21Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [

  ]
}

パラメータ

名前 説明
description
任意
Plaintext description for annotating a resource.
metadata
任意
A set of key-value pairs