Payment
Payment
決済処理を管理する Feature
概要
Payment は Stripe を利用した決済処理を提供する。支払いの作成・確認・キャンセル、顧客管理、Webhook 処理をサポートする。
API
Handler
| 関数 | 説明 |
|---|---|
createPayment(client, input) | 支払いを作成 |
confirmPayment(client, input) | 支払いを確認 |
cancelPayment(client, input) | 支払いをキャンセル |
retrievePayment(client, input) | 支払いを取得 |
createCustomer(input) | 顧客を作成 |
deleteCustomer(input) | 顧客を削除 |
handleWebhook(client, input) | Webhook イベントを処理 |
Service
| 関数 | 説明 |
|---|---|
createPayment(client, input) | 支払い作成処理 |
confirmPayment(client, input) | 支払い確認処理 |
cancelPayment(client, input) | キャンセル処理 |
retrievePayment(client, input) | 支払い取得処理 |
createCustomer(input) | 顧客作成処理 |
deleteCustomer(input) | 顧客削除処理 |
handleWebhook(client, input) | Webhook 処理 |
Schema
| スキーマ | 型 | 説明 |
|---|---|---|
PaymentStatusSchema | "requires_payment_method" | "requires_confirmation" | "requires_action" | "processing" | "succeeded" | "canceled" | 支払いステータス |
PaymentSchema | Payment | 支払い |
CreatePaymentInputSchema | CreatePaymentInput | 支払い作成入力 |
ConfirmPaymentInputSchema | ConfirmPaymentInput | 支払い確認入力 |
CancelPaymentInputSchema | CancelPaymentInput | キャンセル入力 |
RetrievePaymentInputSchema | RetrievePaymentInput | 支払い取得入力 |
CustomerSchema | Customer | 顧客 |
CreateCustomerInputSchema | CreateCustomerInput | 顧客作成入力 |
DeleteCustomerInputSchema | DeleteCustomerInput | 顧客削除入力 |
WebhookEventSchema | WebhookEvent | Webhook イベント |
HandleWebhookInputSchema | HandleWebhookInput | Webhook 入力 |
サブフィーチャー
- Billing — 請求書管理
- Refund — 返金処理
- Subscription — サブスクリプション管理
- Wallet — 支払い方法管理
使用例
import { Payment } from "@unitto/features";
// 支払い作成
const payment = await Payment.Handler.createPayment(client, {
amount: 1000,
currency: "jpy",
customerId: "cus_xxx",
});
// 支払い確認
await Payment.Handler.confirmPayment(client, {
paymentId: payment.id,
});