diff --git a/lib/buy/onramper/onramper_buy_provider.dart b/lib/buy/onramper/onramper_buy_provider.dart index 6b903342f..dc9812d1d 100644 --- a/lib/buy/onramper/onramper_buy_provider.dart +++ b/lib/buy/onramper/onramper_buy_provider.dart @@ -60,9 +60,15 @@ class OnRamperBuyProvider extends BuyProvider { Future> getAvailablePaymentTypes( String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async { - final params = {'type': isBuyAction ? 'buy' : 'sell'}; + final normalizedCryptoCurrency = + cryptoCurrency.title + _getNormalizeNetwork(cryptoCurrency); - final url = Uri.https(_baseApiUrl, '$supported$paymentTypes/$fiatCurrency', params); + final sourceCurrency = (isBuyAction ? fiatCurrency : normalizedCryptoCurrency).toLowerCase(); + final destinationCurrency = (isBuyAction ? normalizedCryptoCurrency : fiatCurrency).toLowerCase(); + + final params = {'type': isBuyAction ? 'buy' : 'sell', 'destination' : destinationCurrency}; + + final url = Uri.https(_baseApiUrl, '$supported$paymentTypes/$sourceCurrency', params); try { final response = @@ -75,7 +81,9 @@ class OnRamperBuyProvider extends BuyProvider { .map((item) => PaymentMethod.fromOnramperJson(item as Map)) .toList(); } else { - printV('Failed to fetch available payment types'); + final responseBody = + jsonDecode(response.body) as Map; + printV('Failed to fetch available payment types: ${responseBody['message']}'); return []; } } catch (e) {