---
title: "Complete a card authorization"
---

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

# Complete a card authorization

Path: Nicer API › Commerce

`POST /commerce/payment-methods/complete-card-link`

URL: `https://api.nicer.travel/commerce/payment-methods/complete-card-link`

Completes a single-use card authorization link with the card the card page has just stored: the body names that card (`paymentMethodId`) and echoes the exact statement the page showed, which must still be the link's. No card number travels on this route. Whoever holds the link may complete it: its capability travels as `Authorization: PaymentLink <token>` or `X-Payment-Link-Token`, and a link for a personal card also needs its owner signed in. The card is then authorized to whom the link names (the advisor who made it, its trip, or its owner), and the answer is COMPLETED with the card's paymentMethodId. Requires an Idempotency-Key. Errors: 401 ERROR_AUTHENTICATION_REQUIRED without a capability; 409 COMMERCE_PAYMENT_METHOD_CONSENT_CHANGED when the statement changed since the page showed it; 409 COMMERCE_PAYMENT_METHOD_LINK_CONSUMED for a link already completed with another card.

## Authentication

Requires one of the following:

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

## Header parameters

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

## Request body

_Required._

- `consentAccepted` (`commerce.paymentMethods.completeCardLink.consentAccepted`; boolean, required)
- `consentCopy` (`commerce.paymentMethods.completeCardLink.consentCopy`; string, required) — The statement the person accepted: the link's consentCopy exactly as the card page showed it. The server refuses the completion when it is no longer the link's statement.
  - minLength: `1`
- `paymentMethodId` (`commerce.paymentMethods.completeCardLink.paymentMethodId`; string, required)
  - maxLength: `255` · pattern: `^paym_.*`
- `type` (`commerce.paymentMethods.completeCardLink.type`; string, required)

## Example request

```json
{
  "consentAccepted": true,
  "consentCopy": "string",
  "paymentMethodId": "string",
  "type": "COMPLETE_TRIP_CARD_LINK"
}
```

## 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.completeCardLink({
  "consentAccepted": true,
  "consentCopy": "string",
  "paymentMethodId": "string",
  "type": "COMPLETE_TRIP_CARD_LINK"
});
```

### Nicer CLI

```bash
nicer commerce payment-methods complete-card-link --input - <<'JSON'
{
  "consentAccepted": true,
  "consentCopy": "string",
  "paymentMethodId": "string",
  "type": "COMPLETE_TRIP_CARD_LINK"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url https://api.nicer.travel/commerce/payment-methods/complete-card-link \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: string' \
  --data '
{
  "consentAccepted": true,
  "consentCopy": "string",
  "paymentMethodId": "string",
  "type": "COMPLETE_TRIP_CARD_LINK"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/commerce/payment-methods/complete-card-link';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'Idempotency-Key': 'string'},
  body: JSON.stringify({
    consentAccepted: true,
    consentCopy: 'string',
    paymentMethodId: 'string',
    type: 'COMPLETE_TRIP_CARD_LINK'
  })
};

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/complete-card-link"

payload = {
    "consentAccepted": True,
    "consentCopy": "string",
    "paymentMethodId": "string",
    "type": "COMPLETE_TRIP_CARD_LINK"
}
headers = {
    "Content-Type": "application/json",
    "Idempotency-Key": "string"
}

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.completeCardLink.response.200.1`)
  - `methods` (`commerce.paymentMethods.completeCardLink.response.200.1.methods`; array of object, required)
    - `authorizations` (`commerce.paymentMethods.completeCardLink.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.completeCardLink.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.completeCardLink.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.completeCardLink.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.completeCardLink.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.completeCardLink.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.completeCardLink.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.completeCardLink.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.completeCardLink.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.completeCardLink.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.completeCardLink.response.200.1.methods.brand`; any of, required)
      - any of the following: `string`, `null`
    - `expiry` (`commerce.paymentMethods.completeCardLink.response.200.1.methods.expiry`; any of, required)
      - any of the following: `string`, `null`
    - `label` (`commerce.paymentMethods.completeCardLink.response.200.1.methods.label`; string, required)
      - maxLength: `200` · minLength: `1`
    - `last4` (`commerce.paymentMethods.completeCardLink.response.200.1.methods.last4`; any of, required)
      - any of the following: `string`, `null`
    - `paymentMethodId` (`commerce.paymentMethods.completeCardLink.response.200.1.methods.paymentMethodId`; string, required)
      - maxLength: `255` · minLength: `1`
    - `scopes` (`commerce.paymentMethods.completeCardLink.response.200.1.methods.scopes`; array of string, required)
      - one of `"USER"`, `"TRIP"`, `"ADVISOR"`
    - `usable` (`commerce.paymentMethods.completeCardLink.response.200.1.methods.usable`; boolean, required)
    - `usableUntil` (`commerce.paymentMethods.completeCardLink.response.200.1.methods.usableUntil`; any of, required)
      - any of the following: `string`, `null`
- `object` (`commerce.paymentMethods.completeCardLink.response.200.2`)
  - `collection` (`commerce.paymentMethods.completeCardLink.response.200.2.collection`; object, required)
    - `collectionToken` (`commerce.paymentMethods.completeCardLink.response.200.2.collection.collectionToken`; string, required)
      - minLength: `1`
    - `collectionUrl` (`commerce.paymentMethods.completeCardLink.response.200.2.collection.collectionUrl`; string, required)
      - minLength: `1`
    - `type` (`commerce.paymentMethods.completeCardLink.response.200.2.collection.type`; string, required)
  - `setupId` (`commerce.paymentMethods.completeCardLink.response.200.2.setupId`; string, required)
    - minLength: `1`
- `object` (`commerce.paymentMethods.completeCardLink.response.200.3`)
  - `nextAction` (`commerce.paymentMethods.completeCardLink.response.200.3.nextAction`; object, required)
    - `clientSecret` (`commerce.paymentMethods.completeCardLink.response.200.3.nextAction.clientSecret`; string, required)
      - minLength: `1`
    - `type` (`commerce.paymentMethods.completeCardLink.response.200.3.nextAction.type`; string, required)
  - `setupId` (`commerce.paymentMethods.completeCardLink.response.200.3.setupId`; string, required)
    - minLength: `1`
- `object` (`commerce.paymentMethods.completeCardLink.response.200.4`)
  - `expiresAt` (`commerce.paymentMethods.completeCardLink.response.200.4.expiresAt`; any of, required)
    - any of the following: `string`, `null`
  - `paymentMethodId` (`commerce.paymentMethods.completeCardLink.response.200.4.paymentMethodId`; any of, required)
    - any of the following: `string`, `null`
  - `travelersTripId` (`commerce.paymentMethods.completeCardLink.response.200.4.travelersTripId`; any of, required)
    - any of the following: `string`, `null`
  - `url` (`commerce.paymentMethods.completeCardLink.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.completeCardLink.response.400.errorCode`; string, required)
- `errorMessage` (`commerce.paymentMethods.completeCardLink.response.400.errorMessage`; string, required)

### 401

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

#### Example

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

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

### 403

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

#### Example

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

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

### 429

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

#### Example

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

- `errorCode` (`commerce.paymentMethods.completeCardLink.response.429.errorCode`; string, required)
- `errorMessage` (`commerce.paymentMethods.completeCardLink.response.429.errorMessage`; string, required)


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