otpSubmit method

Future<Response<RazorpayOtpSubmitResponse>> otpSubmit({
  1. required String paymentId,
  2. required String otp,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayOtpSubmitResponse>?
    )?,
})

Submit OTP for S2S payments

@param paymentId - The unique identifier of the payment. @param params - Contains the OTP: {'otp': '123456'}

Implementation

Future<Response<RazorpayOtpSubmitResponse>> otpSubmit({
  required String paymentId,
  required String otp,
  void Function(RazorpayApiException?, Response<RazorpayOtpSubmitResponse>?)?
      callback,
}) async {
  if (paymentId.isEmpty) {
    throw ArgumentError('paymentId is mandatory');
  }
  if (otp.isEmpty) {
    throw ArgumentError('otp is mandatory');
  }
  return api.post<RazorpayOtpSubmitResponse>(
    {
      'url': '$BASE_URL/$paymentId/otp/submit',
      'data': {'otp': otp},
    },
    fromJsonFactory: RazorpayOtpSubmitResponse.fromJson,
    callback: callback,
  );
}