fetchToken method
Future<Response<RazorpayToken> >
fetchToken({
- required String customerId,
- required String tokenId,
- void callback(
- RazorpayApiException?,
- 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,
);
}