Forge Docs
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"支払いステータス
PaymentSchemaPayment支払い
CreatePaymentInputSchemaCreatePaymentInput支払い作成入力
ConfirmPaymentInputSchemaConfirmPaymentInput支払い確認入力
CancelPaymentInputSchemaCancelPaymentInputキャンセル入力
RetrievePaymentInputSchemaRetrievePaymentInput支払い取得入力
CustomerSchemaCustomer顧客
CreateCustomerInputSchemaCreateCustomerInput顧客作成入力
DeleteCustomerInputSchemaDeleteCustomerInput顧客削除入力
WebhookEventSchemaWebhookEventWebhook イベント
HandleWebhookInputSchemaHandleWebhookInputWebhook 入力

サブフィーチャー

使用例

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,
});

On this page