withdrawToPaymentMethod method

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

Withdraw to payment method

Withdraws funds from the specified profile_id to a linked external payment method

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

Implementation

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

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

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