# Class Wallet

- [TopLevel.Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
  - [dw.customer.Wallet](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md)

Represents a set of payment instruments associated with a registered customer.

**Note:** this class allows access to sensitive personal and private
information. Pay attention to appropriate legal and regulatory requirements
when developing.

## Property Summary

| Property                                                                                                                                                                                         | Description                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| [defaultPaymentInstrument](#defaultpaymentinstrument): [CustomerPaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md) `(read-only)` | Returns the default payment instrument associated with the related customer.           |
| [paymentInstruments](#paymentinstruments): [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`                                               | Returns a collection of all payment instruments associated with the  related customer. |

## Constructor Summary

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

## Method Summary

| Method                                                                                                                                                                                                                                                                               | Description                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| [createPaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#createpaymentinstrumentstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                             | Creates a new, empty payment instrument object associated with the  related customer for the given payment method.             |
| [getDefaultPaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#getdefaultpaymentinstrument)()                                                                                                                                             | Returns the default payment instrument associated with the related customer.                                                   |
| [getPaymentInstruments](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#getpaymentinstruments)()                                                                                                                                                         | Returns a collection of all payment instruments associated with the  related customer.                                         |
| [getPaymentInstruments](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#getpaymentinstrumentsstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                 | Returns a collection of all payment instruments associated with the  related customer filtered by the given payment method id. |
| [removePaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.Wallet.md#removepaymentinstrumentcustomerpaymentinstrument)([CustomerPaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md)) | Removes a payment instrument associated with the customer.                                                                     |

### 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

### defaultPaymentInstrument

- defaultPaymentInstrument: [CustomerPaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md) `(read-only)`
  - : Returns the default payment instrument associated with the related customer. If not available, returns the first
    payment instrument or null if no payment instruments are associated with the customer.

***

### paymentInstruments

- paymentInstruments: [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
  - : Returns a collection of all payment instruments associated with the
    related customer.

***

## Method Details

### createPaymentInstrument(String)

- createPaymentInstrument(paymentMethodId: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [CustomerPaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md)
  - : Creates a new, empty payment instrument object associated with the
    related customer for the given payment method.

    **Parameters:**

    - paymentMethodId - the id of a payment method

    **Returns:**

    - the new payment instrument object.

    **Throws:**

    - NullArgumentException - If passed 'paymentMethodId' is null.

***

### getDefaultPaymentInstrument()

- getDefaultPaymentInstrument(): [CustomerPaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md)
  - : Returns the default payment instrument associated with the related customer. If not available, returns the first
    payment instrument or null if no payment instruments are associated with the customer.

    **Returns:**

    - The default payment instrument object.

***

### getPaymentInstruments()

- getPaymentInstruments(): [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
  - : Returns a collection of all payment instruments associated with the
    related customer.

    **Returns:**

    - Collection of all payment instruments.

***

### getPaymentInstruments(String)

- getPaymentInstruments(paymentMethodID: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
  - : Returns a collection of all payment instruments associated with the
    related customer filtered by the given payment method id. If
    `null` is passed as payment method id all payment instruments
    of the customer will be retrieved. If for the given payment method id no
    payment instrument is associated with the customer an empty collection
    will be returned.

    **Parameters:**

    - paymentMethodID - the paymentMethodID the payment method id to filter for

    **Returns:**

    - Collection of payment instruments for a payment method.

***

### removePaymentInstrument(CustomerPaymentInstrument)

- removePaymentInstrument(instrument: [CustomerPaymentInstrument](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.customer.CustomerPaymentInstrument.md)): void
  - : Removes a payment instrument associated with the customer.

    **Parameters:**

    - instrument - the instrument associated with this customer

    **Throws:**

    - NullArgumentException - If passed 'instrument' is null.
    - IllegalArgumentException - If passed 'instrument' belongs to an other customer

***
