listPaymentMethods method

Future<Map<String, dynamic>> listPaymentMethods({
  1. dynamic type = 'card',
  2. int? limit,
  3. String? endingBefore,
  4. String? startingAfter,
})

List a Customer's PaymentMethods. https://stripe.com/docs/api/payment_methods/list

Implementation

Future<Map<String, dynamic>> listPaymentMethods(
    {type = 'card', int? limit, String? endingBefore, String? startingAfter}) async {
  assert(_assertNotDisposed());
  final EphemeralKey key = await (_keyManager.retrieveEphemeralKey());
  const path = '/payment_methods';
  final params = {'customer': key.customerId, 'type': type};
  if (limit != null) params['limit'] = limit;
  if (startingAfter != null) params['starting_after'] = startingAfter;
  if (endingBefore != null) params['ending_before'] = endingBefore;
  return _apiHandler.request(RequestMethod.get, path, key.secret, apiVersion, params: params);
}