Skip to main content
Skip to main content

PaymentService

This will be

Deprecated

in the near future use the new PaymentProcessor interface instead

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

atomicPhase_

Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.

Type Parameters

TResultobjectRequired
TErrorobjectRequired

Parameters

work(transactionManager: EntityManager) => Promise<TResult>Required
the transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>
the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>
Potential error handler

Returns

PromisePromise<TResult>Required
the result of the transactional work

authorizePayment

This will be

Parameters

paymentSessionPaymentSessionRequired
contextDataRequired

Returns

PromisePromise<object>Required

Deprecated

in the near future use PaymentProcessor.authorizePayment instead


cancelPayment

This will be

Parameters

paymentPaymentRequired

Returns

PromisePromise<Data>Required

Deprecated

in the near future use PaymentProcessor.cancelPayment instead


capturePayment

This will be

Parameters

paymentPaymentRequired

Returns

PromisePromise<Data>Required

Deprecated

in the near future use PaymentProcessor.capturePayment instead


createPayment

**createPayment**(context): Promise&#60;[PaymentSessionResponse](/references/medusa/types/medusa.PaymentSessionResponse)&#62;

This will be

Parameters

contextCart & PaymentContextRequired
The type of this argument is meant to be temporary and once the previous method signature will be removed, the type will only be PaymentContext instead of Cart & PaymentContext

Returns

PromisePromise<PaymentSessionResponse>Required

Deprecated

in the near future use PaymentProcessor.initiatePayment instead

**createPayment**(cart): Promise&#60;[Data](/references/medusa/types/medusa.Data)&#62;

This will be

Parameters

cartCartRequired

Returns

PromisePromise<Data>Required

Deprecated

in the near future use createPayment(context: Cart & PaymentContext): Promise<PaymentSessionResponse> instead


deletePayment

This will be

Parameters

paymentSessionPaymentSessionRequired

Returns

PromisePromise<void>Required

Deprecated

in the near future use PaymentProcessor.cancelPayment instead


getIdentifier

Returns

stringstring

getPaymentData

This will be

Parameters

paymentSessionPaymentSessionRequired

Returns

PromisePromise<Data>Required

Deprecated

in the near future use PaymentProcessor.retrievePayment instead


getStatus

This will be

Parameters

dataDataRequired

Returns

PromisePromise<PaymentSessionStatus>Required

Deprecated

in the near future use PaymentProcessor.getPaymentStatus instead


refundPayment

This will be

Parameters

paymentPaymentRequired
refundAmountnumberRequired

Returns

PromisePromise<Data>Required

Deprecated

in the near future use PaymentProcessor.refundPayment instead


retrievePayment

This will be

Parameters

paymentDataDataRequired

Returns

PromisePromise<Data>Required

Deprecated

in the near future use PaymentProcessor.retrievePayment instead


retrieveSavedMethods

This will be

Parameters

customerCustomerRequired

Returns

PromisePromise<Data[]>Required

Deprecated

in the near future use PaymentProcessor.getSavedMethods instead


shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanboolean

updatePayment

**updatePayment**(paymentSessionData, context): Promise&#60;[PaymentSessionResponse](/references/medusa/types/medusa.PaymentSessionResponse) \| [Data](/references/medusa/types/medusa.Data)&#62;

Parameters

paymentSessionDataDataRequired
contextCart & PaymentContextRequired

Returns

PromisePromise<PaymentSessionResponse | Data>Required

**updatePayment**(paymentSessionData, cart): Promise&#60;[Data](/references/medusa/types/medusa.Data)&#62;

This will be

Parameters

paymentSessionDataDataRequired
cartCartRequired

Returns

PromisePromise<Data>Required

Deprecated

in the near future use PaymentProcessor.updatePayment instead


updatePaymentData

This will be

Parameters

paymentSessionDataDataRequired
dataDataRequired

Returns

PromisePromise<Data>Required

Deprecated

in the near future use PaymentProcessor.updatePayment instead


withTransaction

Parameters

transactionManagerEntityManager

Returns

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired
activeManager_objectRequired
atomicPhase_<TResult, TError>(work: (transactionManager: EntityManager) => Promise<TResult>, isolationOrErrorHandler?: IsolationLevel | (error: TError) => Promise<void | TResult>, maybeErrorHandlerOrDontFail?: (error: TError) => Promise<void | TResult>) => Promise<TResult>Required
authorizePayment(paymentSession: PaymentSession, context: Data) => Promise<{ data: Data ; status: PaymentSessionStatus }>Required
cancelPayment(payment: Payment) => Promise<Data>Required
capturePayment(payment: Payment) => Promise<Data>Required
createPayment(context: Cart & PaymentContext) => Promise<PaymentSessionResponse>(cart: Cart) => Promise<Data>Required
deletePayment(paymentSession: PaymentSession) => Promise<void>Required
getIdentifier() => stringRequired
getPaymentData(paymentSession: PaymentSession) => Promise<Data>Required
getStatus(data: Data) => Promise<PaymentSessionStatus>Required
refundPayment(payment: Payment, refundAmount: number) => Promise<Data>Required
retrievePayment(paymentData: Data) => Promise<Data>Required
retrieveSavedMethods(customer: Customer) => Promise<Data[]>Required
shouldRetryTransaction_(err: Record<string, unknown> | { code: string }) => booleanRequired
updatePayment(paymentSessionData: Data, context: Cart & PaymentContext) => Promise<PaymentSessionResponse | Data>(paymentSessionData: Data, cart: Cart) => Promise<Data>Required
updatePaymentData(paymentSessionData: Data, data: Data) => Promise<Data>Required
withTransaction(transactionManager?: EntityManager) => PaymentServiceRequired
Was this section helpful?