Skip to main content
Skip to main content

AbstractPaymentProcessor

Payment processor in charge of creating , managing and processing a payment

Implements

Constructors

constructor

Protected **new AbstractPaymentProcessor**(container, config?)

Parameters

containerMedusaContainerRequired
configRecord<string, unknown>

Properties

configRecord<string, unknown>
containerMedusaContainerRequired
identifierstringRequired

Methods

authorizePayment

Abstract **authorizePayment**(paymentSessionData, context): Promise&#60;[PaymentProcessorError](/references/services/interfaces/PaymentProcessorError) \| &#123; data: Record&#60;string, unknown&#62; ; status: [PaymentSessionStatus](/references/services/enums/PaymentSessionStatus) &#125;&#62;

Authorize an existing session if it is not already authorized

Parameters

paymentSessionDataRecord<string, unknown>Required
contextRecord<string, unknown>Required

Returns

Promise<PaymentProcessorError | { data: Record<string, unknown> ; status: PaymentSessionStatus }>

PromisePromise<PaymentProcessorError | { data: Record<string, unknown> ; status: PaymentSessionStatus }>Required

cancelPayment

Abstract **cancelPayment**(paymentSessionData): Promise&#60;Record&#60;string, unknown&#62; \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)&#62;

Cancel an existing session

Parameters

paymentSessionDataRecord<string, unknown>Required

Returns

Promise<Record<string, unknown> | PaymentProcessorError>

PromisePromise<Record<string, unknown> | PaymentProcessorError>Required

capturePayment

Abstract **capturePayment**(paymentSessionData): Promise&#60;Record&#60;string, unknown&#62; \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)&#62;

Capture an existing session

Parameters

paymentSessionDataRecord<string, unknown>Required

Returns

Promise<Record<string, unknown> | PaymentProcessorError>

PromisePromise<Record<string, unknown> | PaymentProcessorError>Required

deletePayment

Abstract **deletePayment**(paymentSessionData): Promise&#60;Record&#60;string, unknown&#62; \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)&#62;

Delete an existing session

Parameters

paymentSessionDataRecord<string, unknown>Required

Returns

Promise<Record<string, unknown> | PaymentProcessorError>

PromisePromise<Record<string, unknown> | PaymentProcessorError>Required

getIdentifier

**getIdentifier**(): string

Return a unique identifier to retrieve the payment plugin provider

Returns

string

stringstring

getPaymentStatus

Abstract **getPaymentStatus**(paymentSessionData): Promise&#60;[PaymentSessionStatus](/references/services/enums/PaymentSessionStatus)&#62;

Return the status of the session

Parameters

paymentSessionDataRecord<string, unknown>Required

Returns

Promise<PaymentSessionStatus>

PromisePromise<PaymentSessionStatus>Required

initiatePayment

Abstract **initiatePayment**(context): Promise&#60;[PaymentProcessorError](/references/services/interfaces/PaymentProcessorError) \| [PaymentProcessorSessionResponse](/references/services/types/PaymentProcessorSessionResponse)&#62;

Initiate a payment session with the external provider

Parameters

Returns

Promise<PaymentProcessorError | PaymentProcessorSessionResponse>


refundPayment

Abstract **refundPayment**(paymentSessionData, refundAmount): Promise&#60;Record&#60;string, unknown&#62; \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)&#62;

Refund an existing session

Parameters

paymentSessionDataRecord<string, unknown>Required
refundAmountnumberRequired

Returns

Promise<Record<string, unknown> | PaymentProcessorError>

PromisePromise<Record<string, unknown> | PaymentProcessorError>Required

retrievePayment

Abstract **retrievePayment**(paymentSessionData): Promise&#60;Record&#60;string, unknown&#62; \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)&#62;

Retrieve an existing session

Parameters

paymentSessionDataRecord<string, unknown>Required

Returns

Promise<Record<string, unknown> | PaymentProcessorError>

PromisePromise<Record<string, unknown> | PaymentProcessorError>Required

updatePayment

Abstract **updatePayment**(context): Promise&#60;void \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError) \| [PaymentProcessorSessionResponse](/references/services/types/PaymentProcessorSessionResponse)&#62;

Update an existing payment session

Parameters

Returns

Promise<void | PaymentProcessorError | PaymentProcessorSessionResponse>


updatePaymentData

Abstract **updatePaymentData**(sessionId, data): Promise&#60;Record&#60;string, unknown&#62; \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)&#62;

Update the session data for a payment session

Parameters

sessionIdstringRequired
dataRecord<string, unknown>Required

Returns

Promise<Record<string, unknown> | PaymentProcessorError>

PromisePromise<Record<string, unknown> | PaymentProcessorError>Required
Was this section helpful?