curl -X POST 'https://verification.didit.me/v3/billing/top-up-invoices/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: 0b8e6f4a-3c2d-4e1f-9a7b-5d6c8e2f1a30' \
-d '{
"amount_in_dollars": 5000,
"po_number": "PO-88213"
}'import requests
url = "https://verification.didit.me/v3/billing/top-up-invoices/"
payload = {
"amount_in_dollars": 5000,
"po_number": "PO-88213"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount_in_dollars: 5000, po_number: 'PO-88213'})
};
fetch('https://verification.didit.me/v3/billing/top-up-invoices/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://verification.didit.me/v3/billing/top-up-invoices/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_in_dollars' => 5000,
'po_number' => 'PO-88213'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://verification.didit.me/v3/billing/top-up-invoices/"
payload := strings.NewReader("{\n \"amount_in_dollars\": 5000,\n \"po_number\": \"PO-88213\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://verification.didit.me/v3/billing/top-up-invoices/")
.header("Idempotency-Key", "<idempotency-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount_in_dollars\": 5000,\n \"po_number\": \"PO-88213\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://verification.didit.me/v3/billing/top-up-invoices/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_in_dollars\": 5000,\n \"po_number\": \"PO-88213\"\n}"
response = http.request(request)
puts response.read_body{
"id": "9a4f2c1e-7b3d-4e8a-a1c5-6f0d2b9e8c47",
"lane": "bank_transfer",
"status": "open",
"credit_amount": "5000.00",
"total": "5000.00",
"tax": "0.00",
"currency": "usd",
"amount_received": "0.00",
"amount_credited": "0.00",
"amount_open": "5000.00",
"presented": null,
"method": {
"type": "customer_balance",
"name": "Bank transfer"
},
"invoice_number": "7F3A2C1B-0012",
"hosted_invoice_url": "https://invoice.example.com/i/7F3A2C1B-0012",
"invoice_pdf": "https://invoice.example.com/i/7F3A2C1B-0012/pdf",
"po_number": "PO-88213",
"due_at": "2027-01-14T10:00:00Z",
"confirmed_at": null,
"closed_at": null,
"failure_reason": null,
"created_at": "2026-11-30T10:00:00Z",
"bank_details": {
"currency": "USD",
"amount_due": "5000.00",
"account_holder_name": "Didit",
"bank_name": "Example Bank, N.A.",
"account_number": "000123456789",
"routing_number": "000000000",
"swift_code": "EXAMUS33XXX",
"reference": "7F3A2C1B-0012"
}
}チャージ請求書API:銀行振込で支払う
APIからDiditのチャージ請求書を作成し、45日以内に銀行振込で支払えます。クレジット額は1,000~20,000、振込先情報とPDF付きです。
curl -X POST 'https://verification.didit.me/v3/billing/top-up-invoices/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: 0b8e6f4a-3c2d-4e1f-9a7b-5d6c8e2f1a30' \
-d '{
"amount_in_dollars": 5000,
"po_number": "PO-88213"
}'import requests
url = "https://verification.didit.me/v3/billing/top-up-invoices/"
payload = {
"amount_in_dollars": 5000,
"po_number": "PO-88213"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount_in_dollars: 5000, po_number: 'PO-88213'})
};
fetch('https://verification.didit.me/v3/billing/top-up-invoices/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://verification.didit.me/v3/billing/top-up-invoices/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_in_dollars' => 5000,
'po_number' => 'PO-88213'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://verification.didit.me/v3/billing/top-up-invoices/"
payload := strings.NewReader("{\n \"amount_in_dollars\": 5000,\n \"po_number\": \"PO-88213\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://verification.didit.me/v3/billing/top-up-invoices/")
.header("Idempotency-Key", "<idempotency-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount_in_dollars\": 5000,\n \"po_number\": \"PO-88213\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://verification.didit.me/v3/billing/top-up-invoices/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_in_dollars\": 5000,\n \"po_number\": \"PO-88213\"\n}"
response = http.request(request)
puts response.read_body{
"id": "9a4f2c1e-7b3d-4e8a-a1c5-6f0d2b9e8c47",
"lane": "bank_transfer",
"status": "open",
"credit_amount": "5000.00",
"total": "5000.00",
"tax": "0.00",
"currency": "usd",
"amount_received": "0.00",
"amount_credited": "0.00",
"amount_open": "5000.00",
"presented": null,
"method": {
"type": "customer_balance",
"name": "Bank transfer"
},
"invoice_number": "7F3A2C1B-0012",
"hosted_invoice_url": "https://invoice.example.com/i/7F3A2C1B-0012",
"invoice_pdf": "https://invoice.example.com/i/7F3A2C1B-0012/pdf",
"po_number": "PO-88213",
"due_at": "2027-01-14T10:00:00Z",
"confirmed_at": null,
"closed_at": null,
"failure_reason": null,
"created_at": "2026-11-30T10:00:00Z",
"bank_details": {
"currency": "USD",
"amount_due": "5000.00",
"account_holder_name": "Didit",
"bank_name": "Example Bank, N.A.",
"account_number": "000123456789",
"routing_number": "000000000",
"swift_code": "EXAMUS33XXX",
"reference": "7F3A2C1B-0012"
}
}仕組み
- クレジット残高を取得でクレジットの残高を確認します。
- 必要なクレジット分の請求書を、新しい
Idempotency-Keyを付けて作成します。金額は$1,000から$20,000までです。 bank_detailsに記載の口座にamount_openを振り込みます。振込時の参照番号にはinvoice_numberを使用します。statusがpaidになるか、expiredまたはcancelledとして終了するまで、チャージ用の請求書を取得で状態を確認します。
支払い内容と受け取り内容
amount_in_dollarsは追加するクレジットです。該当する場合は税金が請求書に加算されるため、振込額であるtotalはcredit_amountより高くなることがあります。- 残高に加算されるのは、実際に入金された金額だけです。加算は入金されたタイミングで行われます。
- 一部入金の場合、支払われた
totalの割合に応じてクレジットが加算されます。残りは同じ参照番号のまま未払いの状態で残り、due_atまでが期限です。 due_atは請求書に記載された支払期日で、発行日から45日後です。返された値を使用してください。以前の条件で発行された請求書は、独自の期日を維持します。due_atまでにtotalの全額が入金されなかった場合、請求書はexpiredになります。期限後も参照番号付きで到着した振込については、支払われた金額分が加算されます。routing_numberは ACHおよび米国のワイヤー送金用、swift_codeは国際送金用です。bank_detailsがnullの場合、hosted_invoice_urlに同じ口座情報が表示されます。- 請求先の連絡担当者にも、請求書がメールで届きます。
最初の請求書の前に
- 担当者が、コンソールの請求情報に会社の法的名称と住所を一度保存します。保存するまで、リクエストは
missingフィールドを含む400 billing_details_requiredを返します。 - チャージ用の請求書は、Free、Growth、Scaleの各プランでご利用いただけます。年間のEnterprise契約では
409 top_up_not_allowedが返されます。
冪等性と再試行
- 作成する請求書ごとに
Idempotency-Keyを1つ使用し、保存してください。同じキーは、そのリクエストを再試行する場合に限り再利用します。 - キーがない場合、空白の場合、または255文字を超える場合は、
400 idempotency_key_requiredが返されます。 - 同じキーと金額を同じ認証情報から送信すると、支払い済み、キャンセル済み、期限切れであっても、現在の状態の請求書が返されます。支払い手順を案内するのは、
statusがopenまたはpart_paidで、かつamount_openが0より大きい場合に限ります。 - 同じキーで別の金額を指定した場合、または別の認証情報から送信した場合は、
409 idempotency_key_conflictが返されます。 502 payment_provider_errorは、請求書の状態を確認できなかったことを意味します。同じキーで再試行してください。請求書が発行されていればその請求書が返され、何も発行されていなければ409 top_up_not_completedが返されます。何も発行されていなかった場合にのみ、新しいキーで新しい請求書を作成してください。
同時に保有できる請求書は1件
請求書のステータスがopenまたはpart_paidの間は、新たに請求書を作成すると409 top_up_invoice_openが返され、エラーのopen_invoiceフィールドに既存の請求書が示されます。
未払い分を支払うか、請求書が期限切れになるまで待ってください。
コンソールでユーザーが請求書をキャンセルできるのは、入金が一切ない場合に限られます。
エラー
| HTTP | code | 意味 |
|---|---|---|
| 400 | amount_in_dollars のフィールドエラー | 金額が$1,000を下回る、$20,000を超える、または小数点以下が2桁を超える場合です。 |
| 400 | idempotency_key_required | Idempotency-Key ヘッダーが指定されていない、空白である、または255文字を超えている場合です。 |
| 400 | なし(detail のみ) | リクエスト本文が有効なJSONではありません。 |
| 400 | billing_details_required | 請求書には貴社の正式名称と住所が必要です。missing には不足している項目が一覧で示されます。 |
| 404 | billing_not_available | お客様の組織ではまだ請求機能をご利用いただけません。 |
| 409 | top_up_invoice_open | 別の請求書が未決済または一部入金済みです。open_invoice でその請求書を確認できます。 |
| 409 | idempotency_key_conflict | このキーは別の金額で、または別のAPIキーによって使用されています。 |
| 409 | top_up_not_completed | このキーを使った以前のリクエストでは請求書を発行できませんでした。請求書は発行されていません。新しいキーで新しい請求書を作成してください。 |
| 409 | top_up_not_allowed | Enterpriseプランの年間契約ではチャージできません。 |
| 409 | billing_customer_missing | お客様の組織にはまだ請求アカウントがありません。担当者がコンソールで請求を設定します。 |
| 502 | payment_provider_error | 請求書の状態を確認できませんでした。同じキーで再試行してください。 |
承認
お客様のアプリケーションのAPIキーです。Business Console の Developers -> API keys から取得できます。プライマリーキーはすべてのアクセス権を持ちます。名前付きキーは範囲を制限できます。リソースごとに none、read、write を指定でき、一部のワークフローや承認済みセッションに限定できます。IPアドレスのリストや有効期限も設定できます。401 はキーが誤っている、取り消されている、または期限切れであることを意味します。403 はキーが送信されていない、そのリソースまたはアクションへのアクセス権がない、またはリクエストがIPリストに含まれないアドレスから送信されたことを意味します。セッションのルートでの404 は、セッションがキーのワークフローまたはステータスの範囲外にあることを意味します。メディアへのアクセス権がないキーでは、画像、動画、PDFのURLが null で返されます。セッションの書き込み権限がないキーでは、セッションリンクとトークンが null で返されます。詳しくは https://docs.didit.me/console/api-keys を参照してください。
ヘッダー
ボディ
レスポンス
新規作成された請求書、またはこのキーで既に作成された請求書を、現在の状態で返します。
銀行振込で支払われるチャージ用請求書です。コンソールの「Top up」ダイアログで発行されるものと同じ請求書です。現在の状況を把握するには status と金額を確認してください。タイムスタンプは、イベントが発生した時刻を記録するだけです。
open:振込を待っている状態です。part_paid:total の一部が入金され、その分のクレジットが加算されています。due_at の前に、同じ参照番号を付けて amount_open を送金してください。paid:total が入金され、credit_amount が加算されました。expired:total の全額が入金される前に due_at を過ぎました。入金済みの分は加算されたままです。参照番号を付けた振込が後から届いた場合は、その支払い分が加算されます。cancelled:入金前に、ユーザーがコンソールでキャンセルしました。入金後は請求書をキャンセルできません。failed:請求書を発行できませんでした。何も発行されていません。
open, part_paid, paid, expired, cancelled, failed