# Class PaymentMethod

- [TopLevel.Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
  - [dw.object.PersistentObject](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
    - [dw.object.ExtensibleObject](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md)
      - [dw.order.PaymentMethod](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md)

The PaymentMethod class represents a logical type of payment a customer can
make in the storefront. This class provides methods to access the payment
method attributes, status, and (for card-based payment methods) the related
payment cards.

A typical storefront presents the customer a list of payment methods that a
customer can choose from after he has entered his billing address during the
checkout.
[PaymentMgr.getApplicablePaymentMethods(Customer, String, Number)](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMgr.md#getapplicablepaymentmethodscustomer-string-number)
is used to determine the PaymentMethods that are relevant for the customer
based on the amount of his order, his customer groups, and his shipping
address.

## Property Summary

| Property                                                                                                                                                    | Description                                                                                                                                      |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [ID](#id): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`                                                 | Returns the unique ID of the payment method.                                                                                                     |
| [active](#active): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`                                       | Returns 'true' if payment method is active (enabled), otherwise 'false' is returned.                                                             |
| [activePaymentCards](#activepaymentcards): [List](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)`                      | Returns enabled payment cards that are assigned to this payment method, regardless  of current customer, country or payment amount restrictions. |
| [description](#description): [MarkupText](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`                     | Returns the description of the payment method.                                                                                                   |
| [image](#image): [MediaFile](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)`                                   | Returns the reference to the payment method image.                                                                                               |
| [name](#name): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`                                             | Returns the name of the payment method.                                                                                                          |
| [paymentProcessor](#paymentprocessor): [PaymentProcessor](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentProcessor.md) `(read-only)` | Returns the payment processor associated to this payment method.                                                                                 |

## Constructor Summary

This class does not have a constructor, so you cannot create it directly.

## Method Summary

| Method                                                                                                                                                                                                                                                                                                                                                                                                                          | Description                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [getActivePaymentCards](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#getactivepaymentcards)()                                                                                                                                                                                                                                                                                                | Returns enabled payment cards that are assigned to this payment method, regardless  of current customer, country or payment amount restrictions.                                                                                       |
| [getApplicablePaymentCards](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#getapplicablepaymentcardscustomer-string-number)([Customer](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Customer.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Returns the sorted list of all enabled payment cards of this payment  method applicable for the specified customer, country, payment amount and the session currency  The payment cards are sorted as defined in the Business Manager. |
| [getDescription](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#getdescription)()                                                                                                                                                                                                                                                                                                              | Returns the description of the payment method.                                                                                                                                                                                         |
| [getID](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#getid)()                                                                                                                                                                                                                                                                                                                                | Returns the unique ID of the payment method.                                                                                                                                                                                           |
| [getImage](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#getimage)()                                                                                                                                                                                                                                                                                                                          | Returns the reference to the payment method image.                                                                                                                                                                                     |
| [getName](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#getname)()                                                                                                                                                                                                                                                                                                                            | Returns the name of the payment method.                                                                                                                                                                                                |
| [getPaymentProcessor](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#getpaymentprocessor)()                                                                                                                                                                                                                                                                                                    | Returns the payment processor associated to this payment method.                                                                                                                                                                       |
| [isActive](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#isactive)()                                                                                                                                                                                                                                                                                                                          | Returns 'true' if payment method is active (enabled), otherwise 'false' is returned.                                                                                                                                                   |
| [isApplicable](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentMethod.md#isapplicablecustomer-string-number)([Customer](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Customer.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                           | Returns 'true' if this payment method is applicable for the specified  customer, country and payment amount and the session currency.                                                                                                  |

### Methods inherited from class ExtensibleObject

[describe](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#describe), [getCustom](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#getcustom)

### Methods inherited from class PersistentObject

[getCreationDate](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)

### Methods inherited from class Object

[assign](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)

## Property Details

### ID

- ID: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
  - : Returns the unique ID of the payment method.

***

### active

- active: [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`
  - : Returns 'true' if payment method is active (enabled), otherwise 'false' is returned.

***

### activePaymentCards

- activePaymentCards: [List](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md) `(read-only)`
  - : Returns enabled payment cards that are assigned to this payment method, regardless
    of current customer, country or payment amount restrictions.
    The payment cards are sorted as defined in the Business Manager.

***

### description

- description: [MarkupText](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md) `(read-only)`
  - : Returns the description of the payment method.

***

### image

- image: [MediaFile](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md) `(read-only)`
  - : Returns the reference to the payment method image.

***

### name

- name: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
  - : Returns the name of the payment method.

***

### paymentProcessor

- paymentProcessor: [PaymentProcessor](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentProcessor.md) `(read-only)`
  - : Returns the payment processor associated to this payment method.

***

## Method Details

### getActivePaymentCards()

- getActivePaymentCards(): [List](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
  - : Returns enabled payment cards that are assigned to this payment method, regardless
    of current customer, country or payment amount restrictions.
    The payment cards are sorted as defined in the Business Manager.

    **Returns:**

    - List of enabled payment cards of current site

***

### getApplicablePaymentCards(Customer, String, Number)

- getApplicablePaymentCards(customer: [Customer](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Customer.md), countryCode: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), paymentAmount: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [List](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.List.md)
  - : Returns the sorted list of all enabled payment cards of this payment
    method applicable for the specified customer, country, payment amount and the session currency
    The payment cards are sorted as defined in the Business Manager.

    A payment card is applicable if

    - the card is restricted by customer group, and at least one of  the groups of the specified customer is assigned to the card

    - the card is restricted by billing country, and the specified  country code is assigned to the card

    - the card is restricted by payment amount for the session currency,  and the specified payment amount is within the limits of the min/max  payment amount defined for the method and the session currency

    - the card is restricted by currency code, and the specified  currency code matches session currency.

    All parameters are optional, and if not specified, the respective
    restriction won't be validated. For example, if a card is restricted
    by billing country, but no country code is specified, this card will
    be returned, unless it is filtered out by customer group or payment
    amount.

    **Parameters:**

    - customer - Customer or null
    - countryCode - Billing country code or null
    - paymentAmount - Payment amount or null

    **Returns:**

    - List of applicable payment cards of this payment method

***

### getDescription()

- getDescription(): [MarkupText](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MarkupText.md)
  - : Returns the description of the payment method.

    **Returns:**

    - Description of the payment method.

***

### getID()

- getID(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns the unique ID of the payment method.

    **Returns:**

    - ID of the payment method.

***

### getImage()

- getImage(): [MediaFile](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.MediaFile.md)
  - : Returns the reference to the payment method image.

    **Returns:**

    - Image of the payment method.

***

### getName()

- getName(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns the name of the payment method.

    **Returns:**

    - Name of the payment method.

***

### getPaymentProcessor()

- getPaymentProcessor(): [PaymentProcessor](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PaymentProcessor.md)
  - : Returns the payment processor associated to this payment method.

    **Returns:**

    - the payment processor associated to this payment method.

***

### isActive()

- isActive(): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Returns 'true' if payment method is active (enabled), otherwise 'false' is returned.

    **Returns:**

    - true if payment method is active, otherwise false.

***

### isApplicable(Customer, String, Number)

- isApplicable(customer: [Customer](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Customer.md), countryCode: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), paymentAmount: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Returns 'true' if this payment method is applicable for the specified
    customer, country and payment amount and the session currency.

    The payment method is applicable if

    - the method is restricted by customer group, and at least one of the  groups of the specified customer is assigned to the method

    - the method is restricted by billing country, and the specified  country code is assigned to the method

    - the method is restricted by payment amount for the session currency,  and the specified payment amount is within the limits of the min/max  payment amount defined for the method and the session currency

    - the method is restricted by currency code, and the specified  currency code matches session currency.

    All parameters are optional, and if not specified, the respective
    restriction won't be validated. For example, if a method is restricted by
    billing country, but no country code is specified, this method will be
    returned, unless it is filtered out by customer group or payment amount.

    **Parameters:**

    - customer - Customer or null
    - countryCode - Billing country code or null
    - paymentAmount - Payment amount or null

    **Returns:**

    - true if payment method is applicable, false otherwise

***
