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

# Integrate as a Merchant

> Use your own credential to create payment transactions, refund them and run your webhooks

A merchant's own credential creates payment transactions, refunds them and runs the merchant's webhook endpoints. It does the merchant's onboarding too, apart from starting identity checks and requesting capabilities, which its partner does.

| # | Step | Who |
| - | - | - |
| 1 | Find your credential in Console | **Person** |
| 2 | Get a token, and read your API key | API |
| 3 | List your transactions | API |
| 4 | After an event, read the payment transaction | API |
| 5 | List your webhook endpoints | API |
| 6 | Create an endpoint | API |
| 7 | Change an endpoint | API |
| 8 | Rotate an endpoint's secret | API |

## 1. Find Your Credential

Someone at the merchant signs in to the [Quidkey Console](https://console.quidkey.com) and copies the `client_id` and `client_secret`. Revoking or rotating the secret happens there too, not through the API. A token issued before the secret was revoked or rotated stops working. **Person.**

## 2. Get a Token and Read Your API Key

Exchange the credential for a token as [Getting started](https://docs.quidkey.com/api-v1/getting-started.md) shows, then:

```bash theme={null}
curl 'https://api.quidkey.com/v1/api-keys/current?include=owner' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
```

`owner` links to your merchant, and `?include=owner` adds it to `entities`. Its `id` is your merchant ID.

## 3. List Your Transactions

```bash theme={null}
curl 'https://api.quidkey.com/v1/merchants/m_1/transactions' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
```

The list holds live payment transactions, refunds and reversals, newest first, in the summary view. It takes [filters](https://docs.quidkey.com/api-v1/standards/collections.md#filtering) such as `type`, `status`, `order_id` and `created_at` ranges.

## 4. Read a Payment Transaction After an Event

```bash theme={null}
curl 'https://api.quidkey.com/v1/transactions/tx_1?include=customer_details' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
```

## 5. List Your Webhook Endpoints

```bash theme={null}
curl 'https://api.quidkey.com/v1/merchants/m_1/webhook-endpoints' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
```

A merchant can have several endpoints, each with a `name`.

## 6. Create an Endpoint

```bash theme={null}
curl -X POST 'https://api.quidkey.com/v1/merchants/m_1/webhook-endpoints' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Idempotency-Key: "0b8e3f4a-3c5d-4f7e-8a9b-1c2d3e4f5a6b"' \
  -H 'Content-Type: application/json' \
  -d '{ "name": "orders", "url": "https://api.example.com/webhooks/quidkey" }'
```

The answer holds `signing_secret` once: store it now. If it has none, as a replay doesn't, `:rotateSecret` issues one. `name` is unique to the merchant and can't change. `is_signed` defaults to `true`.

## 7. Change an Endpoint

```bash theme={null}
curl -X PATCH 'https://api.quidkey.com/v1/webhook-endpoints/we_1' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{ "is_default": true }'
```

A `PATCH` takes `url`, `status`, `is_signed` and `is_default`. A merchant with more than one active endpoint sets a default, or names endpoints on each payment transaction in `webhook_endpoints`: otherwise an event has nowhere to go. `is_default: true` needs an `active` endpoint, and clears any other default. Turning `is_signed` on for an endpoint with no secret answers with a new `signing_secret`, once.

## 8. Rotate a Secret

```bash theme={null}
curl -X POST 'https://api.quidkey.com/v1/webhook-endpoints/we_1:rotateSecret' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
```

The answer holds the new `signing_secret`. It replaces the old one at once, with no overlap, so deploy the new secret to your receiver straight away. It isn't safe to repeat: each call replaces the secret again.

## What a Merchant Credential Can't Do

Starting a party's identity check and requesting a capability answer 403: its partner does both.

The rest of [Onboard a Merchant](https://docs.quidkey.com/api-v1/journeys/onboard-a-merchant.md) works with the merchant's credential, as with its partner's. It reads the merchant's `onboarding` and `capabilities`, which list what's still needed, creates the legal entity, adds the owners, directors and bank accounts, and records what a person at the merchant accepts: in `consent` on a create, or later through `POST /merchants/{id}/agreement-acceptances`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.