---
title: "Hosted Page for Virtual Cards"
source_url: https://docs.rapyd.net/en/hosted-page-for-virtual-cards.html
lang: en
---

# Hosted Page for Virtual Cards

Securely display virtual cards with Rapyd Issuing. | `Enterprise`

Rapyd’s Hosted Page for Virtual Cards enables cardholders to display cards online.

The virtual card numbers are secured and are only exposed upon request. The virtual cards are [PCI](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_pci "Payment Card Industry") compliant and can also work for non-PCI clients.

With Rapyd’s Hosted Page for Virtual Cards, your business can issue virtual cards on-demand for employees, contractors and other users to conveniently make purchases for business travel, transportation and buying goods.

The Rapyd Issuing API is used to generate a hosted page that can display the issued card’s full details.

Hosted Page for Virtual Cards Example

- Click on **Show Details** to reveal the card information.

  ![648084dd936ee.png](image/img-68ef1c68e945dadf8adf58743d485f53.png)

## Hosted Page for Virtual Cards Workflow

Be sure to [Issue a Card](https://docs.rapyd.net/en/issue-card.md "Issue Card") before employee requests to use virtual card on a hosted page.

![hosted-page-virtual-cards.jpg](image/img-542d80ab1e971824b296b021f002a5c8.jpg)

1. A company employee requests to use a virtual card for a company expense.
2. You request Rapyd to [Display Issued Card Details](https://docs.rapyd.net/en/display-issued-card-details-to-customer.md "Display Issued Card Details to Customer") .
3. Rapyd processes your request and sends the response with the `redirect_url`.
4. You send and display the `redirect_url` to your employee.
5. The employee completes the captcha and uses the URL within the 5 minutes expiration window.

## How the Virtual Cards Hosted Page Works

Follow the steps to [Create a Rapyd Wallet](https://docs.rapyd.net/en/creating-a-rapyd-wallet.md "Creating a Rapyd Wallet"), [Issue a Card](https://docs.rapyd.net/en/issue-card.md "Issue Card"), and [Activate Issued Card](https://docs.rapyd.net/en/activate-issued-card-using-hosted-page.md "Activate Issued Card Using Hosted Page") before creating your Hosted Page for a Virtual Card.

### List Issued Cards

[List Issued Cards](https://docs.rapyd.net/en/list-issued-cards.md "List Issued Cards") cards by contact.

| Query Parameters | Description |
| --- | --- |
| **contact** | ID of the wallet contact. A string starting with **cont_**. |

### Display Card Details to the Customer

Send API Request [Display Issued Card Details to Customer](https://docs.rapyd.net/en/display-issued-card-details-to-customer.md "Display Issued Card Details to Customer")

- The ID of the card you want to display will begin with  `card_`…

| Path Parameters | Description |
| --- | --- |
| **card** | ID of the issued card, a string starting with |

### Hosted Page for Virtual Cards Request

[Display Issued Card Details to a Customer](https://docs.rapyd.net/en/display-issued-card-details-to-customer.md "Display Issued Card Details to Customer") describes the fields in the request.

- - Request

    - ```
      // POST https://sandboxapi.rapyd.net/v1/hosted/issuing/card_details/card

      {
          "card_color": "#f9f9f9",
          "logo": "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTNgldxyUfmVPmQV1YpTcDWo_kjX-TO_EiccQ&usqp=CAU",
          "language": "en",
          "logo_orientation": "landscape"
      }
      ```

### Hosted Page for Virtual Cards Response

[Display Issued Card Details to a Customer](https://docs.rapyd.net/en/display-issued-card-details-to-customer.md "Display Issued Card Details to Customer") describes the fields in the response.

- - Response

    - ```
      {
          "status": {
              "error_code": "",
              "status": "SUCCESS",
              "message": "",
              "response_code": "",
              "operation_id": "137d6ec5-51bd-4c47-a163-3b86c8457e54"
          },
          "data": {
              "id": "hp_issued_3b4f08ef2da59d20ebc8e82a6266e50c",
              "redirect_url": "https://sandboxhosted.rapyd.net/issuing/card_details?token=hp_issued_3b4f08ef2da59d20ebc8e82a6266e50c",
              "merchant_color": "0036ff",
              "merchant_language": "",
              "merchant_logo": "https://sboxiconslib.rapyd.net/merchant-logos/ohpc_b811c506b5347ce4f107d8ee72a1ce90.jpg",
              "merchant_website": "https://www.rapyd.net",
              "merchant_alias": "N/A",
              "merchant_customer_support": {},
              "status": "NEW",
              "expiration": 1614851280,
              "card_color": "#f9f9f9",
              "logo": "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTNgldxyUfmVPmQV1YpTcDWo_kjX-TO_EiccQ&usqp=CAU",
              "logo_orientation": "landscape",
              "card": {},
              "language": "en"
          }
      }
      ```

### Redirect Your Customer to the Hosted Page

Redirect your customer to the URL you received in the response. The [redirect URL](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_redirect "Redirect URL") appears in the `redirect_url` field.

> **Tip:**
>
> - This page is protected by Google reCAPTCHA
> - This page is accessible for 5 minutes only (since the moment it was generated)

### Embed a Hosted Page for Virtual Cards Using the Toolkit Method

Rapyd Toolkit has been specially designed to embed directly into your website to give your business more control over the entire experience.

**1. Create Your Hosted Page**

Before embedding the iframe into your page, follow steps 1, 2 and 3 under [How the Virtual Cards Hosted Page Works](https://docs.rapyd.net/en/hosted-page-for-virtual-cards.md#UUID-3cfa5ee2-81d1-c81a-7d79-c7864d43196b_N1719300600022 "How the Virtual Cards Hosted Page Works") to create your Hosted Page for Virtual Cards.

**2. Collect Your Page ID**

Once you create the page, in the response you’ll receive the ID of the page object, a string starting with `hp_issued`, (e.g. id:  `hp_issued_bd334669c8a80bc68c124b144c350b7f`).

**3. Add the Toolkit Code**

Add the following code to your page:

```html
<script src="https://toolkit.rapyd.net"></script>
```

**Note**: To run this method in the sandbox, use the following code:

```html
<script src="https://sandboxtoolkit.rapyd.net"></script>
```

Add a `<div>` tag with  `id="rapyd-toolkit":`

```html
<div id="rapyd-toolkit"></div>
```

Initialize the Page object with the following fields:

- - JavaScript

    - ```javascript
      let toolkit = new RapydToolkit({   
          button_color: "blue",
                  /* Color of the Show Details button. String.
                      Standard CSS color name or hexadecimal code such as #323fff.
                      Default is the color that is returned in the 'merchant_color'
                      field of the Hosted Page for Virtual Cards response. Optional.*/
          id: "hp_issued_bd334669c8a80bc68c124b144c350b7f",
                  /* ID of the Hosted Page for Virtual Cards response. String. Required.*/
          close_on_complete: true,
                  /* Causes the embedded Rapyd Toolkit window to close
                      when we fail to retrieve the card details. Boolean. Default is 'true'. Optional.*/      
          page_type: "card_issuing"
                  /* Mandatory for the Hosted Page for Virtual Cards
                      Default is "collection". */
      });
      ```

Call display `Toolkit()` to display the Hosted Page for Virtual Cards:

```javascript
checkout.displayToolkit();
```

Optional Step to Close Window on Completion. If  `close_on_complete` is set to false, call `toolkit.closeToolkit()` to close the Rapyd Toolkit window.

```javascript
toolkit.closeToolkit();
```

Insert your code that runs when the following events occur. Use your code to read the event field in the 'window' object.

- - JavaScript

    - ```javascript
      window.addEventListener(issuingOnSuccess, (event) => {
                          console.log(event.detail)
                          // Sent after clicking the Show Details button and the details are successfully displayed  
                          // Client code.
      })
      window.addEventListener(issuingOnFail, (event) => {
                          console.error(event.detail.error)
                          // Returns an error object when we fail to retrieve the card details
                          // Client code.
      ```

### Customize Your Page

Hosted pages can be customized using the Client Portal as described in [Customizing Your Hosted Page](https://docs.rapyd.net/en/customizing-your-hosted-page.md "Customizing Your Hosted Page") to edit the look and feel of the page.
