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

# Quickstart

> Tokenize a card and process a payment in minutes using PCI Booking's hosted card form and Universal Payment Gateway

This quickstart walks through one common flow: capture a card using the hosted card entry form, inspect the token, and process a payment through the Universal Payment Gateway.

This is one example. Each step has alternatives you can swap in depending on your use case:

| Step | This Example | Other Options |
| - | - | - |
| **Tokenize** | Hosted Card Entry Form (iframe) | [Card By Link](https://developers.pcibooking.net/capture-cards/card-by-link.md), [Payments Library](https://developers.pcibooking.net/payments-library/setup.md), [Card Migration](https://developers.pcibooking.net/capture-cards/store-card-migration.md), [Tokenization on Response](https://developers.pcibooking.net/capture-cards/tokenization-on-response.md) |
| **Inspect** | Query token metadata | [Query by reference](https://developers.pcibooking.net/manage-tokens/query-retrieve.md) |
| **Use** | Charge via UPG | [Authorize & Capture](https://developers.pcibooking.net/use-tokens/authorize-capture.md), [Token Replacement](https://developers.pcibooking.net/use-tokens/token-replacement-in-request.md), [Card Display](https://developers.pcibooking.net/use-tokens/card-display.md) |

See [Capture Cards Overview](https://developers.pcibooking.net/capture-cards/overview.md) and [Use Tokens Overview](https://developers.pcibooking.net/use-tokens/overview.md) for the full list.

**Before you start:** you need a PCI Booking sandbox account. [Request one here](https://pcibooking.net/sandbox/). We set it up and email you the login details.

> [!TIP]
>
> Want to see the flow before you build it? The [card entry form demo](https://demo.pcibooking.net/demos/card-form-iframe.html) runs it on a hotel checkout page, with 3D Secure. For the same flow as complete page and server code, see the [complete checkout example](https://developers.pcibooking.net/use-cases/example-checkout-page-3ds.md). All demos are on [Live Demos](https://developers.pcibooking.net/start-here/live-demos.md).

***

## Step 1: Authenticate

Log in to your PCI Booking account and navigate to the API Keys section. Copy your API key. You will use it for server-to-server calls in the format:

```http theme={null}
Authorization: APIKEY your-api-key
```

The hosted card entry form runs in the cardholder's browser, so it cannot use your API key directly. Instead, generate a temporary session token via [Start a Temporary Session](https://developers.pcibooking.net/api-reference/general/start-temporary-session.md):

```bash theme={null}
curl -X POST https://service.pcibooking.net/api/payments/paycard/tempsession \
  -H "Authorization: APIKEY your-api-key"
```

The response is the session token as a JSON string, in quotes. Parse it as JSON, or remove the quotes, before you use it:

```json theme={null}
"33b245a015cf4d10a3ca885e7f4c5600"
```

The session token is valid for 5 minutes and can be used more than once in that time.

Save this token. You will pass it as a query parameter when building the card form URL in the next step.

## Step 2: Tokenize a Card

Build a URL to the PCI Booking hosted card entry form. This URL is the `src` of an iframe you embed in your page. When the browser loads this URL, PCI Booking serves a secure card entry form directly to the cardholder. Card data never touches your servers.

The URL includes the session token from Step 1 and your configuration as query parameters:

```text theme={null}
https://service.pcibooking.net/api/payments/capturecard?sessionToken=YOUR_SESSION_TOKEN&brand=YOUR_USERNAME&language=en&postMessageHost=https%3A%2F%2Fyoursite.com&autoDetectCardType=true&success=https://yoursite.com/success&failure=https://yoursite.com/failure
```

This example uses only a few basic parameters. The card entry form supports many additional options including custom styling, card type restrictions, CVV requirements, and more. See the [full parameter reference](https://developers.pcibooking.net/api-reference/tokenize-cards/request-card-entry-form.md) for the complete list.

Embed it in your page:

```html theme={null}
<iframe
  src="https://service.pcibooking.net/api/payments/capturecard?sessionToken=YOUR_SESSION_TOKEN&brand=YOUR_USERNAME&language=en&autoDetectCardType=true&success=https://yoursite.com/success&failure=https://yoursite.com/failure"
  width="400"
  height="350"
  frameborder="0">
</iframe>
```

After the cardholder submits the form, PCI Booking tokenizes the card and redirects to your `success` URL with the token appended. You can also use a [callback URL](https://developers.pcibooking.net/capture-cards/hosted-card-entry-form.md) instead of redirect URLs.

> [!NOTE]
>
> There are other ways to tokenize cards: [Card Entry Form Sessions](https://developers.pcibooking.net/capture-cards/hosted-card-entry-form.md), [Card By Link](https://developers.pcibooking.net/capture-cards/card-by-link.md), [Payments Library](https://developers.pcibooking.net/payments-library/setup.md), [direct API storage](https://developers.pcibooking.net/capture-cards/store-card-migration.md), and more. See [Capture Cards Overview](https://developers.pcibooking.net/capture-cards/overview.md).

## Step 3: Retrieve Your Token

Confirm the card was stored by checking the token metadata via [Retrieve Token Metadata](https://developers.pcibooking.net/api-reference/manage-tokens/retrieve-token-metadata.md). This includes the card brand, last four digits, expiration date, and the issuing bank and country, useful for routing decisions between PSPs.

```bash theme={null}
curl -X GET "https://service.pcibooking.net/api/payments/paycard/{token}/meta" \
  -H "Authorization: APIKEY your-api-key" \
  -H "Accept: application/json"
```

The `Accept: application/json` header makes sure that errors also come back as JSON. Without it, error responses are XML. See [Response Format](https://developers.pcibooking.net/reference/error-handling.md#response-format).

The response includes the masked card number, expiry, card brand, and token metadata. You will never see the full card number through this endpoint.

## Step 4: Use Your Token (Process a Payment)

Send the token through the Universal Payment Gateway (UPG) via [Process Transaction](https://developers.pcibooking.net/api-reference/process-cards/process-transaction.md). PCI Booking detokenizes the card and forwards it to your PSP.

For testing, PCI Booking provides two built-in mock payment gateways:

| Mock Gateway | Behavior |
| - | - |
| **NULLSuccess** | Always approves the transaction |
| **NULLFailure** | Always declines the transaction |

Mock gateways require no credentials and return instant responses. Use them to test your integration before connecting a real PSP.

```bash theme={null}
curl -X POST https://service.pcibooking.net/api/paymentgateway \
  -H "Authorization: APIKEY your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "PaymentGateway": {
      "Name": "NULLSuccess"
    },
    "CardToken": "{token}",
    "OperationType": "Charge",
    "Amount": 100.00,
    "Currency": "USD"
  }'
```

PCI Booking replaces the token with real card data, sends it to the gateway, and returns the result. You never see the card. With `NULLSuccess`, the response will always be a successful charge.

When you are ready for production, replace `NULLSuccess` with your real PSP name and credentials:

```bash theme={null}
curl -X POST https://service.pcibooking.net/api/paymentgateway \
  -H "Authorization: APIKEY your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "PaymentGateway": {
      "Name": "YourPSPName",
      "Credentials": {
        "MerchantId": "your-merchant-id",
        "ApiKey": "your-psp-api-key"
      }
    },
    "CardToken": "{token}",
    "OperationType": "Charge",
    "Amount": 100.00,
    "Currency": "USD"
  }'
```

> [!NOTE]
>
> You can also store your PSP credentials in PCI Booking and pass a `credentialsId` query parameter instead of including credentials in every request. See [Gateway Credentials](https://developers.pcibooking.net/account-setup/gateway-credentials.md).

> [!NOTE]
>
> Processing payments through the UPG is one way to use a token. You can also [relay card data via HTTP](https://developers.pcibooking.net/use-tokens/token-replacement-in-request.md), [relay via file](https://developers.pcibooking.net/use-tokens/file-transfer-token-replacement.md), or [display the card](https://developers.pcibooking.net/use-tokens/card-display.md). See [Use Tokens Overview](https://developers.pcibooking.net/use-tokens/overview.md).

## What's Next

* [Authentication](https://developers.pcibooking.net/getting-started/authentication.md): All authentication methods in detail.
* [Capture Cards Overview](https://developers.pcibooking.net/capture-cards/overview.md): All card capture and tokenization methods.
* [Token Management](https://developers.pcibooking.net/manage-tokens/overview.md): Query, update, and manage stored tokens.
* [Use Tokens Overview](https://developers.pcibooking.net/use-tokens/overview.md): All ways to use your tokens.
* [Payments Library](https://developers.pcibooking.net/payments-library/overview.md): Cards, Apple Pay, Google Pay, PayPal via the Payments Library.
* [PCI Scope and Compliance](https://developers.pcibooking.net/concepts/pci-scope-and-compliance.md): How PCI Booking affects your PCI DSS scope.


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