processPaymentOnAlternatePAorPG method

Future<Response<RazorpayProcessPaymentResponse>> processPaymentOnAlternatePAorPG({
  1. required String tokenId,
  2. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayProcessPaymentResponse>?
    )?,
})

Process a payment on another PA/PG with token created on razorpay (Token HQ)

@param tokenId - The ID of the token to use.

Implementation

Future<Response<RazorpayProcessPaymentResponse>>
    processPaymentOnAlternatePAorPG({
  required String tokenId,
  void Function(
    RazorpayApiException?,
    Response<RazorpayProcessPaymentResponse>?,
  )? callback,
}) async {
  if (tokenId.isEmpty) {
    throw ArgumentError('tokenId is required');
  }
  return api.post<RazorpayProcessPaymentResponse>(
    {
      'url': '$BASE_URL/service_provider_tokens/token_transactional_data',
      'data': {'id': tokenId}, // Pass ID in the body
    },
    fromJsonFactory: RazorpayProcessPaymentResponse.fromJson,
    callback: callback,
  );
}