Integrate Turbo UPI Headless Mock SDK
Steps to integrate the Razorpay Turbo UPI Headless Mock SDK with your app.
Mock SDK is a tool designed to facilitate your integration with Turbo UPI. Unlike conventional integration methods that rely on the stability of partner banks and NPCI UAT environments, Mock SDK removes this dependency, streamlining the integration process.
- No Dependency on UAT Environment: Traditional integration methods often encounter obstacles due to issues with UAT environments. Mock SDK removes this roadblock, enabling you to integrate without external dependency.
- Streamlines Integration: Mock SDK is designed to create a smoother integration experience, ensuring a hassle-free process. This allows you to quickly offer Turbo UPI services to the users.
- Effortless Integration for Essential Flows: Mock SDK simplifies the process of integrating Turbo for important scenarios. This enables you to expand your range of UPI services for customers without dealing with complex requirements.
- Seamless Transition to Production: After testing your integration with Mock SDK, you can smoothly transition to the Production SDK for final testing. This ensures a seamless and secure transition from development to live production.
-
Contact our
to get your app, and GitHub account whitelisted to get access to thehttps://github.com/upi-turbo/ios-sample-app
- sample app repository.- In this repository, you will find the framework files (libraries for Turbo) and the sample app source code to help you do the entire integration.
- Use branch
custom_ui/turbo
to access sample app and framework for Turbo UPI. The sample app workspace is divided into Prod, UAT and Mock environment targets with separate pod dependencies.
-
Integrate with the
. -
Add the below line of code to your
Podfile
, to install Turbo pods:pod 'razorpay-customui-pod'pod 'razorpay-turbo-pod' -
Import the Turbo plugin as given below:
import Razorpayimport TurboUpiPlugin
Watch Out!
- The minimum supported iOS version for using Turbo UPI is currently 11.0.
- Use the
rzp_test_vacN5cmVqNIlhO
API key id for testing on the Mock environment.
Follow these steps to integrate with
.Razorpay has three environments: Mock, UAT and Prod. We recommend the following:
- Complete the integration with the Mock environment.
- Complete the developer testing using the to cover all the .
- Perform the UAT using the Razorpay-provided API keys.
Use the following data to test the integration.
Following are the various scenarios based on the dependencies.
Given are the various test cases and their sequential steps.
In the scenario of successful device binding, follow these simple steps:
- Enter a mobile number which exists in the user's device.
- Call the
razorpay.upiTurbo.linkNewUpiAccount
method. - The expected response should be
LinkUpiAction = .selectBank
withaction.error==null
(no errors) andaction.data != null
indicating a list of available banks for selection.
In the event of a SIM card not being found, follow these steps:
- Remove all SIM cards from the device.
- Enter a mobile number which exists in the user's device.
- Call the
razorpay.upiTurbo.linkNewUpiAccount
method. - The expected response should be
LinkUpiAction = .linkAccountResponse
withaction.error!=null
including an error message sim not found.
In the scenario where an account is found, follow these steps:
- Enter a mobile number which exists in the user's device.
- Call the
razorpay.upiTurbo.linkNewUpiAccount
method. - The SDK response should change to
LinkUpiAction = .sendSms
withaction.error==null
(no errors). - Call
action.registerDevice()
, send the SMS when prompted on the screen. - The SDK response should change to
LinkUpiAction = SELECT_BANK
withaction.error==null
(no errors) andaction.data != null
indicating a list of available banks for selection. - Call
action.selectedBank()
with the Axis Bank or SBI Bank object fromaction.data
as mentioned in the . - The expected response should be
LinkUpiAction = .selectBankAccount
with no errorsaction.error==null
and a list of available bank accounts for selectionaction.data != null
, with at least one object.
When it comes to setting or managing your PIN, follow these steps:
- Enter a mobile number which exists in the user's device.
- Call
razorpay.upiTurbo.linkNewUpiAccount
method. - The SDK response changes to
LinkUpiAction = .sendSms
with no errorsaction.error==null
. - Call
action.registerDevice()
and send the SMS when prompted on the screen. - The SDK response changes to
LinkUpiAction = .selectBank
with no errorsaction.error==null
and a list of available banks for selectionaction.data != null
. - Call
action.selectedBank()
with the SBI Bank object fromaction.data
as mentioned in the . - The expected response should be
LinkUpiAction = .selectBankAccount
with no errorsaction.error==null
and a list of available bank accounts for selectionaction.data != null
. - Select the bank account ending with xxxx0203, as mentioned in the .
- The expected response should be
LinkUpiAction = .linkAccountResponse
with no errorsaction.error==null
and UpiAccounts data availableaction.data != null
.action.data
will have a list of UpiAccounts for which PIN is already set and UPI ID linked, including the newly linked account as the first object.
When dealing with scenarios where a PIN is not set, follow these steps:
- Enter a mobile number which exists in the user's device.
- Call
razorpay.upiTurbo.linkNewUpiAccount
method. - The SDK response changes to
LinkUpiAction = .sendSms
with no errorsaction.error==null
. - Call
action.registerDevice()
and send the SMS when prompted on the screen. - The SDK response changes to
LinkUpiAction = .selectBank
with no errorsaction.error==null
and a list of available banks for selectionaction.data != null
. - Call action.selectedBank() with Axis Bank or SBI Bank object from action.data as mentioned in the .
- The expected response should be
LinkUpiAction = .selectBankAccount
with no errorsaction.error==null
and a list of available bank accounts for selectionaction.data != null
. - Call
action.selectedBankAccount()
with bank account ending with xxxx0001 object fromaction.data
as mentioned in the . - The expected response should be
LinkUpiAction = .setUpiPin
with no errorsaction.error==null
and bank account data availableaction.data != null
.
When there is no account associated with a particular number, follow these steps:
- Enter a mobile number which exists in the user's device.
- Call
razorpay.upiTurbo.linkNewUpiAccount
method. - The SDK response changes to
LinkUpiAction = .sendSms
with no errorsaction.error==null
. - Call
action.registerDevice()
and send the SMS when prompted on the screen. - The SDK response changes to
LinkUpiAction = .selectBank
with no errorsaction.error==null
and a list of available banks for selectionaction.data != null
. - Call
action.selectedBank()
with HDFC object fromaction.data
as mentioned in the . - The expected response should be
LinkUpiAction = .selectBankAccount
with no errorsaction.error==null
and an empty array foraction.data
.
For a successful PIN setup, follow these steps:
- Enter a mobile number which exists in the user's device.
- Call
razorpay.upiTurbo.linkNewUpiAccount
method. - The SDK response changes to
LinkUpiAction = .sendSms
with no errorsaction.error==null
. - Call
action.registerDevice()
and send the SMS when prompted on the screen. - The SDK response changes to
LinkUpiAction = .selectBank
with no errorsaction.error==null
and a list of available banks for selectionaction.data != null
. - Call
action.selectedBank()
with Axis Bank or SBI Bank object fromaction.data
as mentioned in the . - The expected response should be
LinkUpiAction = .selectBankAccount
with no errorsaction.error==null
and a list of available bank accounts for selectionaction.data != null
. - Call
action.selectedBankAccount()
with the bank account ending with xxxx0001 object fromaction.data
as mentioned in the . - The expected response should be
LinkUpiAction = .setUpiPin
with no errorsaction.error==null
and data availableaction.data != null
. - Call
action.setUpiPin()
with bank account and card details data as mentioned in the . - Submit OTP (as mentioned in the Test Data) and New PIN on Mock NPCI screen.
- The expected final response should be
LinkUpiAction = .linkAccountResponse
with no errorsaction.error==null
and data availableaction.data != null
.action.data
will have a list of UPI Accounts for which PIN is already set and UPI ID linked. The list will include the newly linked account as the first object.
When you need to change your PIN successfully, follow these steps:
- Call
razorpay.upiTurbo.changeUpiPin
with the specified upiAccount. - Submit the old and new PIN on the Mock NPCI screen.
- Expect a callback with
onSuccess
. Your PIN change has been successfully completed.
When dealing with an invalid PIN or a PIN that does not match, follow these steps:
- Call
razorpay.upiTurbo.changeUpiPin
with the specified upiAccount. - Submit incorrect old and new PIN on the Mock NPCI screen.
- Expect a callback with an error that is not null. This indicates that the provided PIN was either invalid or did not match the expected PIN.
In situations where an incorrect OTP is encountered, follow these steps:
- Enter a mobile number which exists in the user's device.
- Call
razorpay.upiTurbo.linkNewUpiAccount
method. - The SDK response should change to
LinkUpiAction = .sendSms
withaction.error==null
no errors. - Call
action.registerDevice()
, and send the SMS when prompted on the screen. - The SDK response should change to
LinkUpiAction = .selectBank
withaction.error==null
(no errors) and a list of available banks for selectionaction.data != null
. - Call
action.selectedBank()
with the Axis Bank or SBI Bank object fromaction.data
as mentioned in the . - The expected response should be
LinkUpiAction = .selectBankAccount
withaction.error==null
(no errors) and a list of available bank accounts for selectionaction.data != null
. - Call
action.selectedBankAccount()
with the bank account ending with xxxx0001 object from action.data as mentioned in the . - The expected response should be
LinkUpiAction = .setUpiPin
withaction.error==null
and action.data != null
. - Call
action.setUpiPin()
with bank account and card details data as mentioned in the . - Submit any random incorrect OTP except for 123456 as mentioned in the and the new PIN on the Mock NPCI screen.
- The expected final response should be
LinkUpiAction = .linkAccountResponse
withaction.error!=null
.
When dealing with resetting your PIN with incorrect card details, follow these steps:
- Call the
razorpay.upiTurbo.resetUpiPin
method, providing an incorrect PIN and card details not mentioned in the . - Expect a callback, and if the response includes an error
error != nil
, it signifies that the reset attempt has failed due to incorrect card details.
When working with scenarios involving the presence of a UPI ID (Roaming Profile), follow these steps:
- Call
razorpay.upiTurbo.linkNewUpiAccount
method. - The SDK response should change to
LinkUpiAction = .sendSms
withaction.error==null
no errors. - Call
action.registerDevice()
and send the SMS when prompted on the screen. - The expected final response should be
LinkUpiAction = .linkAccountResponse
withaction.error==null
andaction.data != null
.action.data
will contain a list of UPI Accounts for which the PIN is already set, and the UPI ID is linked.
When dealing with scenarios related to UPI ID, such as new UPI ID creation, follow these steps:
- Enter a mobile number which exists in the user's device.
- Call the
razorpay.upiTurbo.linkNewUpiAccount
method. - The SDK response should change to
LinkUpiAction = .sendSms
with action.error==null
no errors. - Call
action.registerDevice()
and send the SMS when prompted on the screen. - The SDK response should change to
LinkUpiAction = .selectBank
withaction.error==null
no errors and a list of available banks for selectionaction.data != null
. - Call
action.selectedBank()
with Axis Bank or SBI Bank object fromaction.data
as mentioned in the . - The expected response should be
LinkUpiAction = .selectBankAccount
withaction.error==null
no errors and a list of available bank accounts for selectionaction.data != null
. - Call
action.selectedBankAccount()
with the bank account ending with xxxx0001 object fromaction.data
as mentioned in the . - The expected final response should be
LinkUpiAction = .linkAccountResponse
withaction.error==null
and action.data != null
.action.data
will contain a list of UPI Accounts for which the PIN is already set, and the UPI ID is linked. The list will include the newly linked account as the first object.
When it comes to transactional scenarios, with a focus on ensuring a successful payment, follow these steps:
- Begin by following the , specifically the
submit
method. - Enter an amount that is lower than the account balance.
- Enter the correct PIN on the Mock NPCI screen.
- Subsequently, you will receive a callback on
onPaymentSuccess
. This indicates that the payment has been successfully processed.
Handy Tips
The account balance remains unchanged, and the paid amount is not deducted.
In situations where an invalid PIN is entered, follow these steps:
- Begin by following the , specifically the
submit
method. - Enter an amount lower than the account balance mentioned in .
- Enter the incorrect PIN on the Mock NPCI screen.
- Subsequently, you will receive a callback on
onPaymentError
. This indicates that an error occurred during the payment process due to the invalid PIN.
When dealing with transactional scenarios, specifically focusing on handling timeouts, follow these steps:
- Begin by following the , specifically the
submit
method. - Enter the amount as 24.
- Enter the correct PIN on the Mock NPCI screen.
- Subsequently, you will receive a callback on
onPaymentError
. This indicates that an error occurred during the payment process due to a timeout.
When it comes to transactional scenarios with a focus on handling insufficient balance, follow these steps:
- Begin by following the , specifically the
submit
method. - Enter an amount greater than the account balance as mentioned in .
- Enter the correct PIN on the Mock NPCI screen.
- Subsequently, you will receive a callback on
onPaymentError
. This indicates that an error occurred during the payment process due to insufficient balance.
For scenarios related to checking your balance, follow these steps:
- Call the
razorpay.upiTurbo.getBalance
method. - Enter the correct PIN on the Mock NPCI screen.
- Expect a callback with
AccountBalance
anderror != nil
. This confirms that you will receive the requested balance information.
When it comes to scenarios focused on checking your balance, follow these steps:
- Call the
razorpay.upiTurbo.getBalance
method. - Enter an incorrect PIN on the Mock NPCI screen.
- Expect a callback with
error != nil
. This indicates that an error occurred during the payment process due to the invalid PIN.
Follow these simple steps for the first time onboarding:
- Enter a mobile number that exists on the user's device.
- Call
razorpay.upiTurbo.prefetchAndLinkUpiAccounts
method. - The SDK's initial response should shift to
LinkUpiAction = .consent
withaction.error==null
indicating no errors andaction.data != null
showing a list of prefetch banks. - Prompt the user to grant the necessary consent by calling
action.consents([consent])
. - The SDK response should change to
LinkUpiAction = .sendSms
withaction.error==null
no errors. - Use
action.registerDevice()
to send the SMS when prompted on the screen. - After successful device binding, account fetching will commence automatically.
- Expect the final response to be
LinkUpiAction = .linkAccountResponse
withaction.error==null
no errors andaction.data != null
. Theaction.data
will containUpiAllAccounts
as a response, which includesaccountsWithPinSet
andaccountsWithPinNotSet
. - Once the account is successfully linked, you will receive a callback asynchronously in the
LinkUpiAction = .linkAccountResponse
with updated lists.
For the first time onboarding, follow these steps:
- Enter a mobile number that exists on the user's device.
- Initiate the onboarding process by calling
razorpay.upiTurbo.prefetchAndLinkUpiAccounts
method. - Verify the SDK response, which should transition to
LinkUpiAction = .consent
withaction.error==null
indicating no errors andaction.data != null
, providing a list of prefetchBanks. - Proceed by calling
action.consents([consent])
with acknowledge set to false. - Check the SDK response, which should change to
LinkUpiAction = .sendSms
withaction.error==null
indicating no errors. - Use
action.registerDevice()
to send the SMS when prompted on the screen. - After successful device binding, expect the response to transition to
LinkUpiAction = .selectBank
withaction.error==null
indicating no errors andaction.data != null
, indicating a list of available banks for selection.
Follow the below steps to set or manage your PIN:
- Call the
action.setUpiPin(bankAccount, card)
method to select the desired bank account fetched during the prefetch process. - On the next screen, enter the bank OTP from the and proceed.
- Enter and confirm the PIN on the subsequent screens.
Follow these steps for accounts that are already onboarded:
- Call the
razorpay.upiTurbo.prefetchAndLinkUpiAccounts
method. - After successful device binding, the expected SDK response should be
LinkUpiAction = .selectBank
withaction.error==null
andaction.data != null
. This response should not have any errors and should contain relevant data.
Businesses should have the capability to display a user-friendly message to their customers for certain special or additional error scenarios. The SDK is equipped to simulate some of these cases.
Watch Out!
- Device Binding will only work if the user has at least one SIM card in their mobile device.
- Users can set/reset the UPI PIN. The configured PIN will be used to validate the transaction.
- Based on the for bank accounts, choose a bank for a single, multiple or no bank account.
- Use the same ATM PIN and card Number mentioned in the .
- The UPI PIN will revert to its default setting or be removed when you uninstall or clear storage.
- Amount ₹24 is blocked for special cases. Please refer to .
- Only one TPV whitelisted account (ending with xxxx0203) is permitted. Payments made using any other accounts will fail with the error Payment failed because the account linked to VPA is invalid.
- In the Mock environment, multiple payments can be made for a given
order_id
, which differs from the production environment where this is not allowed.
Complete this
to take your integration live.Is this integration guide useful?