detachSource method

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

Detaches a Source object from a Customer. The status of a source is changed to consumed when it is detached and it can no longer be used to create a charge. https://stripe.com/docs/api/sources/detach

Implementation

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