Layer 231
PaymentsGetOnrampQuote
Get a price quote from an on-ramp provider for buying cryptocurrency with fiat. Specify either base_amount (how much fiat to spend) or crypto_amount (how much crypto to receive). The quote breaks down price and fees and is valid until expires_date; then create the purchase with payments. create Onramp Session.
method
payments.getOnrampQuote#e06645fa flags:# provider:string crypto_currency:string base_currency:string base_amount:flags.0?string crypto_amount:flags.1?string payment_method:flags.2?string = OnrampQuote;
Parameters
| Name | Type | Description |
|---|---|---|
| Provider | string | On-ramp provider ID, from payments. get Onramp Providers |
| CryptoCurrency | string | Cryptocurrency to buy, e. g. TON |
| BaseCurrency | string | Fiat currency to pay with, ISO 4217 code |
| BaseAmount | flags.0?string | Amount to pay in the fiat currency, as a decimal string |
| CryptoAmount | flags.1?string | Amount of cryptocurrency to buy, as a decimal string, instead of base_amount |
| PaymentMethod | flags.2?string | Payment method, as returned by payments. get Onramp Availability |
Returns
OnrampQuoteGogram Example
providers, _ := client.PaymentsGetOnrampProviders("TON") quote, err := client.PaymentsGetOnrampQuote(&tg.PaymentsGetOnrampQuoteParams{ Provider: providers[0].ID, CryptoCurrency: "TON", BaseCurrency: "USD", BaseAmount: "50", }) if err != nil { log.Fatal(err) } fmt.Println(quote.BaseAmount, quote.BaseCurrency, "->", quote.CryptoAmount, quote.CryptoCurrency, "fee:", quote.FeeAmount)