Guides
Biometric Pix
Enroll the player's account with WebAuthn and receive deposits confirmed with biometrics, on your own screen or through the whitelabel journey.
Biometric Pix has two parts: the enrollment, done once, which links the player's account at a participant bank to a WebAuthn credential on the device; and the payments, which the player confirms with biometrics. There is also the whitelabel journey, where Okto runs everything on its own page. Notifications go to the biometricDepositUrl.
1. Pick the participant
List participants returns the sandbox banks:
| Participant | id | Behaviour |
|---|---|---|
| Banco Mimicr | 07b7bd3a-fb8d-43a9-b17f-712356007bde | Normal |
| Nubank | 126bfc62-9c16-4688-ad7d-efff52e96f3a | Normal |
| Itaú Unibanco | 0b919e9b-bee0-4549-baa3-bb6d003575ce | Normal |
| Banco Inter | 9326f9b2-ae57-42c4-a0d9-acc4ba434696 | Normal |
| Banco Fora do Ar | 5439f937-165c-4213-ac50-b10ebe6cb9f9 | outage: true; creating an enrollment answers 4133 |
An unknown participantId answers 4412. These participants are Mimicr's, not Okto's production list.
2. Create the enrollment
curl --request POST \
--url https://okto.mimicr.dev/biometric/enrollments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"participantId": "07b7bd3a-fb8d-43a9-b17f-712356007bde",
"taxId": "604.184.437-34",
"name": "Ana Ribeiro",
"riskSignals": {
"deviceId": "5439f937-165c-4213-ac50-b10ebe6cb9f9",
"osVersion": "16",
"deviceLanguage": "pt",
"screenDimensions": { "height": "915", "width": "412" },
"isRootedDevice": false,
"userTimeZoneOffset": "-03:00",
"screenBrightnessLevel": "150",
"uptimeMillis": "14338640",
"accountCreatedAt": "2022-02-22",
"platformType": "BROWSER"
},
"tags": ["app"]
}'{
"id": "5e32e193-4d02-4f86-aa16-f0920559df4f",
"url": "https://okto.mimicr.dev/mimicr/biometric-enrollment/5e32e193-4d02-4f86-aa16-f0920559df4f",
"externalId": "f8ccc69f-a236-4058-a9f7-d374ed1084f0",
"tags": ["app"]
}riskSignals and all its keys are required (4124); Mimicr only checks they are present. The enrollment starts waiting.
3. The player authorizes at the bank
Redirect the player to the url. In the sandbox it's a hosted page playing the bank, with the buttons "Autorizar o vínculo no banco" (authorize) and "Recusar" (refuse). Or through the control API:
npx mimicr action okto player.step step=biometric-enrollment:authorize id=5e32e193-4d02-4f86-aa16-f0920559df4f
Refusing (biometric-enrollment:revoke) moves the enrollment to revoked.
4. Register the credential (WebAuthn)
After the authorization, request the registration challenge with Create the enrollment challenge and {"platformType": "BROWSER"}. The response (201) has the shape of PublicKeyCredentialCreationOptions: challenge, rp, user, pubKeyCredParams, timeout, attestation, authenticatorSelection. Before the authorization the answer is 4126.
Pass the options to navigator.credentials.create() and send the result to Validate the enrollment challenge:
curl --request POST \
--url https://okto.mimicr.dev/biometric/enrollments/5e32e193-4d02-4f86-aa16-f0920559df4f/challenge/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"fidoAssertion": {
"id": "H5iUFpBYHpzrUELsjPLbOPsb7oUVBDEP1GKTptFA-D3",
"rawId": "H5iUFpBYHpzrUELsjPLbOPsb7oUVBDEP1GKTptFA-D3",
"type": "public-key",
"response": {
"clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIn0",
"attestationObject": "o2NmbXRmbm9uZWdhdHRTdG10oGhhdXRoRGF0YQ"
}
}
}'{ "enrollmentId": "5e32e193-4d02-4f86-aa16-f0920559df4f", "status": "enrolled" }id and rawId must match (4123) and response.clientDataJSON and response.attestationObject are required (4124). Mimicr doesn't check the attestation cryptography: it stores the credential id and requires the same id on payments. A CPF rejected by the tests answers 4131; validating an enrollment that isn't waiting answers 4127. The BiometricEnrollment notification with status: "enrolled" is sent.
5. Receive a payment
curl --request POST \
--url https://okto.mimicr.dev/biometric/deposit/payment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"enrollmentId": "5e32e193-4d02-4f86-aa16-f0920559df4f",
"amount": 6400,
"riskSignals": { "deviceId": "5439f937-165c-4213-ac50-b10ebe6cb9f9", "osVersion": "16", "deviceLanguage": "pt", "screenDimensions": { "height": "915", "width": "412" }, "isRootedDevice": false, "userTimeZoneOffset": "-03:00", "screenBrightnessLevel": "150", "uptimeMillis": "14338640", "accountCreatedAt": "2022-02-22", "platformType": "BROWSER" }
}'The response (201) carries the payment id and authenticationOptions (challenge, allowCredentials with the credential id, rpId, userVerification), ready for navigator.credentials.get(). An unknown enrollment answers 4138; an enrollment that isn't enrolled, 4101.
Send the assertion to Validate the payment challenge, with response.authenticatorData, response.clientDataJSON and response.signature. A fidoAssertion.id different from the enrollment's credential answers 4129. If the payer is rejected (test CPFs or chaos), the payment becomes failed and the answer is 400 with the code; otherwise 201 with the payment, and it becomes paid. Either way the BiometricDepositPayment notification is sent.
npx mimicr wait okto delivery transaction_id=<payment-id> event=paid
Check it with Get payment status and list with List payments.
Whitelabel journey
If you'd rather not implement WebAuthn, use the journey: Okto guides the player on its own page.
curl --request POST \
--url https://okto.mimicr.dev/biometric/deposit/journey \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"taxId": "604.184.437-34",
"name": "Ana Ribeiro",
"amount": 3000,
"callbackUrl": "https://sua-app.dev/biometria/ok",
"onErrorCallbackUrl": "https://sua-app.dev/biometria/erro"
}'The response carries id and url. On the hosted page the player confirms with biometrics, refuses or abandons; then they are redirected to callbackUrl (success, with state and ticket) or onErrorCallbackUrl (failure, with state and error=access_denied). Through the control API: step=biometric-journey:pay, biometric-journey:fail (4114) or biometric-journey:expire.
| Journey status | When |
|---|---|
created | Awaiting the player |
paid | Paid |
failed | Refused or rejected |
expired | 3 hours without a payment, or abandoned |
The notification is BiometricDepositJourney, with lastPaymentId. Check it with Get journey status, its payment with Get journey payment status (status: "success" when paid) and list with List journey payments.
Revoke and list enrollments
Revoke an enrollment moves it to revoked and notifies; revoking again answers 4137. List enrollments of a CPF returns every enrollment of a CPF and Get an enrollment one enrollment with participant and bankAccountInfo.