> For the complete documentation index, see [llms.txt](https://docs.paytweed.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.paytweed.com/developer-tools/external-integrations/onramp-to-crypto.md).

# 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 %}
