# Fetch Quote

Code Example:

```javascript
const amount = "150.55"; // Amount in USD
const quote = await service.fetchQuote(amount);
```

Response:

The `fetchQuote` method returns a quote object with the following fields:

* **id**: Unique quote identifier.
* **token**: Name or symbol of the token used to purchase the card. (e.g., `"USDC"`, `"TAO"`)
* **targetCurrency**: Currency code for the amount. (e.g., `"USD"`)
* **amountRequested**: Amount of USD the card is being purchased for.
* **pricePerUnitCurrency**: Price of the token per unit USD.
* **totalPrice**: Total token amount needed for purchase.
* **platformFee**: Any additional fees charged by the platform.
* **expiresIn**: Time in milliseconds before the quote expires.
* **timestamp**: Timestamp when the quote was generated.
* **status**: Quote status.

#### Purchase Card

The `purchaseCard` method initiates a virtual card purchase. It performs four main operations:

1. Approves token spending to the ZebecCard smart contract. (ERC20 tokens only)
2. Deposits tokens into the user's Zebec vault.
3. Initiates the card purchase on-chain. (ERC20 tokens only)
4. Posts transaction data, along with metadata, to the Zebec backend.

The method returns a tuple with responses from each stage of the process.

**Code Example**

For EVM compatible networks:

```javascript
const participantId = "JohnChamling";
const firstName = "John";
const lastName = "Chamling";
const emailAddress = "user@example.com";
const mobilePhone = "+91 012345678";
const language = "en-US";
const city = "Bharatpur";
const state = "Bagmati";
const postalCode = "44200";
const countryCode: CountryCode = "NPL";
const address1 = "Shittal street, Bharatpur - 10, Chitwan";

const recipient = Recipient.create(
	participantId,
	firstName,
	lastName,
	emailAddress,
	mobilePhone,
	language,
	city,
	state,
	postalCode,
	countryCode,
	address1,
);

const amount = "150.55";
const quote = await service.fetchQuote(amount);
const [depositResponse, buyCardResponse, apiResponse] = await service.purchaseCard({
	amount,
	recipient,
	quote,
});

console.log("Deposit Transaction Hash:", depositResponse.hash);
console.log("Purchase Transaction Hash:", buyCardResponse.hash);
console.log("Zebec Server Response:", apiResponse.data);
```

For Bittensor Network:

```javascript
const participantId = "JohnChamling";
const firstName = "John";
const lastName = "Chamling";
const emailAddress = "user@example.com";
const mobilePhone = "+91 012345678";
const language = "en-US";
const city = "Bharatpur";
const state = "Bagmati";
const postalCode = "44200";
const countryCode: CountryCode = "NPL";
const address1 = "Shittal street, Bharatpur - 10, Chitwan";

const recipient = Recipient.create(
	participantId,
	firstName,
	lastName,
	emailAddress,
	mobilePhone,
	language,
	city,
	state,
	postalCode,
	countryCode,
	address1,
);

const amount = "150.55"; // Amount in USD
const quote = await service.fetchQuote(amount);
const [depositResponse, apiResponse] = await service.purchaseCard({
	walletAddress: signer.address || "<wallet_address>",
	amount,
	recipient,
	quote,
});

console.log(
	`Deposit response: \n BlockHash: ${depositResponse.blockHash} \n TransactionHash: ${depositResponse.txHash}`,
);
console.log("Zebec Server Response:", apiResponse.data);
```


---

# 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.zebec.io/zebec-silver-card/silver-card-sdk/fetch-quote.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.
