# Onramp to Crypto

{% hint style="info" %}
The `toAddress` parameter is optional because users have the option to enter the wallet address directly within the widget.
{% endhint %}

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

```tsx
import { useWeb3 } from "@paytweed/core-react";

function DemoPage() {
  const { createOnRamp } = useWeb3();

  function handleCreateOnRamp() {
    createOnRamp({
      toAddress: "0x7f8e0B31dd7e8C12cF907225E25Ed83C649bCc62", // optional
      commodities: [{ commodity: "MATIC", network: "Amoy" }], // optional
      currencyAmount: 100, // optional
      variant: 'sandbox' //optional, live by default
    });
  }

  return (
    <>
      <button onClick={handleCreateOnRamp}>onramp</button>
    </>
  );
}

export default DemoPage;
```

{% 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.paytweed.com/developer-tools/external-integrations/onramp-to-crypto.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.
