Docs
DocsAPI ExplorerChangelog

Chargeback Management API

Updated on November 24, 2026
View as Markdown

The Chargeback Management API lets merchants programmatically retrieve, manage, and respond to chargebacks. It replaces manual workflows (email or the chargeback portal) so you can integrate chargeback handling directly into your own internal systems.

To automate chargeback handling in real time, subscribe to chargeback webhooks to be notified whenever a chargeback is created or changes status, and then call the Chargeback Management API to fetch full chargeback details and submit your response.

This guide covers:

  • Receiving chargeback notifications with webhooks (chargeback_request.* events) and retrieving full details via the API
  • GET /api/v1/chargeback_requests — list chargeback requests
  • GET /api/v1/chargeback_requests/{id} — get a chargeback request's details
  • POST /api/v1/chargeback_requests/{id}/accept — accept a chargeback
  • POST /api/v1/chargeback_requests/{id}/defend — defend a chargeback
Caution

Feature gate

All chargeback endpoints and chargeback_request.* webhook events are guarded by chargeback feature enablement for your merchant account. If the feature is not enabled, the API endpoints return 404 Not Found and chargeback webhook events are not available in the dashboard. Contact KOMOJU support to enable it.

Authentication

Use your merchant secret key with Authentication. Send the secret key as the HTTP Basic Auth username and leave the password blank. You can find your secret key on the API key page of your merchant dashboard.

Shell
curl -u YOUR_SECRET_KEY: \
  https://komoju.com/api/v1/chargeback_requests

Common behavior

  • Date/time inputs must be ISO 8601 date-time strings (for example 2026-05-01T00:00:00Z).
  • List endpoints use the standard pagination format: resource, total, page, per_page, last_page, data.
  • per_page defaults to 10, with a maximum of 100.

Chargeback statuses

StatusDescription
pendingAwaiting your response (accept or defend).
acceptedYou accepted the chargeback.
defendedYou submitted a defense.
cancelledThe chargeback was cancelled.
expiredThe response window passed without a response.
lostThe chargeback was decided against you.

Receiving chargeback notifications with webhooks

Instead of polling the API for new disputes, use Webhooks to receive real-time notifications when a chargeback request is created or transitions to a new status.

Because webhook deliveries contain a summary of the chargeback request (the same fields returned by List chargeback requests), the recommended integration flow is:

  1. Subscribe to chargeback webhook events in your KOMOJU Merchant Dashboard.
  2. Receive and verify the webhook on your server, check type (or X-Komoju-Event), extract the chargeback request ID (data.id), and respond with 200 OK.
  3. Retrieve full chargeback details by calling GET /api/v1/chargeback_requests/{id} with data.id to obtain the complete record (timeline, detailed payment information, customer details, last_updated_at, and any defense data).
  4. Respond to the chargeback (for pending chargebacks before due_date) using Accept a chargeback request or Defend a chargeback request.

Setting up chargeback webhooks

  1. Open your KOMOJU Merchant Dashboard and go to Manage → Webhooks.
  2. Create a new webhook (or edit an existing one) with your HTTPS endpoint URL and a secret token for signature verification.
  3. Under the Chargeback Request event group, enable the events you want to receive (at minimum chargeback_request.pending for newly created chargebacks).
  4. Save the webhook. KOMOJU sends a ping event so you can verify connectivity.
Note

Availability

  • The Chargeback Request webhook event group only appears when Chargeback Management is enabled for your merchant account.
  • Chargeback events are not supported for per-payment webhooks or Platform Model (Platform merchant / Account Group parent) webhooks.
  • Deadline reminders (sent 24 hours before due_date) are delivered by email only and do not emit a webhook event.

Chargeback webhook events

EventDescription
chargeback_request.pendingA chargeback request has been created and is awaiting your response.
chargeback_request.acceptedA chargeback request has been accepted.
chargeback_request.defendedA defense has been submitted for a chargeback request.
chargeback_request.cancelledA chargeback request has been cancelled.
chargeback_request.expiredA chargeback request has expired without a response before its due date.
chargeback_request.lostA defended chargeback request has been decided against you.

Example webhook delivery

When a chargeback event occurs, KOMOJU sends an HTTP POST request to your webhook URL. For full details on headers, signature verification, and retry behavior, see the Webhooks guide.

HTTP headers

HeaderDescription
X-Komoju-IDUnique ID of the webhook delivery.
X-Komoju-SignatureSHA-256 HMAC hex digest of the raw request body computed using your webhook secret token.
X-Komoju-EventEvent name (for example chargeback_request.pending).
User-AgentKomoju-Webhook
Content-Typeapplication/json

Example request

HTTP
POST /webhooks/komoju HTTP/1.1
Host: example.com
X-Komoju-ID: 6cul2yma626autvvxz2xre1qr
X-Komoju-Signature: 75e653443e6543ee4c4b0665c73a4818216c9464f4a3ac959bff5ebafc105693
X-Komoju-Event: chargeback_request.pending
User-Agent: Komoju-Webhook
Content-Type: application/json

{
  "id": "dv7ywuavew3n2meqsllj5bbob",
  "type": "chargeback_request.pending",
  "resource": "event",
  "data": {
    "id": "igqcsinacgl9iwz7ii3bknwpr",
    "payment_id": "enj2pugqquwjlb1slvk3pikr8",
    "amount": 1000,
    "currency": "JPY",
    "payment_method": {
      "type": "credit_card",
      "brand": "visa",
      "last_four_digits": "4242"
    },
    "reason_code": "CB_Fraud",
    "reason": "Fraud",
    "created_at": "2026-05-06T02:49:18Z",
    "due_date": "2026-05-22T02:49:18Z",
    "status": "pending"
  },
  "created_at": "2026-05-06T02:49:18Z",
  "reason": null
}

Retrieving chargeback details after receiving a webhook

The webhook's data object gives you the key summary attributes (id, payment_id, amount, currency, payment_method, reason_code, reason, created_at, due_date, status), which is enough to identify the dispute and alert your system.

To inspect the complete chargeback record — including last_updated_at, timeline, full payment details (created_at, captured_at, masked_card_number), customer contact information, and any submitted defense details — verify the webhook signature and pass data.id to Get a chargeback request:

1. Verify the webhook and extract data.id

Verify X-Komoju-Signature against the raw, unmodified request body before trusting the payload, then enqueue background processing with data.id and return 200 OK:

Ruby
require "json"
require "openssl"
require "sinatra"

WEBHOOK_SECRET_TOKEN = ENV.fetch("KOMOJU_WEBHOOK_SECRET_TOKEN")

post "/webhooks/komoju" do
  raw_body = request.body.read
  expected_signature = OpenSSL::HMAC.hexdigest("sha256", WEBHOOK_SECRET_TOKEN, raw_body)
  received_signature = request.env["HTTP_X_KOMOJU_SIGNATURE"].to_s

  halt 400 unless Rack::Utils.secure_compare(expected_signature, received_signature)

  event = JSON.parse(raw_body)

  if event["type"].start_with?("chargeback_request.")
    chargeback_id = event.dig("data", "id")
    # Enqueue an async job to fetch full details via GET /api/v1/chargeback_requests/{id}
    SyncChargebackJob.perform_later(chargeback_id: chargeback_id, event_id: event["id"])
  end

  status 200
end

2. Fetch full chargeback details from the API

Using the chargeback_id (data.id, for example igqcsinacgl9iwz7ii3bknwpr) extracted from the webhook payload, call GET /api/v1/chargeback_requests/{id} with your merchant secret key:

Shell
curl -X GET "https://komoju.com/api/v1/chargeback_requests/igqcsinacgl9iwz7ii3bknwpr" \
  -u YOUR_SECRET_KEY: \
  -H "Content-Type: application/json"

This returns the full chargeback detail object (see Get a chargeback request for the complete response schema), reflecting the latest status on KOMOJU even if multiple webhook events were delivered out of order.

Note

Webhook best practices

  • Respond quickly and fetch asynchronously: KOMOJU enforces a 5-second timeout on webhook deliveries. Acknowledge the webhook with a 2xx status as soon as the signature is verified and enqueue the API call in a background job.
  • Handle retries idempotently: If your endpoint does not return a 2xx status or times out, KOMOJU retries delivery up to 25 times over 25 days. Deduplicate using the event id or X-Komoju-ID header.
  • Reconcile with the list endpoint if needed: As a safety net for missed notifications or downtime, you can periodically query GET /api/v1/chargeback_requests?status=pending to check for open chargebacks requiring action.

List chargeback requests

Retrieves a paginated list of chargeback requests for the authenticated merchant.

AuthenticationMethodEndpoint
Secret keyGEThttps://komoju.com/api/v1/chargeback_requests

Returns 200 OK on success.

Query ParameterTypeDescription
statusstringFilter by status. One of pending, accepted, cancelled, expired, defended, lost.
payment_idstringFilter by the associated payment ID.
start_timestring date-timeLower bound (inclusive) on the chargeback's created time.
end_timestring date-timeUpper bound (inclusive) on the chargeback's created time.
due_date_startstring date-timeLower bound (inclusive) on the chargeback's due date.
due_date_endstring date-timeUpper bound (inclusive) on the chargeback's due date.
per_pageintegerResults per page. Defaults to 10, max 100.
pageintegerPage number. Defaults to 1.
Note

Ordering

Results are returned with pending chargebacks first, followed by non-pending chargebacks. There is no request sort parameter.

Example request

Shell
curl -X GET "https://komoju.com/api/v1/chargeback_requests?status=pending&start_time=2026-05-01T00:00:00Z&end_time=2026-05-31T23:59:59Z&per_page=10&page=1" \
  -u YOUR_SECRET_KEY: \
  -H "Content-Type: application/json"

Example response

JSON
{
  "resource": "list",
  "total": 2,
  "page": 1,
  "per_page": 10,
  "last_page": 1,
  "data": [
    {
      "id": "igqcsinacgl9iwz7ii3bknwpr",
      "payment_id": "enj2pugqquwjlb1slvk3pikr8",
      "amount": 1000,
      "currency": "JPY",
      "payment_method": {
        "type": "credit_card",
        "brand": "visa",
        "last_four_digits": "4242"
      },
      "reason_code": "CB_Fraud",
      "reason": "Fraud",
      "created_at": "2026-05-06T02:49:18Z",
      "due_date": "2026-05-22T02:49:18Z",
      "status": "pending"
    }
  ]
}

Get a chargeback request

Retrieves the details of a single chargeback request, including its timeline, payment, customer, and defense (if one exists).

AuthenticationMethodEndpoint
Secret keyGEThttps://komoju.com/api/v1/chargeback_requests/{id}

Returns 200 OK on success.

Path ParameterTypeDescription
idstringThe chargeback request UUID.

Example request

Shell
curl -X GET "https://komoju.com/api/v1/chargeback_requests/igqcsinacgl9iwz7ii3bknwpr" \
  -u YOUR_SECRET_KEY: \
  -H "Content-Type: application/json"

Example response

JSON
{
  "id": "2sqtcy1hpq0y3f3sos0l1zrww",
  "status": "defended",
  "reason_code": "CB_Fraud",
  "reason": "Fraud / Unauthorized Transaction",
  "created_at": "2026-05-28T04:21:21Z",
  "due_date": "2026-06-07T14:59:59Z",
  "last_updated_at": "2026-05-28T04:59:18Z",
  "timeline": [
    {
      "type": "created",
      "occurred_at": "2026-05-28T04:21:21Z"
    },
    {
      "type": "defended",
      "occurred_at": "2026-05-28T04:59:18Z"
    },
    {
      "type": "response_due",
      "occurred_at": "2026-06-07T14:59:59Z"
    }
  ],
  "payment": {
    "id": "7zk4ecpe4xbzzoyhyzd5hszus",
    "amount": 1864,
    "currency": "JPY",
    "created_at": "2026-04-23T02:18:57Z",
    "captured_at": "2026-04-23T02:18:57Z",
    "payment_method": {
      "type": "web_money",
      "brand": null,
      "last_four_digits": null
    },
    "masked_card_number": null
  },
  "customer": {
    "name": "freeman gordon",
    "email": "gordon@example.com"
  },
  "defense": {
    "product_name": "Premium Plan",
    "reason": "Customer received the product as agreed.",
    "shipping_info": {
      "company_name": "DHL",
      "shipping_date": "2026-05-20",
      "tracking_number": "TRACK-12345",
      "shipping_address": "1-2-3 Tokyo"
    },
    "recipient_info": {
      "name": "Jane Doe",
      "phone": "090-1234-5678",
      "email": "jane@example.com"
    },
    "documents": [
      {
        "file_name": "evidence.pdf",
        "content_type": "application/pdf",
        "file_size": 63,
        "uploaded_at": "2026-05-28T04:59:18Z",
        "url": "https://example-uploads.s3.ap-northeast-1.amazonaws.com/chargeback_defense/...pdf"
      }
    ]
  }
}

When a defense exists, the defense object contains:

AttributeDescription
product_nameName of the product or service.
reasonThe merchant's defense reason.
shipping_infocompany_name, shipping_date, tracking_number, shipping_address.
recipient_infoname, phone, email.
documentsArray of file_name, content_type, file_size, uploaded_at, url.

Accept a chargeback request

Accepts a chargeback, agreeing to the dispute. This endpoint takes no request body and returns 204 No Content (empty body) on success.

AuthenticationMethodEndpoint
Secret keyPOSThttps://komoju.com/api/v1/chargeback_requests/{id}/accept
Caution

Rules

  • You can only accept a chargeback while its status is pending.
  • If the due date has passed, the request returns an error.
  • Accepting an already-accepted chargeback returns 204 (idempotent).

Example request

Shell
curl -X POST "https://komoju.com/api/v1/chargeback_requests/igqcsinacgl9iwz7ii3bknwpr/accept" \
  -u YOUR_SECRET_KEY: \
  -H "Content-Type: application/json"

Defend a chargeback request

Submits a defense against a chargeback, including supporting documentation. Returns 204 No Content (empty body) on success.

AuthenticationMethodEndpoint
Secret keyPOSThttps://komoju.com/api/v1/chargeback_requests/{id}/defend

* = required

Request AttributeTypeDescription
description *stringExplanation of your defense.
document *objectSupporting document. See below.
product_namestringName of the product or service.
shipping_infoobjectcompany_name, shipping_date (e.g. 2026-05-20), tracking_number, shipping_address.
recipient_infoobjectname, phone, email.

The document object:

Request AttributeTypeDescription
document_base64 *stringBase64-encoded file contents.
filenamestringOriginal file name.
content_typestringMIME type of the file.
Note

Document requirements

  • The base64 payload must be 15 MB or less.
  • Supported types: PDF, JPG/JPEG, PNG, GIF.
  • The file type is inferred from the file's bytes, not the filename. Other types are rejected with a validation error.

Example request

Shell
curl -X POST "https://komoju.com/api/v1/chargeback_requests/igqcsinacgl9iwz7ii3bknwpr/defend" \
  -u YOUR_SECRET_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "product_name": "Premium Plan",
    "description": "Customer received the product as agreed.",
    "document": {
      "document_base64": "JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCiUlRU9G",
      "filename": "evidence.pdf",
      "content_type": "application/pdf"
    },
    "shipping_info": {
      "company_name": "DHL",
      "shipping_date": "2026-05-20",
      "tracking_number": "TRACK-12345",
      "shipping_address": "1-2-3 Tokyo"
    },
    "recipient_info": {
      "name": "Jane Doe",
      "phone": "090-1234-5678",
      "email": "jane@example.com"
    }
  }'
Caution

Rules

  • You can only defend a chargeback while its status is pending.
  • If the due date has passed, the request returns an error.
  • Defending an already-defended chargeback returns 204 (idempotent).
  • Duplicate defenses are prevented; only one defense can be created per chargeback request.

Errors

Chargeback endpoints return standard API error objects. Common cases:

StatusWhen
401 UnauthorizedThe secret key is missing or invalid.
404 Not FoundThe feature is disabled for your merchant, or the chargeback ID does not exist for the authenticated merchant.
400 Bad RequestOnly pending chargebacks can be accepted. / Only pending chargebacks can be defended. / Chargeback due date has passed and can no longer be responded to. / invalid or oversized base64 document payload.
422 Unprocessable EntityMissing required defend parameters (for example description or document), or invalid date-time format in query params.

Error body shape

JSON
{
  "error": {
    "code": "bad_request",
    "message": "Only pending chargebacks can be defended.",
    "param": null,
    "details": {}
  }
}
Was this page helpful?

Page Navigation

Ctrl←Ctrl→Ctrl↑Ctrl↓