---
displayed_sidebar: servicesSidebar
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# PaymentProviderService

Helps retrieve payment providers

## Constructors

### constructor

`**new PaymentProviderService**(container)`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "container",
    "type": "[InjectedDependencies](../types/InjectedDependencies-24.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

## Properties

<ParameterTypes parameters={[
  {
    "name": "__configModule__",
    "type": "`Record<string, unknown>`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "__container__",
    "type": "`any`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "__moduleDeclaration__",
    "type": "`Record<string, unknown>`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "container_",
    "type": "[InjectedDependencies](../types/InjectedDependencies-24.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customerService_",
    "type": "[CustomerService](CustomerService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "featureFlagRouter_",
    "type": "[FlagRouter](FlagRouter.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "logger_",
    "type": "[Logger](../types/Logger-1.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "manager_",
    "type": "EntityManager",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentProviderRepository_",
    "type": "Repository&#60;[PaymentProvider](PaymentProvider.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentRepository_",
    "type": "Repository&#60;[Payment](Payment.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentSessionRepository_",
    "type": "Repository&#60;[PaymentSession](PaymentSession.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "refundRepository_",
    "type": "Repository&#60;[Refund](Refund.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "transactionManager_",
    "type": "`undefined` \\| EntityManager",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

## Accessors

### activeManager\_

`Protected get**activeManager_**(): EntityManager`

#### Returns

EntityManager

<ParameterTypes parameters={[
  {
    "name": "EntityManager",
    "type": "EntityManager",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### paymentService\_

`Protected get**paymentService_**(): [PaymentService](PaymentService.mdx)`

#### Returns

[PaymentService](PaymentService.mdx)

<ParameterTypes parameters={[
  {
    "name": "default",
    "type": "[PaymentService](PaymentService.mdx)",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

## Methods

### atomicPhase\_

`Protected **atomicPhase_**<TypeParameter TResult, TypeParameter TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise&#60;TResult&#62;`

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.

<ParameterTypes parameters={[
  {
    "name": "TResult",
    "type": "`object`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "TError",
    "type": "`object`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "work",
    "type": "(`transactionManager`: EntityManager) => Promise&#60;TResult&#62;",
    "description": "the transactional work to be done",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "isolationOrErrorHandler",
    "type": "`IsolationLevel` \\| (`error`: `TError`) => Promise&#60;void \\| TResult&#62;",
    "description": "the isolation level to be used for the work.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "maybeErrorHandlerOrDontFail",
    "type": "(`error`: `TError`) => Promise&#60;void \\| TResult&#62;",
    "description": "Potential error handler",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;TResult&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;TResult&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "the result of the transactional work",
    "expandable": false,
    "children": []
  }
]} />

___

### authorizePayment

`**authorizePayment**(paymentSession, context): Promise&#60;undefined \| [PaymentSession](PaymentSession.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentSession",
    "type": "[PaymentSession](PaymentSession.mdx)",
    "description": "A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "context",
    "type": "`Record<string, unknown>`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;undefined \| [PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;undefined \\| [PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### buildPaymentProcessorContext

`Protected **buildPaymentProcessorContext**(cartOrData): [Cart](Cart.mdx) & [PaymentContext](../types/PaymentContext.mdx)`

Build the create session context for both legacy and new API

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "cartOrData",
    "type": "[Cart](Cart.mdx) \\| [PaymentSessionInput](../types/PaymentSessionInput.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

[Cart](Cart.mdx) & [PaymentContext](../types/PaymentContext.mdx)

<ParameterTypes parameters={[
  {
    "name": "Cart & PaymentContext",
    "type": "[Cart](Cart.mdx) & [PaymentContext](../types/PaymentContext.mdx)",
    "optional": true,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### cancelPayment

`**cancelPayment**(paymentObj): Promise&#60;[Payment](Payment.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentObj",
    "type": "[Partial](../types/Partial.mdx)&#60;[Payment](Payment.mdx)&#62; & ``{ id: string  }``",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Payment](Payment.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Payment](Payment.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### capturePayment

`**capturePayment**(paymentObj): Promise&#60;[Payment](Payment.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentObj",
    "type": "[Partial](../types/Partial.mdx)&#60;[Payment](Payment.mdx)&#62; & ``{ id: string  }``",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Payment](Payment.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Payment](Payment.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### createPayment

`**createPayment**(data): Promise&#60;[Payment](Payment.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "data",
    "type": "[CreatePaymentInput](../types/CreatePaymentInput.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Payment](Payment.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Payment](Payment.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### createSession

`**createSession**(providerId, cart): Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "providerId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "cart",
    "type": "[Cart](Cart.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

#### Deprecated

`**createSession**(sessionInput): Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;`

Creates a payment session with the given provider.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "sessionInput",
    "type": "[PaymentSessionInput](../types/PaymentSessionInput.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### deleteSession

`**deleteSession**(paymentSession): Promise&#60;undefined \| [PaymentSession](PaymentSession.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentSession",
    "type": "[PaymentSession](PaymentSession.mdx)",
    "description": "A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;undefined \| [PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;undefined \\| [PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### getStatus

`**getStatus**(payment): Promise&#60;[PaymentSessionStatus](../enums/PaymentSessionStatus.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "payment",
    "type": "[Payment](Payment.mdx)",
    "description": "A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[PaymentSessionStatus](../enums/PaymentSessionStatus.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentSessionStatus](../enums/PaymentSessionStatus.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### list

`**list**(): Promise&#60;[PaymentProvider](PaymentProvider.mdx)[]&#62;`

#### Returns

Promise&#60;[PaymentProvider](PaymentProvider.mdx)[]&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentProvider](PaymentProvider.mdx)[]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### listPayments

`**listPayments**(selector, config?): Promise&#60;[Payment](Payment.mdx)[]&#62;`

List all the payments according to the given selector and config.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "selector",
    "type": "[Selector](../types/Selector.mdx)&#60;[Payment](Payment.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "config",
    "type": "[FindConfig](../interfaces/FindConfig.mdx)&#60;[Payment](Payment.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Payment](Payment.mdx)[]&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Payment](Payment.mdx)[]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### processUpdateRequestsData

`Protected **processUpdateRequestsData**(data?, paymentResponse): Promise&#60;void&#62;`

Process the collected data. Can be used every time we need to process some collected data returned by the provider

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "data",
    "type": "`object`",
    "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": []
  },
  {
    "name": "paymentResponse",
    "type": "`Record<string, unknown>` \\| [PaymentSessionResponse](../types/PaymentSessionResponse.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;void&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;void&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### refreshSession

`**refreshSession**(paymentSession, sessionInput): Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;`

Refreshes a payment session with the given provider.
This means, that we delete the current one and create a new.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentSession",
    "type": "`object`",
    "description": "the payment session object to update",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentSession.data",
    "type": "`Record<string, unknown>`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentSession.id",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentSession.provider_id",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "sessionInput",
    "type": "[PaymentSessionInput](../types/PaymentSessionInput.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "the payment session",
    "expandable": false,
    "children": []
  }
]} />

___

### refundFromPayment

`**refundFromPayment**(payment, amount, reason, note?): Promise&#60;[Refund](Refund.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "payment",
    "type": "[Payment](Payment.mdx)",
    "description": "A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "amount",
    "type": "`number`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "reason",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "note",
    "type": "`string`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Refund](Refund.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Refund](Refund.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### refundPayment

`**refundPayment**(payObjs, amount, reason, note?): Promise&#60;[Refund](Refund.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "payObjs",
    "type": "[Payment](Payment.mdx)[]",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "amount",
    "type": "`number`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "reason",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "note",
    "type": "`string`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Refund](Refund.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Refund](Refund.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### registerInstalledProviders

`**registerInstalledProviders**(providerIds): Promise&#60;void&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "providerIds",
    "type": "`string`[]",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;void&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;void&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### retrievePayment

`**retrievePayment**(paymentId, relations?): Promise&#60;[Payment](Payment.mdx)&#62;`

Retrieve a payment entity with the given id.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "relations",
    "type": "`string`[]",
    "description": "",
    "optional": false,
    "defaultValue": "[]",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Payment](Payment.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Payment](Payment.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### retrieveProvider

`**retrieveProvider**<TypeParameter TProvider>(providerId): TProvider extends [AbstractPaymentService](AbstractPaymentService.mdx) ? [AbstractPaymentService](AbstractPaymentService.mdx) : TProvider extends [AbstractPaymentProcessor](AbstractPaymentProcessor.mdx) ? [AbstractPaymentProcessor](AbstractPaymentProcessor.mdx) : any`

Finds a provider given an id

<ParameterTypes parameters={[
  {
    "name": "TProvider",
    "type": "`unknown`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "providerId",
    "type": "`string`",
    "description": "the id of the provider to get",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

`TProvider` extends [AbstractPaymentService](AbstractPaymentService.mdx) ? [AbstractPaymentService](AbstractPaymentService.mdx) : `TProvider` extends [AbstractPaymentProcessor](AbstractPaymentProcessor.mdx) ? [AbstractPaymentProcessor](AbstractPaymentProcessor.mdx) : `any`

<ParameterTypes parameters={[
  {
    "name": "TProvider extends AbstractPaymentService ? AbstractPaymentService : TProvider extends AbstractPaymentProcessor ? AbstractPaymentProcessor : any",
    "type": "`TProvider` extends [AbstractPaymentService](AbstractPaymentService.mdx) ? [AbstractPaymentService](AbstractPaymentService.mdx) : `TProvider` extends [AbstractPaymentProcessor](AbstractPaymentProcessor.mdx) ? [AbstractPaymentProcessor](AbstractPaymentProcessor.mdx) : `any`",
    "optional": true,
    "defaultValue": "",
    "description": "the payment provider",
    "expandable": false,
    "children": []
  }
]} />

___

### retrieveRefund

`**retrieveRefund**(id, config?): Promise&#60;[Refund](Refund.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "config",
    "type": "[FindConfig](../interfaces/FindConfig.mdx)&#60;[Refund](Refund.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Refund](Refund.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Refund](Refund.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### retrieveSession

`**retrieveSession**(paymentSessionId, relations?): Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;`

Return the payment session for the given id.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentSessionId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "relations",
    "type": "`string`[]",
    "description": "",
    "optional": false,
    "defaultValue": "[]",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### saveSession

`Protected **saveSession**(providerId, data): Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;`

Create or update a Payment session data.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "providerId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data",
    "type": "`object`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.amount",
    "type": "`number`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.cartId",
    "type": "`string`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.isInitiated",
    "type": "`boolean`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.isSelected",
    "type": "`boolean`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.payment_session_id",
    "type": "`string`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.sessionData",
    "type": "`Record<string, unknown>`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.status",
    "type": "[PaymentSessionStatus](../enums/PaymentSessionStatus.mdx)",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### shouldRetryTransaction\_

`Protected **shouldRetryTransaction_**(err): boolean`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "err",
    "type": "`Record<string, unknown>` \\| ``{ code: string  }``",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

`boolean`

<ParameterTypes parameters={[
  {
    "name": "boolean",
    "type": "`boolean`",
    "optional": true,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### throwFromPaymentProcessorError

`Private **throwFromPaymentProcessorError**(errObj): void`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "errObj",
    "type": "[PaymentProcessorError](../interfaces/PaymentProcessorError.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

`void`

<ParameterTypes parameters={[
  {
    "name": "void",
    "type": "`void`",
    "optional": true,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### updatePayment

`**updatePayment**(paymentId, data): Promise&#60;[Payment](Payment.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data",
    "type": "`object`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.order_id",
    "type": "`string`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data.swap_id",
    "type": "`string`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[Payment](Payment.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[Payment](Payment.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### updateSession

`**updateSession**(paymentSession, sessionInput): Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;`

Update a payment session with the given provider.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentSession",
    "type": "`object`",
    "description": "The paymentSession to update",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentSession.data",
    "type": "`Record<string, unknown>`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentSession.id",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "paymentSession.provider_id",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "sessionInput",
    "type": "[Cart](Cart.mdx) \\| [PaymentSessionInput](../types/PaymentSessionInput.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "the payment session",
    "expandable": false,
    "children": []
  }
]} />

___

### updateSessionData

`**updateSessionData**(paymentSession, data): Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "paymentSession",
    "type": "[PaymentSession](PaymentSession.mdx)",
    "description": "A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data",
    "type": "`Record<string, unknown>`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PaymentSession](PaymentSession.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### withTransaction

`**withTransaction**(transactionManager?): [PaymentProviderService](PaymentProviderService.mdx)`

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "transactionManager",
    "type": "EntityManager",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

[PaymentProviderService](PaymentProviderService.mdx)

<ParameterTypes parameters={[
  {
    "name": "default",
    "type": "[PaymentProviderService](PaymentProviderService.mdx)",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />
