# Create a payment method

`POST https://app.shuttleglobal.com/c/api/instances/{instance_key}/payment_methods`

Create a new payment method. This API supports two main use cases:
1. Data import/copy (token import)
2. Third-party UI integration (payment details capture and gateway tokenization)

For third-party UI integration or custom tokenization flows, please contact support
as additional gateway-specific requirements may apply.

## Authentication

- basicAuth: Basic Authentication using secret key
- bearerAuth: OAuth 2.0 Bearer Token Authentication

## Request body (`application/json`), required

- `payment_method` (object, required)
  - `account` (one of, required): Account this payment method belongs to
  - `address` (object): Address fields. All fields are optional and any values are accepted to prevent interrupting payments due to address validation issues. Field behavior: 1. When updating an address, the entire address object is replaced with the new values 2. To clear/null out all address fields, set each field to an empty string Client applications can implement their own validation if needed.
    - `country` (string): Country code (any format accepted). Set to empty string to clear.
    - `line1` (string): First line of the address. Set to empty string to clear.
    - `line2` (string): Second line of the address. Set to empty string to clear.
    - `line3` (string): Third line of the address. Set to empty string to clear.
    - `line4` (string): City/Town. Set to empty string to clear.
    - `line5` (string): Postcode/ZIP. Set to empty string to clear.
    - `line6` (string): State/Region. Set to empty string to clear.
  - `code` (string): Your ID for this payment method
  - `expiry` (string): Expiry date in MM/YYYY format
  - `gateway` (string): Gateway this payment method is linked to
  - `last4` (string): Last 4+ digits of the payment method identifier
  - `manual` (boolean): Must be true for token import, false for third-party UI integration
  - `name` (string): Display name of the payment method
  - `requires_cvc` (boolean): Whether CVC is required for ecommerce/MOTO payments
  - `status` (string): Initial status of the payment method One of: `ACTIVE`, `FAILING`.
  - `token` (string): Gateway token (format varies by gateway)
  - `type` (string): Payment method type (e.g., VISA, MASTERCARD, SEPA, ACH)
  - `source` (string): Source of the payment method One of: `ECOMMERCE`, `MOTO`, `POS`.
  - `tags` (string): CSV of tags/references
  - `metadata` (object): Custom key-value pairs
  - `bin` (string): Card BIN number
  - `card_number` (string): Card number. Non-digits are stripped. Required unless a bank detail set, a wallet detail set or a `token` is sent.
  - `card_expiry` (string): Card expiry. Alias of `expiry`. Accepts MMYY, MM/YY, M/YY or MYY and is stored as a month.
  - `card_cvc` (string): Card security code. Passed to the gateway and never stored.
  - `iban` (string): IBAN. Alias `sepa_iban`. Makes the method SEPA.
  - `account_holder_name` (string): Name on the bank account. Aliases `cardholder_name`, `sepa_account_holder_name`, `ach_account_holder_name`.
  - `account_type` (string): Bank account type: `checking`, `savings` or `businessChecking`. Alias `ach_account_type`. Makes the method ACH.
  - `routing_number` (string): Bank routing number. Alias `ach_routing_number`.
  - `account_number` (string): Bank account number. Alias `ach_account_number`. Makes the method BACS when no other type applies.
  - `contracts` (array of string): Ids of the contracts this payment method is attached to once it is active.

## Responses

### 200: Payment method created

```json
{
  "payment_method": {
    "id": "string",
    "account": "string",
    "address": {
      "country": "string",
      "line1": "string",
      "line2": "string",
      "line3": "string",
      "line4": "string",
      "line5": "string",
      "line6": "string"
    },
    "advanced_notice_hours": 180,
    "archived": "2026-01-01T12:00:00Z",
    "authorisation_url": "string",
    "code": "string",
    "created": "2026-01-01T12:00:00Z",
    "created_session": "string",
    "expiry": "string",
    "failing_reason": "string",
    "failing_since": "2026-01-01T12:00:00Z",
    "gateway": "string",
    "gateway_group": "string",
    "gateway_status": "string",
    "last4": "string",
    "last_used": "2026-01-01T12:00:00Z",
    "mandate_id": "string",
    "mandate_link": "string",
    "mandate_reference": "string",
    "mandate_text": "string",
    "name": "string",
    "requires_cvc": true,
    "source": "MOTO",
    "status": "ACTIVE",
    "sub_status": "string",
    "sub_status_reason": "string",
    "tags": "string",
    "metadata": {},
    "bin": "string",
    "card_holder_name": "string",
    "eci": "string",
    "network_token": true,
    "source_type": "string",
    "token": "string",
    "type": "string",
    "updated_session": "string",
    "v": 0
  }
}
```

### 400: Bad request

```json
{
  "code": "string",
  "message": "string"
}
```

### 401: Authentication required

```json
{
  "code": "UNAUTHORIZED",
  "message": "Unauthorised"
}
```

### 404: Instance not found (only checked after successful authentication)

```json
{
  "code": "string",
  "message": "string"
}
```

### 500: Internal server error

```json
{
  "error": {
    "type": "string",
    "message": "string"
  }
}
```

## Example request

```sh
curl --request POST \
  --url https://app.shuttleglobal.com/c/api/instances/YOUR_INSTANCE_KEY/payment_methods \
  --header 'Authorization: Basic <base64 of SECRET_KEY:>' \
  --header 'Content-Type: application/json' \
  --data '{
  "payment_method": {
    "account": "string"
  }
}'
```

Reference page: https://docs.shuttleglobal.com/platforms/reference/operations/createpaymentmethod/