PaymentProcessor
The new payment service plugin interface This work is still experimental and can be changed until it becomes stable
Methods
authorizePayment
**authorizePayment**(paymentSessionData, context): Promise<[PaymentProcessorError](/references/services/interfaces/PaymentProcessorError) \| { data: Record<string, unknown> ; status: [PaymentSessionStatus](/references/services/enums/PaymentSessionStatus) }>
Authorize an existing session if it is not already authorized
Parameters
paymentSessionData
Record<string, unknown>Requiredcontext
Record<string, unknown>RequiredReturns
Promise<PaymentProcessorError | { data: Record<string, unknown> ; status: PaymentSessionStatus }>
Promise
Promise<PaymentProcessorError | { data: Record<string, unknown> ; status: PaymentSessionStatus }>RequiredcancelPayment
**cancelPayment**(paymentSessionData): Promise<Record<string, unknown> \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)>
Cancel an existing session
Parameters
paymentSessionData
Record<string, unknown>RequiredReturns
Promise<Record<string, unknown> | PaymentProcessorError>
capturePayment
**capturePayment**(paymentSessionData): Promise<Record<string, unknown> \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)>
Capture an existing session
Parameters
paymentSessionData
Record<string, unknown>RequiredReturns
Promise<Record<string, unknown> | PaymentProcessorError>
deletePayment
**deletePayment**(paymentSessionData): Promise<Record<string, unknown> \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)>
Delete an existing session
Parameters
paymentSessionData
Record<string, unknown>RequiredReturns
Promise<Record<string, unknown> | PaymentProcessorError>
getIdentifier
**getIdentifier**(): string
Return a unique identifier to retrieve the payment plugin provider
Returns
string
string
stringgetPaymentStatus
**getPaymentStatus**(paymentSessionData): Promise<[PaymentSessionStatus](/references/services/enums/PaymentSessionStatus)>
Return the status of the session
Parameters
paymentSessionData
Record<string, unknown>RequiredReturns
Promise<PaymentSessionStatus>
initiatePayment
**initiatePayment**(context): Promise<[PaymentProcessorError](/references/services/interfaces/PaymentProcessorError) \| [PaymentProcessorSessionResponse](/references/services/types/PaymentProcessorSessionResponse)>
Initiate a payment session with the external provider
Parameters
Returns
Promise<PaymentProcessorError | PaymentProcessorSessionResponse>
refundPayment
**refundPayment**(paymentSessionData, refundAmount): Promise<Record<string, unknown> \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)>
Refund an existing session
Parameters
paymentSessionData
Record<string, unknown>RequiredrefundAmount
numberRequiredReturns
Promise<Record<string, unknown> | PaymentProcessorError>
retrievePayment
**retrievePayment**(paymentSessionData): Promise<Record<string, unknown> \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)>
Retrieve an existing session
Parameters
paymentSessionData
Record<string, unknown>RequiredReturns
Promise<Record<string, unknown> | PaymentProcessorError>
updatePayment
**updatePayment**(context): Promise<void \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError) \| [PaymentProcessorSessionResponse](/references/services/types/PaymentProcessorSessionResponse)>
Update an existing payment session
Parameters
Returns
Promise<void | PaymentProcessorError | PaymentProcessorSessionResponse>
updatePaymentData
**updatePaymentData**(sessionId, data): Promise<Record<string, unknown> \| [PaymentProcessorError](/references/services/interfaces/PaymentProcessorError)>
Update the session data for a payment session
Parameters
sessionId
stringRequireddata
Record<string, unknown>RequiredReturns
Promise<Record<string, unknown> | PaymentProcessorError>