# Retrieve Payment by ID

This request enables you to retrieve details of payments based on their `id`,  which needs to be provided in the request path.

**GET** `/payments/{payment_id}`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Retrieve Payment by ID

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)

## Path parameters

- `payment_id` (string, required)

## Query parameters

- `raw_response` (boolean)
  When true, includes the provider raw response in the output (default false).
- `transactions_history` (boolean)
  When true, includes the transactions history in the response (default false).

## Responses

### 200

200

- `id` (string)
- `account_id` (string)
- `description` (string)
- `country` (string)
- `status` (string)
- `sub_status` (string)
- `merchant_order_id` (string)
- `created_at` (string)
- `updated_at` (string)
- `amount` (object)
  - `captured` (integer)
  - `currency` (string)
  - `refunded` (integer)
  - `value` (integer)
- `checkout` (object)
  - `session` (string)
  - `sdk_action_required` (boolean)
- `payment_method` (object)
  - `vaulted_token` (string)
  - `type` (string)
  - `vault_on_success` (boolean)
  - `token` (string)
  - `payment_method_detail` (object)
    - `bank_transfer` (object)
      - `provider_image` (string)
      - `account_type` (any)
      - `bank_name` (string)
      - `beneficiary_name` (string)
      - `bank_account` (string)
      - `bank_account_2` (any)
      - `beneficiary_document_type` (string)
      - `beneficiary_document` (string)
      - `payment_instruction` (any)
      - `redirect_url` (string)
      - `bank_account_mask_number` (string)
        Masked bank account number associated with the bank transfer (for example, ****6789). This is account data, not mandate data.
      - `mandate` (object)
        Direct debit mandate details, for bank transfer methods that operate with mandates (for example, ACH, SEPA, BACS, PAD).
        - `id` (string)
          Mandate identifier, as provided by the payment provider.
        - `info` (string)
          Free-text mandate information.
        - `received_status` (string)
          Provider status indicating whether the mandate was received. Forwarded as provided by the payment provider.
        - `existing_status` (string)
          Provider status of the existing mandate. Forwarded as provided by the payment provider.
        - `created_at` (string<date-time>)
          Date and time when the mandate was created (ISO 8601).
        - `updated_at` (string<date-time>)
          Date and time when the mandate was last updated (ISO 8601).
- `customer_payer` (object)
  - `id` (string)
  - `merchant_customer_id` (string)
  - `first_name` (string)
  - `last_name` (string)
  - `gender` (string)
  - `date_of_birth` (string)
  - `email` (string)
  - `nationality` (string)
  - `ip_address` (string)
  - `device_fingerprint` (any)
  - `browser_info` (object)
    - `user_agent` (string)
    - `accept_header` (string)
    - `accept_content` (any)
    - `accept_browser` (any)
    - `color_depth` (string)
    - `screen_height` (string)
    - `screen_width` (string)
    - `javascript_enabled` (any)
    - `java_enabled` (any)
    - `browser_time_difference` (any)
    - `language` (string)
  - `document` (object)
    - `document_type` (string)
    - `document_number` (string)
  - `phone` (object)
    - `number` (string)
    - `country_code` (string)
  - `billing_address` (object)
    - `address_line_1` (string)
    - `address_line_2` (any)
    - `city` (string)
    - `state` (string)
    - `country` (string)
    - `zip_code` (string)
  - `shipping_address` (object)
    - `address_line_1` (string)
    - `address_line_2` (any)
    - `city` (string)
    - `state` (string)
    - `country` (string)
    - `zip_code` (string)
- `additional_data` (any)
- `taxes` (any)
- `transactions` (object[])
  - `id` (string)
  - `type` (string)
  - `status` (string)
  - `category` (string)
  - `amount` (integer)
  - `provider_id` (string)
  - `payment_method` (object)
    - `vaulted_token` (string)
    - `type` (string)
    - `vault_on_success` (boolean)
    - `token` (string)
    - `detail` (object)
      - `bank_transfer` (object)
        - `provider_image` (string)
        - `account_type` (any)
        - `bank_name` (string)
        - `beneficiary_name` (string)
        - `bank_account` (string)
        - `bank_account_2` (any)
        - `beneficiary_document_type` (string)
        - `beneficiary_document` (string)
        - `payment_instruction` (any)
        - `redirect_url` (string)
        - `bank_account_mask_number` (string)
          Masked bank account number associated with the bank transfer (for example, ****6789). This is account data, not mandate data.
        - `mandate` (object)
          Direct debit mandate details, for bank transfer methods that operate with mandates (for example, ACH, SEPA, BACS, PAD).
          - `id` (string)
            Mandate identifier, as provided by the payment provider.
          - `info` (string)
            Free-text mandate information.
          - `received_status` (string)
            Provider status indicating whether the mandate was received. Forwarded as provided by the payment provider.
          - `existing_status` (string)
            Provider status of the existing mandate. Forwarded as provided by the payment provider.
          - `created_at` (string<date-time>)
            Date and time when the mandate was created (ISO 8601).
          - `updated_at` (string<date-time>)
            Date and time when the mandate was last updated (ISO 8601).
  - `response_code` (string)
  - `response_message` (string)
  - `reason` (any)
  - `description` (string)
  - `merchant_reference` (any)
  - `provider_data` (object)
    - `id` (string)
    - `transaction_id` (string)
    - `account_id` (string)
    - `status` (string)
    - `status_detail` (string)
    - `response_code` (string)
    - `response_message` (string)
    - `iso8583_response_code` (string)
    - `iso8583_response_message` (string)
    - `raw_request` (object)
      Obfuscated copy of the request WHITELABEL sent to the provider. Only returned for allowlisted organizations.
    - `raw_response` (object)
      - `data` (object)
        - `amount_in_cents` (integer)
        - `bill_id` (any)
        - `billing_data` (any)
        - `created_at` (string)
        - `currency` (string)
        - `customer_data` (any)
        - `customer_email` (string)
        - `finalized_at` (any)
        - `id` (string)
        - `payment_link_id` (any)
        - `payment_method` (object)
          - `extra` (object)
            - `is_three_ds` (boolean)
          - `payment_description` (string)
          - `sandbox_status` (string)
          - `type` (string)
          - `user_type` (string)
        - `payment_method_type` (string)
        - `payment_source_id` (any)
        - `redirect_url` (string)
        - `reference` (string)
        - `shipping_address` (object)
          - `address_line_1` (string)
          - `address_line_2` (any)
          - `city` (string)
          - `state` (string)
          - `country` (string)
          - `zip_code` (string)
        - `status` (string)
        - `status_message` (any)
        - `taxes` (any[])
      - `meta` (object)
    - `third_party_transaction_id` (string)
  - `three_d_secure_action_required` (any)
  - `created_at` (string)
  - `updated_at` (string)
- `split` (any[])
- `callback_url` (string)
- `workflow` (string)
- `metadata` (any[])
- `plan_id` (string)
  The subscription's plan when this payment was created. Present only on payments created with `subscription.plan_id` and on their renewals; absent otherwise.
- `plan_assigned_at` (string<date-time>)
  When the plan was assigned to the subscription (UTC, ISO 8601). Present only on payments that carry `plan_id`.

Example:

```json
{
  "id": "e3f397ed-b7d0-4816-ab75-8457b0a30ec1",
  "account_id": "493e9374-510a-4201-9e09-de669d75f256",
  "description": "Test Bank of America",
  "country": "US",
  "status": "READY_TO_PAY",
  "sub_status": "CREATED",
  "merchant_order_id": "0000022",
  "created_at": "2023-07-20T17:24:58.900553Z",
  "updated_at": "2023-07-20T17:25:13.447662Z",
  "amount": {
    "captured": 0,
    "currency": "USD",
    "refunded": 0,
    "value": 52000
  },
  "checkout": {
    "session": "954dc216-60ff-4ae4-a299-c603b93bd267",
    "sdk_action_required": true
  },
  "payment_method": {
    "vaulted_token": "",
    "type": "BANK_TRANSFER",
    "vault_on_success": false,
    "token": "2cd31999-e44e-4de3-bbe4-179981ff4295",
    "payment_method_detail": {
      "bank_transfer": {
        "provider_image": "",
        "account_type": null,
        "bank_name": "Bank of America",
        "beneficiary_name": "John Doe",
        "bank_account": "123456789",
        "bank_account_2": null,
        "beneficiary_document_type": "SSN",
        "beneficiary_document": "123-45-6789",
        "payment_instruction": null,
        "redirect_url": "https://api-sandbox.bankofamerica.com/v1/payment_methods/redirect/bank_transfer?transferCode=52xB9jF695TdDvHK-approved",
        "bank_account_mask_number": "string",
        "mandate": {
          "id": "string",
          "info": "string",
          "received_status": "string",
          "existing_status": "string",
          "created_at": "1970-01-01T00:00:00.000Z",
          "updated_at": "1970-01-01T00:00:00.000Z"
        }
      }
    }
  },
  "customer_payer": {
    "id": "cfae0941-7234-427a-a739-ef4fce966c79",
    "merchant_customer_id": "1689873883",
    "first_name": "John",
    "last_name": "Doe",
    "gender": "M",
    "date_of_birth": "1980-01-01",
    "email": "johndoe@gmail.com",
    "nationality": "US",
    "ip_address": "192.168.1.1",
    "device_fingerprint": null,
    "browser_info": {
      "user_agent": "",
      "accept_header": "",
      "accept_content": null,
      "accept_browser": null,
      "color_depth": "",
      "screen_height": "",
      "screen_width": "",
      "javascript_enabled": null,
      "java_enabled": null,
      "browser_time_difference": null,
      "language": ""
    },
    "document": {
      "document_type": "SSN",
      "document_number": "123-45-6789"
    },
    "phone": {
      "number": "5551234567",
      "country_code": "1"
    },
    "billing_address": {
      "address_line_1": "123 Main Street",
      "address_line_2": null,
      "city": "New York",
      "state": "NY",
      "country": "US",
      "zip_code": "10001"
    },
    "shipping_address": {
      "address_line_1": "123 Main Street",
      "address_line_2": null,
      "city": "New York",
      "state": "NY",
      "country": "US",
      "zip_code": "10001"
    }
  },
  "additional_data": null,
  "taxes": null,
  "transactions": [
    {
      "id": "09135cb9-159c-4662-8fe3-da5523bb2266",
      "type": "PURCHASE",
      "status": "SUCCEEDED",
      "category": "BANK_TRANSFER",
      "amount": 52000,
      "provider_id": "BANK_OF_AMERICA",
      "payment_method": {
        "vaulted_token": "",
        "type": "BANK_TRANSFER",
        "vault_on_success": false,
        "token": "2cd31999-e44e-4de3-bbe4-179981ff4295",
        "detail": {
          "bank_transfer": {
            "provider_image": "",
            "account_type": null,
            "bank_name": "Bank of America",
            "beneficiary_name": "John Doe",
            "bank_account": "123456789",
            "bank_account_2": null,
            "beneficiary_document_type": "SSN",
            "beneficiary_document": "123-45-6789",
            "payment_instruction": null,
            "redirect_url": "https://api-sandbox.bankofamerica.com/v1/payment_methods/redirect/bank_transfer?transferCode=52xB9jF695TdDvHK-approved",
            "bank_account_mask_number": "string",
            "mandate": {
              "id": null,
              "info": null,
              "received_status": null,
              "existing_status": null,
              "created_at": null,
              "updated_at": null
            }
          }
        }
      },
      "response_code": "SUCCEEDED",
      "response_message": "Transaction successful",
      "reason": null,
      "description": "Test Bank of America",
      "merchant_reference": null,
      "provider_data": {
        "id": "BANK_OF_AMERICA",
        "transaction_id": "117490-1689873907-17347",
        "account_id": "",
        "status": "APPROVED",
        "status_detail": "",
        "response_code": "",
        "response_message": "",
        "iso8583_response_code": "00",
        "iso8583_response_message": "Approved or completed successfully",
        "raw_request": {},
        "raw_response": {
          "data": {
            "amount_in_cents": 5200000,
            "bill_id": null,
            "billing_data": null,
            "created_at": "2023-07-20T17:25:07.167Z",
            "currency": "USD",
            "customer_data": null,
            "customer_email": "johndoe@gmail.com",
            "finalized_at": null,
            "id": "117490-1689873907-17347",
            "payment_link_id": null,
            "payment_method": {
              "extra": null,
              "payment_description": "Test Bank of America",
              "sandbox_status": "APPROVED",
              "type": "BANK_TRANSFER",
              "user_type": "PERSON"
            },
            "payment_method_type": "BANK_TRANSFER",
            "payment_source_id": null,
            "redirect_url": "https://google.com/?checkoutSession=954dc216-60ff-4ae4-a299-c603b93bd267",
            "reference": "09135cb9-159c-4662-8fe3-da5523bb2266",
            "shipping_address": {
              "address_line_1": "123 Main Street",
              "address_line_2": null,
              "city": "New York",
              "state": "NY",
              "country": "US",
              "zip_code": "10001"
            },
            "status": "PENDING",
            "status_message": null,
            "taxes": [
              null
            ]
          },
          "meta": {}
        },
        "third_party_transaction_id": ""
      },
      "three_d_secure_action_required": null,
      "created_at": "2023-07-20T17:25:05.410687Z",
      "updated_at": "2023-07-20T17:25:11.472652Z"
    }
  ],
  "split": [
    null
  ],
  "callback_url": "https://whitelabel.com/?checkoutSession=954dc216-60ff-4ae4-a299-c603b93bd267",
  "workflow": "SDK_CHECKOUT",
  "metadata": [
    null
  ],
  "plan_id": "string",
  "plan_assigned_at": "1970-01-01T00:00:00.000Z"
}
```

### 400

400

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "INVALID_REQUEST",
  "messages": [
    "Invalid request"
  ]
}
```

### 401

401

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "INVALID_CREDENTIALS",
  "messages": [
    "Invalid Credentials"
  ]
}
```

### 403

403

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "AUTHORIZATION_REQUIRED",
  "messages": [
    "The merchant has no authorization to use this API"
  ]
}
```