fetchToken method

Future<Response<RazorpayToken>> fetchToken({
  1. required String customerId,
  2. required String tokenId,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayToken>?
    )?,
})

Fetch particular token

@param customerId - The unique identifier of the customer. @param tokenId - The unique identifier of the token.

Implementation

Future<Response<RazorpayToken>> fetchToken({
  required String customerId,
  required String tokenId,
  void Function(RazorpayApiException?, Response<RazorpayToken>?)? callback,
}) async {
  if (customerId.isEmpty) {
    throw ArgumentError('customerId is required');
  }
  if (tokenId.isEmpty) {
    throw ArgumentError('tokenId is required');
  }
  return api.get<RazorpayToken>(
    {'url': '/customers/$customerId/tokens/$tokenId'},
    fromJsonFactory: RazorpayToken.fromJson,
    callback: callback,
  );
}