fetchTokens method

Future<Response<RazorpayCustomerTokensResponse>> fetchTokens({
  1. required String customerId,
  2. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayCustomerTokensResponse>?
    )?,
})

Fetch tokens by customerId

@param customerId - The unique identifier of the customer.

Implementation

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