> ## 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.

# Success and Failure URLs

> Configure redirect URLs for hosted card entry form completion and error scenarios.

The card capture and CVV capture forms redirect the cardholder to your pages after submission. You provide a success URL and a failure URL. PCI Booking redirects to the appropriate page based on the outcome.

## Success Page

Your success URL receives non-sensitive card capture data as query string parameters. Build your URL with placeholders for the parameters you need, and PCI Booking replaces them with actual values on redirect.

### Available Parameters

| Parameter               | Description                                    |
| ----------------------- | ---------------------------------------------- |
| `{cardToken}`           | The card token created for this card           |
| `{cardType}`            | Card type (Visa, MasterCard, etc.)             |
| `{cardNumber}`          | Masked card number (first 6 and last 4 digits) |
| `{expiration}`          | Card expiration date                           |
| `{cardHolderName}`      | Cardholder name                                |
| `{cvv}`                 | Masked CVV (if captured)                       |
| `{threeDSecIndication}` | 3DS authentication status                      |

### Example

```text theme={null}
https://mysite.com/success?cardToken={cardToken}&cardType={cardType}&cardNumber={cardNumber}&expiration={expiration}&cardHolderName={cardHolderName}&cvv={cvv}&threeDSecIndication={threeDSecIndication}
```

Include only the parameters you need. At minimum, include `{cardToken}` to receive the token for subsequent API calls.

<Warning>
  Submit all URLs in encoded format.
</Warning>

## Failure Page

The failure URL is a static URL. You do not need to add placeholders. PCI Booking automatically appends query parameters with the failure details.

### Parameters Appended by PCI Booking

| Parameter                     | Description                                             | Always Present |
| ----------------------------- | ------------------------------------------------------- | -------------- |
| `reason`                      | Description of what went wrong                          | Yes            |
| `gatewayResultCode`           | PSP result code (when using UPG with charge-on-capture) | No             |
| `gatewayResultSubCode`        | PSP sub-code                                            | No             |
| `gatewayResultDescription`    | PSP result description                                  | No             |
| `gatewayResultSubDescription` | PSP sub-description                                     | No             |

### Example: What You Configure

```text theme={null}
https://mysite.com/failure
```

### Example: What the Redirect Looks Like

After a failed card capture:

```text theme={null}
https://mysite.com/failure?reason=Bad%20or%20missing%20authorization%20data
```

After a failed charge-on-capture (with UPG gateway details):

```text theme={null}
https://mysite.com/failure?reason=%5BDeclined%5D%20Card%20declined&gatewayResultCode=05&gatewayResultDescription=Do%20Not%20Honor
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Hosted Card Entry Form" icon="book" href="/capture-cards/hosted-card-entry-form">
    Card capture form that uses these redirect URLs
  </Card>

  <Card title="CVV Capture" icon="book" href="/capture-cards/cvv-capture">
    CVV-only capture form that uses the same redirect mechanism
  </Card>
</CardGroup>
