attachSource method

Future<Map<String, dynamic>> attachSource(
  1. String sourceId
)

Attaches a Source object to the Customer. The source must be in a chargeable or pending state. https://stripe.com/docs/api/sources/attach

Implementation

Future<Map<String, dynamic>> attachSource(String sourceId) async {
  assert(_assertNotDisposed());
  final EphemeralKey key = await (_keyManager.retrieveEphemeralKey());
  final path = '/customers/${key.customerId}/sources';
  final params = {'source': sourceId};
  return _apiHandler.request(RequestMethod.post, path, key.secret, apiVersion, params: params);
}