Skip to main content
POST
/
v1
/
payments
curl -X POST https://api.sandbox.zafapay.com/v1/payments \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 100,
    "currency": "usd"
  }'
{
  "id": "req_abc123",
  "status": "pending",
  "amount": 100,
  "currency": "usd",
  "external_id": "order_12345",
  "metadata": { "customer_name": "山田太郎" },
  "flow_id": "flow_default",
  "payment_url": "https://pay.sandbox.zafapay.com/checkout/req_abc123?token=xxxxxxxx",
  "created_at": "2025-01-01T00:00:00.000Z"
}

概要

カード決済はホスト型チェックアウトを使用します。APIレスポンスのpayment_urlにユーザーをリダイレクトするだけで、カード入力から3Dセキュア認証まで自動的に処理されます。

決済フロー

1

決済作成

APIで決済を作成し、payment_urlを取得
2

リダイレクト

ユーザーをpayment_urlにリダイレクト
3

決済完了

決済完了後、設定済みのsuccess_redirect_urlまたはfailure_redirect_urlに自動リダイレクト

リクエスト

amount
number
required
決済金額(正の数値、小数点以下2桁まで対応。例: 17.62
currency
string
required
3文字の通貨コード(例: usd, sgd, jpy
capture_method
string
キャプチャ方式(省略可)
  • automatic: 即時決済
  • manual: オーソリのみ(後でキャプチャ)
  • 省略時: フローの設定に従う
flow_id
string
決済フローID。省略時は加盟店のデフォルトフローを使用
external_id
string
加盟店側の注文ID
metadata
object
トランザクションに保存する追加データ
customer_id
string
顧客ID。継続決済(リカーリング)でカードを保存・再利用する場合に必須
save_card
boolean
trueの場合、カードを将来の継続決済用に保存します。customer_idと一緒に指定してください
payment_method_id
string
保存済みの決済方法ID(pmi_xxx形式)。継続決済時に使用します。詳細は継続決済ガイドを参照
email
string
顧客のメールアドレス
tel
string
顧客の電話番号
name
string
カード名義人。一部の決済方法では必須

レスポンス

id
string
決済リクエストID(req_プレフィックス)
status
string
ステータス(pending
amount
number
決済金額
currency
string
通貨コード
external_id
string
加盟店側の注文ID(指定した場合)
metadata
object
追加データ(未指定の場合は空オブジェクト)
flow_id
string
使用された決済フローID
payment_url
string
チェックアウトページのURL(署名付き)
created_at
string
作成日時(ISO 8601形式)

実装例

payment_urlにリダイレクトするだけです。
// 決済作成後
const { payment_url } = await createPayment();

// ユーザーをリダイレクト
window.location.href = payment_url;

// 決済完了後、success_redirect_url または failure_redirect_url に
// 自動的にリダイレクトされます
curl -X POST https://api.sandbox.zafapay.com/v1/payments \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 100,
    "currency": "usd"
  }'
{
  "id": "req_abc123",
  "status": "pending",
  "amount": 100,
  "currency": "usd",
  "external_id": "order_12345",
  "metadata": { "customer_name": "山田太郎" },
  "flow_id": "flow_default",
  "payment_url": "https://pay.sandbox.zafapay.com/checkout/req_abc123?token=xxxxxxxx",
  "created_at": "2025-01-01T00:00:00.000Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication using access token

Body

application/json
amount
number
required

Payment amount (positive number, supports up to 2 decimal places)

Example:

17.62

currency
string
required

3-letter currency code (e.g., usd, sgd, jpy)

Example:

"usd"

capture_method
enum<string>

Capture method (uses flow configuration if omitted)

Available options:
automatic,
manual
external_id
string

Merchant's order ID

Example:

"order_12345"

flow_id
string

Flow ID to use (defaults to default flow if omitted)

Example:

"flow_abc123"

payment_method

Payment method (string or object format)

Example:

"card"

metadata
object

Additional data to store with the transaction

save_card
boolean

If true, save card for future recurring payments

Example:

true

payment_method_id
string

Use a saved payment method for recurring payment (get from /v1/customers/{id}/payment-methods)

Example:

"pmi_abc123"

name
string

Cardholder name (required for some payment methods)

Example:

"John Doe"

customer_id
string

Customer ID (used for saving and retrieving payment methods)

Example:

"cust_abc123"

email
string

Customer email address

Example:

"customer@example.com"

tel
string

Customer phone number

Example:

"+81-90-1234-5678"

Response

Payment created successfully

id
string

Payment request ID

Example:

"req_abc123"

status
string

Status

Example:

"pending"

amount
number

Payment amount

Example:

17.62

currency
string

Currency code

Example:

"usd"

external_id
string | null

Merchant's order ID

Example:

"order_12345"

metadata
object

Additional data (empty object if not specified)

Example:
{}
flow_id
string

Payment flow ID used

Example:

"flow_default"

payment_type
enum<string>

Payment type. single: Regular one-time payment, initial: Initial payment with card saving, recurring: Recurring payment using saved card

Available options:
single,
initial,
recurring
Example:

"single"

payment_url
string

Hosted checkout page URL (with signature)

Example:

"https://pay.sandbox.zafapay.com/checkout/req_abc123?token=xxxxxxxx"

created_at
string<date-time>

Creation timestamp (ISO 8601 format)

Example:

"2025-01-01T00:00:00.000Z"