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

# Search payments

export const ApiEndpoint = ({method, path}) => {
  const getMethodColor = method => {
    switch (method?.toUpperCase()) {
      case "GET":
        return "#0285c7";
      case "POST":
        return "#008d71";
      case "PUT":
        return "#16a34a";
      case "PATCH":
        return "#808080";
      case "DELETE":
        return "#dc2626";
      default:
        return "#6b7280";
    }
  };
  const getEndpointUrl = (method, path) => {
    const endpoints = {
      "POST /client-session": "/api-reference/v2.4/api-reference/client-session-api/create-a-client-session",
      "PATCH /client-session": "/api-reference/v2.4/api-reference/client-session-api/update-client-session",
      "POST /payments": "/api-reference/v2.4/api-reference/payments-api/create-a-payment",
      "POST /payments/<YOUR-PAYMENT-ID>/resume": "/api-reference/v2.4/api-reference/payments-api/resume-payment",
      "POST /payments/<YOUR-PAYMENT-ID>/adjust-authorization": "/api-reference/v2.4/api-reference/payments-api/adjust-authorized-amount",
      "POST /payments/<PAYMENT_ID>/cancel": "/api-reference/v2.4/api-reference/payments-api/cancel-payment",
      "POST /payments/<PAYMENT_ID>/refund": "/api-reference/v2.4/api-reference/payments-api/refund-payment",
      "GET /payments/<PAYMENT_ID>": "/api-reference/v2.4/api-reference/payments-api/get-a-payment",
      "GET /payment-instruments": "/api-reference/v2.4/api-reference/payment-methods-api/list-saved-payment-methods",
      "DELETE /payment-instruments/<PAYMENT_METHOD_TOKEN>": "/api-reference/v2.4/api-reference/payment-methods-api/delete-payment-method-payment-methods-token-delete"
    };
    const key = `${method?.toUpperCase()} ${path}`;
    return endpoints[key] || "#";
  };
  const getPrettyPath = (method, path) => {
    const pathMapping = {
      "POST /payments/<YOUR-PAYMENT-ID>/resume": "/payments/{paymentId}/resume",
      "POST /payments/<YOUR-PAYMENT-ID>/adjust-authorization": "/payments/{paymentId}/adjust-authorization",
      "POST /payments/<PAYMENT_ID>/cancel": "/payments/{paymentId}/cancel",
      "POST /payments/<PAYMENT_ID>/refund": "/payments/{paymentId}/refund",
      "GET /payments/<PAYMENT_ID>": "/payments/{paymentId}",
      "DELETE /payment-instruments/<PAYMENT_METHOD_TOKEN>": "/payment-instruments/{paymentMethodToken}"
    };
    const key = `${method?.toUpperCase()} ${path}`;
    return pathMapping[key] || path;
  };
  const methodColor = getMethodColor(method);
  const url = getEndpointUrl(method, path);
  const displayPath = getPrettyPath(method, path);
  return <div style={{
    display: "inline-flex",
    alignItems: "center",
    cursor: "pointer",
    margin: "2px 0",
    padding: "4px",
    paddingRight: "6px",
    background: "rgb(245, 245, 245)",
    borderRadius: "6px",
    whiteSpace: "nowrap",
    textDecoration: "none"
  }}>
      <a href={url} target="_blank" rel="noopener noreferrer" style={{
    textDecoration: "none",
    border: "none"
  }}>
        <span style={{
    display: "inline-block",
    whiteSpace: "nowrap",
    padding: "0 8px",
    fontSize: "13px",
    lineHeight: "23px",
    borderRadius: "6px",
    fontWeight: 400,
    backgroundColor: methodColor,
    color: "white",
    border: "none"
  }}>
          {method.toUpperCase()}
        </span>
        <code style={{
    padding: "0",
    marginLeft: "4px",
    fontFamily: "monospace",
    color: methodColor,
    border: "none",
    textDecorationColor: methodColor
  }}>
          {displayPath}
        </code>
      </a>
    </div>;
};

## Search for a specific payment

You can search for a specific payment and get all the details via:

<CardGroup cols={2}>
  <Card title="Primer Dashboard" href="#search-for-a-specific-payment-via-the-primer-dashboard" icon="desktop">
    Easy-to-use UI to browse and review the details of all your payments.
  </Card>

  <Card title="Payments API" href="#search-for-a-specific-payment-via-payments-api" icon="user">
    Retrieve details of your payments programmatically via API.
  </Card>
</CardGroup>

### Search for a specific payment via the Primer Dashboard

Navigate to the [Payments](https://dashboard.primer.io/payments) section of the Primer Dashboard. To find your specific payment, either:

* scroll through until you find your payment
* enter the Primer payment ID into the search bar
* add your Primer payment ID to the following URL: `https://dashboard.primer.io/payments/<YOUR_PAYMENT_ID>`

All methods will direct you to the payment details page, where you will see a summary of the key details of the payment, along with a detailed timeline of all events during your payment’s lifecycle.

<Frame caption="Detailed payments timeline">
  ![Detailed payments
  timeline](https://goat-assets.production.core.primer.io/marketing/payment-operations/external-docs/search/detailed-payment-timeline.png)
</Frame>

View all the requests and responses for each event in the timeline by simply selecting it, along with a summary of the key details of the event.

<Frame caption="Timeline event summary example">
  ![Timeline event summary
  example](https://goat-assets.production.core.primer.io/marketing/payment-operations/external-docs/search/timeline-event-summary.png)
</Frame>

### Search for a specific payment via Payments API

Use the <ApiEndpoint method="GET" path="/payments/<PAYMENT_ID>" /> request to retrieve the full payment object. See the [API reference](/api-reference/v2.4/api-reference/payments-api/get-a-payment) for more details.

Include the Primer payment ID in the request which you will have received as part of the payment creation and authorization.

Below is an example response:

```json JSON theme={"dark"}
{
  "id": "kHdEw9EG",
  "date": "2021-02-21T15:36:16.367687",
  "status": "AUTHORIZED",
  "orderId": "order-abc",
  "customerId": "customer-123",
  "currencyCode": "EUR",
  "amount": 42,
  "paymentMethod": {
    "paymentMethodToken": "heNwnqaeRiqvY1UcslfQc3wxNjEzOTIxNjc4",
    "isVaulted": true,
    "descriptor": "Purchase: Socks",
    "analyticsId": "VtkMDAxZW5isH0HsbbNxZ3lo",
    "paymentMethodType": "PAYMENT_CARD",
    "paymentMethodData": {
      "first6Digits": "411111",
      "last4Digits": "1111",
      "expirationMonth": "12",
      "expirationYear": "2030",
      "cardholderName": "John Biggins",
      "network": "Visa",
      "isNetworkTokenized": false,
      "binData": {
        "network": "VISA",
        "regionalRestriction": "UNKNOWN",
        "accountNumberType": "UNKNOWN",
        "accountFundingType": "UNKNOWN",
        "prepaidReloadableIndicator": "NOT_APPLICABLE",
        "productUsageType": "UNKNOWN",
        "productCode": "VISA",
        "productName": "VISA"
      }
    }
  },
  "processor": {
    "name": "STRIPE",
    "processor_merchant_id": "acct_stripe_1234",
    "amountCaptured": 0,
    "amountRefunded": 0
  },
  "transactions": [
    {
      "type": "SALE",
      "processorStatus": "AUTHORIZED",
      "processorName": "STRIPE",
      "processorMerchantId": "acct_stripe_1234",
      "processorTransactionId": "54c4eb5b3ef8a"
    }
  ],
  "customer": {
    "email": "customer123@gmail.com"
  },
  "metadata": {
    "productId": 123,
    "merchantId": "a13bsd62s"
  }
}
```

## Search for a set of payments

Retrieve all payments or a subset of payments based on a set of conditions, including a date range, status, and other searchable fields.

Search for a set of payments via:

<CardGroup cols={2} stretch={true} rowGap={16} columnGap={16}>
  <Card title="Primer Dashboard" icon="desktop" href="#search-for-a-set-of-payments-via-the-primer-dashboard">
    Easy-to-use UI to browse and review the details of all your payments.
  </Card>

  <Card title="Payments API" icon="user" href="#search-for-a-set-of-payments-via-the-payments-api">
    Retrieve details of your payments programmatically via API.
  </Card>
</CardGroup>

### Search for a set of payments via the Primer Dashboard

Navigate to the [Payments](https://dashboard.primer.io/payments) section of the Primer Dashboard. You can search in two ways:

* Use the search bar and enter multiple terms separated with commas
* Use the [Filters](/concepts/filters-&-dimensions)

The filters are comprehensive and allow you to retrieve the subset of payments you are looking for based on:

* date range
* currency and amount
* status
* processor
* payment method
* events
* decline types and reasons

<Frame caption="Filters example">![Filters example](https://goat-assets.production.core.primer.io/marketing/payment-operations/external-docs/search/payment-filters.png)</Frame>

### Search for a set of payments via the Payments API

Use the [`GET list payments`](/api-reference/v2.4/api-reference/payments-api/get-a-payment) request to retrieve a list of payments.

Filter your payments on as many conditions as you’d like and separate multiple query parameters with the `&` symbol.

Results are paginated and will return up to 100 payments in a single call. To access the next page of results, set the `cursor` parameter to the value of `nextCursor` from the last result payload.

This endpoint returns a list of summarized payment objects i.e. not the full payment object outputted in the `GET` call when retrieving a specific payment.

Here is an example response:

```json JSON theme={"dark"}
{
  "data": [
    {
      "id": "IHQlakKC",
      "date": "2021-03-24T14:56:56.869248",
      "status": "SETTLED",
      "orderId": "my-order-123",
      "currencyCode": "EUR",
      "amount": 700,
      "processor": {
        "name": "STRIPE",
        "processorMerchantId": "acct_stripe_1234"
      },
      "metadata": {
        "productId": 123,
        "merchantId": "a13bsd62s"
      }
    }
  ],
  "nextCursor": "string",
  "prevCursor": "string"
}
```

See the [API reference](/api-reference/v2.4/api-reference/payments-api/get-a-payment) for the full list of query parameters.

<Note>
  Payments will be available up to a minute from being created.
</Note>
