Skip to main content
POST
/
v2
/
payments
curl -X POST https://sandbox-orchestration.zafapay.com/v2/payments \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "jpy",
    "capture_method": "automatic",
    "external_id": "order_12345"
  }'
{
  "id": "txn_abc123",
  "status": "pending",
  "amount": 1000,
  "currency": "jpy",
  "client_secret": "pi_xxx_secret_yyy",
  "created_at": "2024-01-15T10:30:00Z"
}

概要

カード決済はカード入力フォームを使った決済フローです。 APIで決済を作成後、client_secretを使ってフロントエンドで決済を確定します。

決済フロー

1

決済作成

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

カード情報入力

カード入力フォームを表示
3

決済確定

client_secretを使って決済を確定
4

結果確認

決済取得APIでステータスを確認

リクエスト

amount
number
required
決済金額(正の整数)
currency
string
default:"jpy"
3文字の通貨コード(例: jpy, usd, sgd
capture_method
string
default:"automatic"
キャプチャ方式
  • automatic: 即時決済
  • manual: オーソリのみ(後でキャプチャ)
return_url
string
3Dセキュア認証後のリダイレクトURL
external_id
string
加盟店側の注文ID
metadata
object
トランザクションに保存する追加データ

レスポンス

id
string
トランザクションID(txn_プレフィックス)
status
string
ステータス(pending
amount
number
決済金額
currency
string
通貨コード
client_secret
string
フロントエンドで決済確定に使用するシークレット
created_at
string
作成日時(ISO 8601形式)

フロントエンド実装

client_secretを使って決済を確定します。
// 決済確定の例
const { error, paymentIntent } = await confirmCardPayment(
  client_secret,
  {
    payment_method: {
      card: cardElement,
    }
  }
);

if (error) {
  console.error(error.message);
} else if (paymentIntent.status === 'succeeded') {
  console.log('決済完了');
}
curl -X POST https://sandbox-orchestration.zafapay.com/v2/payments \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "jpy",
    "capture_method": "automatic",
    "external_id": "order_12345"
  }'
{
  "id": "txn_abc123",
  "status": "pending",
  "amount": 1000,
  "currency": "jpy",
  "client_secret": "pi_xxx_secret_yyy",
  "created_at": "2024-01-15T10:30:00Z"
}