---
title: "List or set up payment methods"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.nicer.travel/llms.txt
> Use this file to discover all available pages before exploring further.

# List or set up payment methods

Path: Nicer API › Commerce

`POST /commerce/payment-methods/actions`

URL: `https://api.nicer.travel/commerce/payment-methods/actions`

Runs a payment-method action: listing the stored methods the caller may use, starting a card setup, creating the link a client opens to authorize a card to the advisor who makes it, or revoking a saved card or an authorization. A verified user session and an Idempotency-Key are required. Repeating the same CREATE_TRIP_CARD_LINK request while the link is active returns its original URL and expiresAt. LIST omits private advisor notes unless the eligible advisor explicitly requests them.

## Authentication

- `bearerAuth`, http bearer, header `Authorization`, format `JWT`

## Header parameters

- `Idempotency-Key` (`commerce.paymentMethods.actions.create.header.Idempotency-Key`; string, required) — Unique key (8–255 chars) per request; replays return the original result.

## Request body

_Required._

Every option has:

- `type` (`<option>.type`; string, required)

One of the following, each adding:

- `object` (`commerce.paymentMethods.actions.create.1`)
  - `includeAdvisorNotes` (`commerce.paymentMethods.actions.create.1.includeAdvisorNotes`; boolean, optional) — Include private notes on the caller’s own advisor authorizations.
  - `travelerId` (`commerce.paymentMethods.actions.create.1.travelerId`; string, optional) — A CRM traveler of the caller's agency: only the cards whose authorization names that traveler, as their CRM profile shows them. A traveler of another agency answers 404 COMMERCE_TRAVELER_NOT_FOUND.
    - maxLength: `64` · minLength: `1`
  - `travelersTripId` (`commerce.paymentMethods.actions.create.1.travelersTripId`; string, optional) — A trip the caller works: its cards are listed too, and when the trip has CRM travelers the cards clients authorized to the caller are limited to theirs, plus those that name no traveler.
    - minLength: `1`
- `object` (`commerce.paymentMethods.actions.create.2`)
  - `saveFor` (`commerce.paymentMethods.actions.create.2.saveFor`; one of, required)
    - every option has:
      - `kind` (`<option>.kind`; string, required)
    - one of the following, each adding:
      - `object` (`commerce.paymentMethods.actions.create.2.saveFor.1`)
      - `object` (`commerce.paymentMethods.actions.create.2.saveFor.2`)
      - `object` (`commerce.paymentMethods.actions.create.2.saveFor.3`)
        - `consentAccepted` (`commerce.paymentMethods.actions.create.2.saveFor.3.consentAccepted`; boolean, required)
        - `travelersTripId` (`commerce.paymentMethods.actions.create.2.saveFor.3.travelersTripId`; string, required)
          - minLength: `1`
  - `usage` (`commerce.paymentMethods.actions.create.2.usage`; string, required)
- `object` (`commerce.paymentMethods.actions.create.3`)
  - `recipientEmail` (`commerce.paymentMethods.actions.create.3.recipientEmail`; string, optional) — Where the link is also emailed, in the agency's brand. Recorded on the authorization, so the advisor who made the link can tell one client's card from another.
    - format: `email` · pattern: `^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$`
  - `travelerId` (`commerce.paymentMethods.actions.create.3.travelerId`; string, optional) — The CRM traveler the link is sent to, recorded on the authorization as whose card it is. From a trip, one of the trip's travelers; left out there, the trip's one traveler whose email is recipientEmail, else none. Without a trip it is required and must be a traveler of the caller's agency. A traveler who is not on the trip, or not at the agency, answers 404 COMMERCE_TRAVELER_NOT_FOUND.
    - maxLength: `64` · minLength: `1`
  - `travelersTripId` (`commerce.paymentMethods.actions.create.3.travelersTripId`; string, optional) — The trip the link is made from, recorded as where the authorization came from. Left out for a card asked from the traveler's CRM profile, which then needs travelerId (400 COMMERCE_CARD_LINK_TARGET_REQUIRED without either). Either way, completing the link authorizes the card to the advisor who made it, for this client's purchases on any of their trips.
    - minLength: `1`
- `object` (`commerce.paymentMethods.actions.create.4`)
  - `paymentMethodId` (`commerce.paymentMethods.actions.create.4.paymentMethodId`; string, required)
    - maxLength: `255` · minLength: `1`
  - `scope` (`commerce.paymentMethods.actions.create.4.scope`; one of, required)
    - every option has:
      - `kind` (`<option>.kind`; string, required)
    - one of the following, each adding:
      - `object` (`commerce.paymentMethods.actions.create.4.scope.1`)
      - `object` (`commerce.paymentMethods.actions.create.4.scope.2`)
        - `travelersTripId` (`commerce.paymentMethods.actions.create.4.scope.2.travelersTripId`; string, required)
          - minLength: `1`
      - `object` (`commerce.paymentMethods.actions.create.4.scope.3`)
        - `advisorUserId` (`commerce.paymentMethods.actions.create.4.scope.3.advisorUserId`; string, optional)
          - minLength: `1`
- `object` (`commerce.paymentMethods.actions.create.5`)
  - `paymentMethodId` (`commerce.paymentMethods.actions.create.5.paymentMethodId`; string, required)
    - maxLength: `255` · minLength: `1`
  - `note` (`commerce.paymentMethods.actions.create.5.note`; any of, required) — A private label for this authorization. Use null to clear it.
    - any of the following: `string`, `null`
  - `advisorUserId` (`commerce.paymentMethods.actions.create.5.advisorUserId`; string, optional) — Defaults to the caller. Only an active admin of the agency can edit another advisor’s grant.
    - minLength: `1`

## Example request

```json
{
  "includeAdvisorNotes": true,
  "travelerId": "string",
  "travelersTripId": "string",
  "type": "LIST"
}
```

## Code samples

### JavaScript SDK

```javascript
import { createClient } from "@nicertravel/sdk";

const nicer = createClient({
  baseUrl: "https://api.nicer.travel",
  token: process.env.NICER_TOKEN,
  headers: { "Idempotency-Key": process.env.NICER_IDEMPOTENCY_KEY },
});

await nicer.commerce.paymentMethods.actions.create({
  "type": "LIST"
});
```

### Nicer CLI

```bash
nicer commerce payment-methods actions create --input - <<'JSON'
{
  "type": "LIST"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url https://api.nicer.travel/commerce/payment-methods/actions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: string' \
  --data '
{
  "includeAdvisorNotes": true,
  "travelerId": "string",
  "travelersTripId": "string",
  "type": "LIST"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/commerce/payment-methods/actions';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Idempotency-Key': 'string',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({
    includeAdvisorNotes: true,
    travelerId: 'string',
    travelersTripId: 'string',
    type: 'LIST'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.nicer.travel/commerce/payment-methods/actions"

payload = {
    "includeAdvisorNotes": True,
    "travelerId": "string",
    "travelersTripId": "string",
    "type": "LIST"
}
headers = {
    "Content-Type": "application/json",
    "Idempotency-Key": "string",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "methods": [
    {
      "authorizations": [],
      "brand": "string",
      "expiry": "string",
      "label": "string",
      "last4": "string",
      "paymentMethodId": "string",
      "scopes": [
        "USER"
      ],
      "usable": true,
      "usableUntil": "2019-08-24T14:15:22Z"
    }
  ],
  "status": "LISTED"
}
```

Every option has:

- `status` (`<option>.status`; string, required)

One of the following, each adding:

- `object` (`commerce.paymentMethods.actions.create.response.200.1`)
  - `methods` (`commerce.paymentMethods.actions.create.response.200.1.methods`; array of object, required)
    - `authorizations` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations`; array of object, required) — The card's live TRIP and ADVISOR authorizations the caller may see: enough to pick the right client's card (when it was authorized, the trip it came from and its title, the recipient named, the CRM traveler it belongs to). Empty for a card that is only the caller's own.
      - default: `[]`
      - `advisorUserId` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.advisorUserId`; any of, required) — ADVISOR: the advisor the card is authorized to. Null for TRIP.
        - any of the following: `string`, `null`
      - `authorizedAt` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.authorizedAt`; any of, required) — When consent was given; null when none was recorded.
        - any of the following: `string`, `null`
      - `kind` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.kind`; string, required) — TRIP: anyone working travelersTripId may use the card (an authorization given before advisor grants). ADVISOR: advisorUserId may use it for this client's purchases on any of their trips.
        - one of `"TRIP"`, `"ADVISOR"`
      - `travelersTripId` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.travelersTripId`; any of, required) — TRIP: the trip. ADVISOR: the trip the authorization came from (the trip the link was made from, or the paid order's trip); null when it came from none.
        - any of the following: `string`, `null`
      - `note` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.note`; string, optional) — The advisor’s private note about this authorization, included on request when listing their own grants.
        - maxLength: `100`
      - `advisorName` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.advisorName`; any of, optional) — The display name of the advisor the card is authorized to; null when it is unknown. Only the person who gave the authorization gets it: the advisor reading their own entry does not.
        - any of the following: `string`, `null`
      - `recipientEmail` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.recipientEmail`; any of, optional) — The recipient the advisor named on the link that collected the card; null when none was named or the card was authorized at payment. Only that advisor gets it.
        - any of the following: `string`, `null`
      - `travelerId` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.travelerId`; any of, optional) — ADVISOR: the CRM traveler whose card it is, the one the advisor sent the link to (named on the link, or the trip's traveler with the recipient's email). Absent or null when none was recorded: the link named or matched none, the card was authorized at payment, or before travelers were recorded. Only the advisor the card is authorized to gets it.
        - any of the following: `TravelerId`, `null`
      - `tripTitle` (`commerce.paymentMethods.actions.create.response.200.1.methods.authorizations.tripTitle`; any of, optional) — The title of travelersTripId, so the advisor can tell which client's trip the card came from; null when the trip has no title or there is no trip. Only the advisor the card is authorized to gets it.
        - any of the following: `string`, `null`
    - `brand` (`commerce.paymentMethods.actions.create.response.200.1.methods.brand`; any of, required)
      - any of the following: `string`, `null`
    - `expiry` (`commerce.paymentMethods.actions.create.response.200.1.methods.expiry`; any of, required)
      - any of the following: `string`, `null`
    - `label` (`commerce.paymentMethods.actions.create.response.200.1.methods.label`; string, required)
      - maxLength: `200` · minLength: `1`
    - `last4` (`commerce.paymentMethods.actions.create.response.200.1.methods.last4`; any of, required)
      - any of the following: `string`, `null`
    - `paymentMethodId` (`commerce.paymentMethods.actions.create.response.200.1.methods.paymentMethodId`; string, required)
      - maxLength: `255` · minLength: `1`
    - `scopes` (`commerce.paymentMethods.actions.create.response.200.1.methods.scopes`; array of string, required)
      - one of `"USER"`, `"TRIP"`, `"ADVISOR"`
    - `usable` (`commerce.paymentMethods.actions.create.response.200.1.methods.usable`; boolean, required)
    - `usableUntil` (`commerce.paymentMethods.actions.create.response.200.1.methods.usableUntil`; any of, required)
      - any of the following: `string`, `null`
- `object` (`commerce.paymentMethods.actions.create.response.200.2`)
  - `collection` (`commerce.paymentMethods.actions.create.response.200.2.collection`; object, required)
    - `collectionToken` (`commerce.paymentMethods.actions.create.response.200.2.collection.collectionToken`; string, required)
      - minLength: `1`
    - `collectionUrl` (`commerce.paymentMethods.actions.create.response.200.2.collection.collectionUrl`; string, required)
      - minLength: `1`
    - `type` (`commerce.paymentMethods.actions.create.response.200.2.collection.type`; string, required)
  - `setupId` (`commerce.paymentMethods.actions.create.response.200.2.setupId`; string, required)
    - minLength: `1`
- `object` (`commerce.paymentMethods.actions.create.response.200.3`)
  - `nextAction` (`commerce.paymentMethods.actions.create.response.200.3.nextAction`; object, required)
    - `clientSecret` (`commerce.paymentMethods.actions.create.response.200.3.nextAction.clientSecret`; string, required)
      - minLength: `1`
    - `type` (`commerce.paymentMethods.actions.create.response.200.3.nextAction.type`; string, required)
  - `setupId` (`commerce.paymentMethods.actions.create.response.200.3.setupId`; string, required)
    - minLength: `1`
- `object` (`commerce.paymentMethods.actions.create.response.200.4`)
  - `expiresAt` (`commerce.paymentMethods.actions.create.response.200.4.expiresAt`; any of, required)
    - any of the following: `string`, `null`
  - `paymentMethodId` (`commerce.paymentMethods.actions.create.response.200.4.paymentMethodId`; any of, required)
    - any of the following: `string`, `null`
  - `travelersTripId` (`commerce.paymentMethods.actions.create.response.200.4.travelersTripId`; any of, required)
    - any of the following: `string`, `null`
  - `url` (`commerce.paymentMethods.actions.create.response.200.4.url`; any of, required)
    - any of the following: `string`, `null`

### 400

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`commerce.paymentMethods.actions.create.response.400.errorCode`; string, required)
- `errorMessage` (`commerce.paymentMethods.actions.create.response.400.errorMessage`; string, required)

### 401

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`commerce.paymentMethods.actions.create.response.401.errorCode`; string, required)
- `errorMessage` (`commerce.paymentMethods.actions.create.response.401.errorMessage`; string, required)

### 403

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`commerce.paymentMethods.actions.create.response.403.errorCode`; string, required)
- `errorMessage` (`commerce.paymentMethods.actions.create.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/Commerce/commerce.paymentMethods.actions.create/index.md
