I implemented MFA google authenticator verify process

I implemented MFA google authenticator verify process in my application.
first time user selecting {factorType Google 1. factorType: “token:software:totp”
2. provider: “GOOGLE”},
I am able to show the qr code in the UI but I unable to verify the Google authenticator in my application
I am using list of api to done this process

  1. {{url}}/api/v1/users/{{userId}}/factors - // show list of factors
  2. {{url}}/api/v1/users/{userId}/factors/{factorId}/verify - verify the passcode

second api is expecting factorId. But I am not getting factorId while autenticating user.

Please suggest to me which is the right api or List of api to done this google authentication registration and verification process.

Thanks
Jay