Layer 231
PaymentsGetOnrampAvailability
Check whether the current user may buy cryptocurrency through a given on-ramp provider, and which payment methods are available. Call it after picking a provider from payments. get Onramp Providers and before asking for limits or a quote. The result also includes the user's country (and state) as detected for the provider.
method
payments.getOnrampAvailability#2ec29951 flags:# provider:string crypto_currency:string base_currency:flags.0?string = OnrampAvailability;
Parameters
| Name | Type | Description |
|---|---|---|
| Provider | string | On-ramp provider ID, from payments. get Onramp Providers |
| CryptoCurrency | string | Cryptocurrency to buy, e. g. TON |
| BaseCurrency | flags.0?string | Fiat currency to pay with, ISO 4217 code |
Returns
OnrampAvailabilityGogram Example
providers, _ := client.PaymentsGetOnrampProviders("TON") avail, err := client.PaymentsGetOnrampAvailability(providers[0].ID, "TON", "USD") if err != nil { log.Fatal(err) } fmt.Println("buying allowed:", avail.BuyAllowed, "country:", avail.CountryCode) for _, m := range avail.Methods { fmt.Println(" method", m.PaymentMethod, "available:", m.Available) }