POST /api/v1/payments/:id/refund_request
Refund Request Payments

Refund requests can be used for payment methods that do not support refunds e.g. cash-based payment methods like Convenience Store, Bank Transfer, etc.

This provides an alternative refund option for cash based payments through a bank transfer.

サンプル

  • cURL
  • Node.js
  • Ruby
curl -X POST https://komoju.com/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request \
  -u sk_123456: \
  -d "account_number=1234567" \
  -d "account_type=normal" \
  -d "amount=1000" \
  -d "bank_code=1234" \
  -d "bank_name=KOMOJU BANK" \
  -d "branch_number=123" \
  -d "branch_name=KOMOJU BRANCH" \
  -d "customer_name=John Doe" \
  -d "include_payment_method_fee=true" 
var querystring = require('querystring');
var https = require('https');
var secret_key = 'sk_123456'
var auth = 'Basic ' + Buffer.from(secret_key + ':').toString('base64');
var post_data = querystring.stringify({
  'account_number': '1234567',
  'account_type': 'normal',
  'amount': '1000',
  'bank_code': '1234',
  'bank_name': 'KOMOJU BANK',
  'branch_number': '123',
  'branch_name': 'KOMOJU BRANCH',
  'customer_name': 'John Doe',
  'include_payment_method_fee': 'true'
});

var post_options = {
  host: 'komoju.com',
  port: '443',
  path: '/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request',
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Length': Buffer.byteLength(post_data)
  }
};

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

post_req.write(post_data);
post_req.end();
require 'uri'
require 'net/https'
require 'json'
require 'base64'
require 'pp'
uri = URI.parse('https://komoju.com/api/v1/payments/7czbdbavjdbl3jjkrd7c65wi5/refund_request')
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 = {
  account_number: "1234567",
  account_type: "normal",
  amount: "1000",
  bank_code: "1234",
  bank_name: "KOMOJU BANK",
  branch_number: "123",
  branch_name: "KOMOJU BRANCH",
  customer_name: "John Doe",
  include_payment_method_fee: "true"
}

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

puts res.body
{
  "id": "7czbdbavjdbl3jjkrd7c65wi5",
  "resource": "payment",
  "status": "captured",
  "amount": 1000,
  "tax": 0,
  "customer": null,
  "payment_deadline": "2020-06-12T14:59:59Z",
  "payment_details": {
    "type": "konbini",
    "email": "gordon@example.com",
    "store": "circle-k",
    "confirmation_code": null,
    "receipt": "12345",
    "instructions_url": "https://komoju.com/en/instructions/7czbdbavjdbl3jjkrd7c65wi5"
  },
  "payment_method_fee": 0,
  "total": 1000,
  "currency": "JPY",
  "description": null,
  "captured_at": "2020-06-07T14:59:59Z",
  "external_order_num": "ORDER4",
  "metadata": {
  },
  "created_at": "2020-06-09T07:41:58Z",
  "amount_refunded": 0,
  "locale": "en",
  "refunds": [

  ],
  "refund_requests": [
    {
      "id": "4f1jtn1rafgrrg9t23waobawp",
      "payment": "7czbdbavjdbl3jjkrd7c65wi5",
      "customer_name": "John Doe",
      "bank_code": "1234",
      "bank_name": "KOMOJU BANK",
      "branch_number": "123",
      "branch_name": "KOMOJU BRANCH",
      "account_number": "1234567",
      "status": "pending",
      "created_at": "2020-06-09T07:41:58Z"
    }
  ]
}

パラメータ

名前 説明
amount
必須

The amount to be charged before tax. Must be equal or greater than 0. Use a ‘.’ as a decimal separator, and no thousands separator.

customer_name
必須

The name of the customer.

bank_code
必須

The bank number.

bank_name
必須

The name of the bank.

branch_number
必須

The bank branch number.

branch_name
必須

The name of the bank branch.

account_type
必須

Bank account type normal or checking

account_number
必須

Bank account number.

include_payment_method_fee
必須

Whether or not to refund the payment's paymentmethodfee (also known as customer fee or kiosk fee). This fee is charged to customers for some payment methods e.g. Konbini, PayEasy, Bank Transfer, etc. Please note that when true the paymentmethodfee will be charged to your account.

description
任意

Plaintext description for annotating a resource.