---
displayed_sidebar: servicesSidebar
---
import TypeList from "@site/src/components/TypeList"
# PaymentProviderService
Helps retrieve payment providers
## constructor
### Parameters
___
## Properties
`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"__moduleDeclaration__","type":"`Record`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="PaymentProviderService"/>
___
## Accessors
### activeManager\_
#### Returns
### paymentService\_
#### Returns
___
## Methods
### withTransaction
#### Parameters
#### Returns
### shouldRetryTransaction\_
#### Parameters
` \\| `object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="shouldRetryTransaction_"/>
#### Returns
### 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
#### Parameters
Promise<TResult>","description":"the transactional work to be done","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationOrErrorHandler","type":"`IsolationLevel` \\| (`error`: TError) => Promise<void \\| TResult>","description":"the isolation level to be used for the work.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"maybeErrorHandlerOrDontFail","type":"(`error`: TError) => Promise<void \\| TResult>","description":"Potential error handler","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="atomicPhase_"/>
#### Returns
### registerInstalledProviders
#### Parameters
#### Returns
### list
#### Returns
### retrievePayment
Retrieve a payment entity with the given id.
#### Parameters
#### Returns
### listPayments
List all the payments according to the given selector and config.
#### Parameters
#### Returns
### retrieveSession
Return the payment session for the given id.
#### Parameters
#### Returns
### createSession
`**createSession**(providerId, cart): Promise<[PaymentSession](../../entities/classes/entities.PaymentSession.mdx)>`
#### Parameters
#### Returns
#### Deprecated
`**createSession**(sessionInput): Promise<[PaymentSession](../../entities/classes/entities.PaymentSession.mdx)>`
Creates a payment session with the given provider.
#### Parameters
#### Returns
### refreshSession
Refreshes a payment session with the given provider.
This means, that we delete the current one and create a new.
#### Parameters
`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"paymentSession.provider_id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"sessionInput","type":"`PaymentSessionInput`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="refreshSession"/>
#### Returns
### updateSession
Update a payment session with the given provider.
#### Parameters
`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"paymentSession.provider_id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"sessionInput","type":"[Cart](../../entities/classes/entities.Cart.mdx) \\| `PaymentSessionInput`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="updateSession"/>
#### Returns
### deleteSession
#### Parameters
#### Returns
### retrieveProvider
Finds a provider given an id
#### Type Parameters
#### Parameters
#### Returns
### createPayment
#### Parameters
#### Returns
### updatePayment
#### Parameters
#### Returns
### authorizePayment
#### Parameters
`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="authorizePayment"/>
#### Returns
### updateSessionData
#### Parameters
`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="updateSessionData"/>
#### Returns
### cancelPayment
#### Parameters
#### Returns
### getStatus
#### Parameters
#### Returns
### capturePayment
#### Parameters
#### Returns
### refundPayment
#### Parameters
#### Returns
### refundFromPayment
#### Parameters
#### Returns
### retrieveRefund
#### Parameters
#### Returns
### buildPaymentProcessorContext
Build the create session context for both legacy and new API
#### Parameters
#### Returns
### saveSession
Create or update a Payment session data.
#### Parameters
`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data.payment_session_id","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"data.cartId","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"data.amount","type":"`number`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"data.isSelected","type":"`boolean`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"data.isInitiated","type":"`boolean`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"data.status","type":"[PaymentSessionStatus](../../entities/enums/entities.PaymentSessionStatus.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="saveSession"/>
#### Returns
### processUpdateRequestsData
Process the collected data. Can be used every time we need to process some collected data returned by the provider
#### Parameters
` \\| [PaymentSessionResponse](../../medusa/types/medusa.PaymentSessionResponse.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data.customer","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"data.customer.id","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="processUpdateRequestsData"/>
#### Returns
### throwFromPaymentProcessorError
#### Parameters
#### Returns