API v1 · Test mode
Payment Intents API
外部WebシステムからMOKOクレジット決済を作成できます。APIキーは必ずサーバー側で使用し、ブラウザーへ公開しないでください。
認証
Authorization: Bearer mcs_test_... を送信します。POSTには重複決済防止のため Idempotency-Key が必須です。
POST
/api/v1/payment-intentscurl -X POST https://mokocreditsystem.com/api/v1/payment-intents \
-H "Authorization: Bearer mcs_test_your_key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 01962f88-21b7-7abc-a42d-31c0d808ed4f" \
-d '{
"packageId": "moko-credits-3000",
"customerReference": "customer_123",
"customerEmail": "buyer@example.com"
}'レスポンス
{
"id": "85ed681b-3151-4919-a619-75c15c3bb2a5",
"paymentIntentId": "pi_...",
"clientSecret": "pi_..._secret_...",
"publishableKey": "pk_test_...",
"status": "requires_payment_method"
}GET
/api/v1/payment-intents/:id同じAPIキーを使って、作成した決済の最新状態を取得できます。