PaymentMethodConfigOptions

PaymentMethodConfigOptions

Defines the object which is used to construct the PaymentMethodHandler.

Signature

interface PaymentMethodConfigOptions<T extends PaymentMethodArgs = PaymentMethodArgs> {
  code: string;
  description: string;
  createPayment: CreatePaymentFn<T>;
  args: T;
  onStateTransitionStart?: OnTransitionStartFn<T>;
}

Members

code

property
type:
string

A unique code used to identify this handler.

description

property
type:
string

A human-readable description for the payment method.

createPayment

property
type:
CreatePaymentFn<T>

This function provides the actual logic for creating a payment. For example, it may call out to a third-party service with the data and should return a PaymentConfig object contains the details of the payment.

args

property
type:
T

Optional provider-specific arguments which, when specified, are editable in the admin-ui. Typically args could be used to store an API key for a payment provider service.

Example

args: {
  apiKey: 'string',
}

onStateTransitionStart

property
type:
OnTransitionStartFn<T>

This function, when specified, will be invoked before any transition from one PaymentState to another. The return value (a sync / async boolean) is used to determine whether the transition is permitted.

alpha