# Create a card

In order to use the create a card endpoint, you'll need to create a customer first

You can take a look at the customer endpoint via this link [Create Customer](/api-endpoint/deprecated/card/create-customer.md)

Once you've created a customer, you'll need the customer id in order to create a virtual card

Please note that the virtual card can take 24 hours before a user's approval for it.&#x20;

The virtual card is free however there is a fee for applying for the virtual card which is $15 USD to apply for it

The below example gives an example of how to make the request using the endpoint

{% tabs %}
{% tab title="Curl" %}

{% endtab %}

{% tab title="Nodejs" %}

```javascript
const axios = require('axios');
let data = '{\n    "customerId": "d97ca351-966c-47e5-a1fa-b8017515763c",\n    "spendingAmount": 2000,\n    "reason": "I wan to buy Products on Amazon",\n    "places": "AliExpress, Amazon, Etc"\n}';

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sandbox.pgecom.com/api/v1/business/visa',
  headers: { },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
s
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://sandbox.pgecom.com/api/v1/business/visa"

payload = "{\n    \"customerId\": \"d97ca351-966c-47e5-a1fa-b8017515763c\",\n    \"spendingAmount\": 2000,\n    \"reason\": \"I wan to buy Products on Amazon\",\n    \"places\": \"AliExpress, Amazon, Etc\"\n}"
headers = {}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('http://localhost:3002/api/card');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setBody('{\n    "fullName": "Esterling Accime",\n    "amount": 5,\n    "email": "ukdgckvdxtqfmbrdea@bvhrs.com",\n    "billingAddress": {\n        "line1": "9700 Medlock Bridge Road",\n        "city": "John Creeks",\n        "country": "US",\n        "state": "WA",\n        "postal_code": "90098"\n    },\n    "isPhysical": false,\n    "person": "user"\n}');
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="C#" %}

{% endtab %}
{% endtabs %}

## Create a virtual

<mark style="color:green;">`POST`</mark> `https://sandbox.pgecom.com/api/v1/business/visa`

#### Headers

| Name                                            | Type   | Description    |
| ----------------------------------------------- | ------ | -------------- |
| authorization<mark style="color:red;">\*</mark> | String | Bearer `token` |

#### Request Body

| Name                                             | Type   | Description                            |
| ------------------------------------------------ | ------ | -------------------------------------- |
| spendingAmount<mark style="color:red;">\*</mark> | String | Monthly spending amount on the card    |
| reason<mark style="color:red;">\*</mark>         | String | Reason why you need this card          |
| places<mark style="color:red;">\*</mark>         | String | Places that you intent to use the card |
| customerID<mark style="color:red;">\*</mark>     | String |                                        |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "cardId": "ic_1LVrfdEDjZxHmxzHqsxUEuHe",
    "message": "Virtual Visa card purchased successfully"
    
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```json
{
    "message": "Token not valid"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pgecom.com/api-endpoint/deprecated/card/create-a-card.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
