BasePaymentAdapter
Base class for in-process payment providers.
import { BasePaymentAdapter } from "@evolve-framework/commercetools/payments";new BasePaymentAdapter(clientFactory: ClientFactory)| Method | Description |
|---|---|
init(): Promise<void> | One-shot, idempotent initialization (build SDK clients, etc.). |
getRoutes(): ((app: FastifyInstance) => void) | undefined | Provider-specific external routes to publish when this adapter is hosted as a service — principally the webhook endpoint the PSP calls with async payment updates, plus any redirect-return routes. |
getPaymentMethods(
args: { targetId?: string | undefined; locale: string; targetType: "cart" | "order" | "invoice"; currency: string; country: string; device: "WEB" | "IOS" | "ANDROID"; },
): Promise<PaymentMethod[]> | Resolve the available payment methods for a cart/order. |
createTransaction(
req: { collected?: { currency: string; centAmount: number; } | undefined; customer: { ipAddress: string; }; locale: string; targetId: string; targetType: "cart" | "order" | "invoice"; amount: { currency: string; centAmount: number; }; paymentId: string; paymentMethod: string; paymentMethodArgs: { [x: string]: any; }; successUrl: string; failureUrl: string; },
): Promise<TransactionResponse> | Create (start) a transaction for a payment. |
onOrderCreated(listener: OrderCreatedListener): void | Registers what the adapter calls once an order exists for a cart it settled, or an order it settled was placed before it was paid. |

