create_onramp_session()¶
- async Client.create_onramp_session()¶
Initiate a purchase session with an onramp provider.
Usable by Users Bots- Parameters:
provider (
str) – The onramp provider ID.crypto_currency (
str) – The cryptocurrency code (e.g. “TON”).address (
str) – The target wallet address.payment_method (
str, optional) – The payment method identifier.base_currency (
str, optional) – The fiat currency code (e.g. “USD”).base_amount (
str, optional) – The fiat amount to spend.memo (
str, optional) – Optional memo/tag for the transfer.theme (
str, optional) – UI theme (“light” or “dark”).success_return_url (
str, optional) – Callback URL on successful purchase.fail_return_url (
str, optional) – Callback URL on failed purchase.crypto_amount (
str, optional) – The cryptocurrency amount to buy.
- Returns:
OnrampSession– On success, the onramp session details with the checkout URL are returned.
Example
# Create onramp session session = await app.create_onramp_session( provider="provider_id", crypto_currency="TON", address="EQD...", base_currency="USD", base_amount="50", )