depositFromPaymentMethod method

Future<Transaction> depositFromPaymentMethod({
  1. String? profileId,
  2. required double amount,
  3. required String paymentMethodId,
  4. required String currency,
})

Deposit from payment method

Deposits funds from a linked external payment method to the specified profile_id.

https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositpaymentmethod

Implementation

Future<Transaction> depositFromPaymentMethod({
  String? profileId,
  required double amount,
  required String paymentMethodId,
  required String currency,
}) async {
  var response = await _transfersRestClient.depositFromPaymentMethod(
    profileId: profileId,
    amount: amount,
    paymentMethodId: paymentMethodId,
    currency: currency,
  );

  if (response.statusCode != 200) throw response;

  return Transaction.fromJson(json.decode(response.body));
}