# Managing payment methods

## Getting the available payment methods for the cart

To offer various payment options for customers, it's crucial to retrieve the available payment methods for the cart. This guide will walk you through accessing these methods using the Commerce API. By following the instructions below, you can easily integrate this functionality into your application and enhance the checkout experience for your users.

To get the available payment methods for your cart, send a [`GET /v1/shoppers/me/carts/active/payment-methods`](https://docs.digitalriver.com/commerce-api-references/shopper-apis/cart/payment-methods#v1-shoppers-me-carts-active-payment-methods) request and include `{Your_API_Key}` in the header. Here's an example using cURL:

{% tabs %}
{% tab title="cURL" %}

```http
curl --location -g --request GET ' https://api.digitalriver.com/v1/shoppers/me/carts/active/payment-methods' \
--header 'Authorization: Basic {Your_API_Key}' \
...
```

{% endtab %}

{% tab title="200 OK response" %}

```json
{
  "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/payment-methods",
  "applyPaymentMethod": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/apply-payment-method"
  },
  "paymentMethod": [
    {
      "type": "americanExpress",
      "displayName": "American Express",
      "description": "American Express"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

A successful response will return a JSON object with the available payment methods and related information. See the [query parameters](https://docs.digitalriver.com/commerce-api-references/shopper-apis/cart/payment-methods#v1-shoppers-me-carts-active-payment-methods) for more information.

To add an organization identifier to a cart, send a [`POST /shoppers/me/carts/active`](https://docs.digitalriver.com/commerce-api-references/shopper-apis/cart/carts#v1-shoppers-me-carts-active-1) request. Include `{Your_API_Key}` in the header and the `organizationId` field in the request payload. The `organizationId` will be passed to the payment session to make specific payment methods available. Here's an example using cURL:

{% tabs %}
{% tab title="cURL" %}

```json
curl --location --request POST 'https://api.digitalriver.com/shoppers/me/carts/active' \
--header 'Content-Type:  application/json' \
--header 'authorization: Basic  {Your_API_Key}\
--data-raw '{
	"cart": {
			"organizationId": "Acme_Inc",
			"lineItems": {
					"lineItem":
							{
									"quantity": "1",
									"product": {
											"id": "5326162000"
									}
							}
			}
		}
}'
```

{% endtab %}

{% tab title="200 OK response" %}
A successful request returns a `200 OK` response.

```json
{
  "cart": {
    ...
    "organizationId": "Acme_Inc"
  }
}
```

{% endtab %}
{% endtabs %}

A successful request returns a `200 OK` response with the updated `organizationId` in the cart. See the [Update the current cart](https://docs.digitalriver.com/commerce-api-references/shopper-apis/cart/carts#v1-shoppers-me-carts-active-1) for more information.

To remove an organization identifier from the cart, send a [`POST /shoppers/me/carts/active`](https://docs.digitalriver.com/commerce-api-references/shopper-apis/cart/carts#v1-shoppers-me-carts-active-1) request. Include `{Your_API_Key}` in the header. Set the `organizationId` field to an empty string in the request payload. This will delete the organization identifier from the cart, resulting in a `200 OK` response if successful. Here's an example using cURL:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/commerce-api/shopper-apis/cart/creating-or-updating-a-cart/managing-payment-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
