Skip to main content

Class: PaymentService

Hierarchy

  • TransactionBaseServiceCopy to Clipboard

    PaymentServiceCopy to Clipboard

Constructors

constructor

new PaymentService(__namedParametersCopy to Clipboard)

Parameters

NameType
__namedParametersCopy to ClipboardInjectedDependenciesCopy to Clipboard

Overrides

TransactionBaseService.constructor

Defined in

packages/medusa/src/services/payment.ts:40

Properties

__configModule__

ProtectedCopy to Clipboard OptionalCopy to Clipboard ReadonlyCopy to Clipboard __configModule__: RecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard>

Inherited from

TransactionBaseService.__configModule__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:10


__container__

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard __container__: anyCopy to Clipboard

Inherited from

TransactionBaseService.__container__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:9


__moduleDeclaration__

ProtectedCopy to Clipboard OptionalCopy to Clipboard ReadonlyCopy to Clipboard __moduleDeclaration__: RecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard>

Inherited from

TransactionBaseService.__moduleDeclaration__

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:11


eventBusService_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard eventBusService_: EventBusServiceCopy to Clipboard

Defined in

packages/medusa/src/services/payment.ts:28


manager_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard manager_: EntityManagerCopy to Clipboard

Overrides

TransactionBaseService.manager_

Defined in

packages/medusa/src/services/payment.ts:26


paymentProviderService_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard paymentProviderService_: PaymentProviderServiceCopy to Clipboard

Defined in

packages/medusa/src/services/payment.ts:29


paymentRepository_

ProtectedCopy to Clipboard ReadonlyCopy to Clipboard paymentRepository_: typeof PaymentRepositoryCopy to Clipboard

Defined in

packages/medusa/src/services/payment.ts:30


transactionManager_

ProtectedCopy to Clipboard transactionManager_: undefinedCopy to Clipboard | EntityManagerCopy to Clipboard

Overrides

TransactionBaseService.transactionManager_

Defined in

packages/medusa/src/services/payment.ts:27


Events

StaticCopy to Clipboard ReadonlyCopy to Clipboard Events: ObjectCopy to Clipboard

Type declaration

NameType
CREATEDCopy to ClipboardstringCopy to Clipboard
PAYMENT_CAPTUREDCopy to ClipboardstringCopy to Clipboard
PAYMENT_CAPTURE_FAILEDCopy to ClipboardstringCopy to Clipboard
REFUND_CREATEDCopy to ClipboardstringCopy to Clipboard
REFUND_FAILEDCopy to ClipboardstringCopy to Clipboard
UPDATEDCopy to ClipboardstringCopy to Clipboard

Defined in

packages/medusa/src/services/payment.ts:31

Methods

atomicPhase_

ProtectedCopy to Clipboard atomicPhase_<TResultCopy to Clipboard, TErrorCopy to Clipboard>(workCopy to Clipboard, isolationOrErrorHandler?Copy to Clipboard, maybeErrorHandlerOrDontFail?Copy to Clipboard): PromiseCopy to Clipboard<TResultCopy to Clipboard>

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

Name
TResultCopy to Clipboard
TErrorCopy to Clipboard

Parameters

NameTypeDescription
workCopy to Clipboard(transactionManagerCopy to Clipboard: EntityManagerCopy to Clipboard) => PromiseCopy to Clipboard<TResultCopy to Clipboard>the transactional work to be done
isolationOrErrorHandler?Copy to ClipboardIsolationLevelCopy to Clipboard | (errorCopy to Clipboard: TErrorCopy to Clipboard) => PromiseCopy to Clipboard<voidCopy to Clipboard | TResultCopy to Clipboard>the isolation level to be used for the work.
maybeErrorHandlerOrDontFail?Copy to Clipboard(errorCopy to Clipboard: TErrorCopy to Clipboard) => PromiseCopy to Clipboard<voidCopy to Clipboard | TResultCopy to Clipboard>Potential error handler

Returns

PromiseCopy to Clipboard<TResultCopy to Clipboard>

the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:50


capture

capture(paymentOrIdCopy to Clipboard): PromiseCopy to Clipboard<PaymentCopy to Clipboard>

Captures a payment.

Parameters

NameTypeDescription
paymentOrIdCopy to ClipboardstringCopy to Clipboard | PaymentCopy to Clipboardthe id or the class instance of the payment

Returns

PromiseCopy to Clipboard<PaymentCopy to Clipboard>

the payment captured.

Defined in

packages/medusa/src/services/payment.ts:161


create

create(paymentInputCopy to Clipboard): PromiseCopy to Clipboard<PaymentCopy to Clipboard>

Created a new payment.

Parameters

NameTypeDescription
paymentInputCopy to ClipboardPaymentDataInputCopy to Clipboardinfo to create the payment

Returns

PromiseCopy to Clipboard<PaymentCopy to Clipboard>

the payment created.

Defined in

packages/medusa/src/services/payment.ts:96


refund

refund(paymentOrIdCopy to Clipboard, amountCopy to Clipboard, reasonCopy to Clipboard, note?Copy to Clipboard): PromiseCopy to Clipboard<RefundCopy to Clipboard>

refunds a payment.

Parameters

NameTypeDescription
paymentOrIdCopy to ClipboardstringCopy to Clipboard | PaymentCopy to Clipboardthe id or the class instance of the payment
amountCopy to ClipboardnumberCopy to Clipboardthe amount to be refunded from the payment
reasonCopy to ClipboardstringCopy to Clipboardthe refund reason
note?Copy to ClipboardstringCopy to Clipboardadditional note of the refund

Returns

PromiseCopy to Clipboard<RefundCopy to Clipboard>

the refund created.

Defined in

packages/medusa/src/services/payment.ts:210


retrieve

retrieve(paymentIdCopy to Clipboard, config?Copy to Clipboard): PromiseCopy to Clipboard<PaymentCopy to Clipboard>

Retrieves a payment by id.

Parameters

NameTypeDescription
paymentIdCopy to ClipboardstringCopy to Clipboardthe id of the payment
configCopy to ClipboardFindConfigCopy to Clipboard<PaymentCopy to Clipboard>the config to retrieve the payment

Returns

PromiseCopy to Clipboard<PaymentCopy to Clipboard>

the payment.

Defined in

packages/medusa/src/services/payment.ts:61


shouldRetryTransaction_

ProtectedCopy to Clipboard shouldRetryTransaction_(errCopy to Clipboard): booleanCopy to Clipboard

Parameters

NameType
errCopy to ClipboardRecordCopy to Clipboard<stringCopy to Clipboard, unknownCopy to Clipboard> | { codeCopy to Clipboard: stringCopy to Clipboard }

Returns

booleanCopy to Clipboard

Inherited from

TransactionBaseService.shouldRetryTransaction_

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:31


update

update(paymentIdCopy to Clipboard, dataCopy to Clipboard): PromiseCopy to Clipboard<PaymentCopy to Clipboard>

Updates a payment in order to link it to an order or a swap.

Parameters

NameTypeDescription
paymentIdCopy to ClipboardstringCopy to Clipboardthe id of the payment
dataCopy to ClipboardObjectCopy to Clipboardorder_id or swap_id to link the payment
data.order_id?Copy to ClipboardstringCopy to Clipboard-
data.swap_id?Copy to ClipboardstringCopy to Clipboard-

Returns

PromiseCopy to Clipboard<PaymentCopy to Clipboard>

the payment updated.

Defined in

packages/medusa/src/services/payment.ts:127


withTransaction

withTransaction(transactionManager?Copy to Clipboard): PaymentServiceCopy to Clipboard

Parameters

NameType
transactionManager?Copy to ClipboardEntityManagerCopy to Clipboard

Returns

PaymentServiceCopy to Clipboard

Inherited from

TransactionBaseService.withTransaction

Defined in

packages/medusa/src/interfaces/transaction-base-service.ts:14