PayUIOptions
type PayUIOptions = { buyWithCrypto?: | false | { prefillSource?: { allowEdits?: { chain: boolean; token: boolean }; token?: { address: string; icon?: string; name: string; symbol: string; }; }; }; buyWithFiat?: { testMode?: boolean } | false; prefillBuy?: { allowEdits?: { amount: boolean; chain: boolean; token: boolean }; amount?: string; token?: { address: string; icon?: string; name: string; symbol: string; }; }; purchaseData?: object; recipientAddress?: string;};
Configure options for buying tokens using other token ( aka Swap )
By default, the "Crypto" option is enabled. You can disable it by setting buyWithCrypto
to false
You can prefill the source token and chain using prefillSource
You can also disable the edits for the prefilled values by setting prefillSource.allowEdits
- By default all are editable
For example, if you want to allow selecting chain and but disable selecting token, you can set allowEdits
to { token: false, chain: true }
type buyWithCrypto = | false | { prefillSource?: { allowEdits?: { chain: boolean; token: boolean }; token?: { address: string; icon?: string; name: string; symbol: string; }; }; };
By default "Credit card" option is enabled. you can disable it by setting buyWithFiat
to false
You can also enable the test mode for the on-ramp provider to test on-ramp without using real credit card.
type buyWithFiat = { testMode?: boolean } | false;
Prefill the Buy Token amount, chain and/or token.
You can also disable the edits for the prefilled values using allowEdits
- By default all are editable
For example, if you want to allow changing the amount, but disable changing the token and chain,
you can set allowEdits
to { amount: true, token: false, chain: false }
If no token
object is not specified, native token will be prefilled by default
type prefillBuy = { allowEdits?: { amount: boolean; chain: boolean; token: boolean }; amount?: string; token?: { address: string; icon?: string; name: string; symbol: string; };};
Extra details to store with the purchase.
This details will be stored with the purchase and can be retrieved later via the status API or Webhook
type purchaseData = object;
The address of the recipient of the purchase.
This address will be used to send the purchased tokens to.
type recipientAddress = string;