Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 126.96.36.199 release ready!
What is instamojo?
Instamojo provides free payment gateway in India. Trusted by 600000+ Indian Businesses, 100% Secure, No setup cost, No maintenance cost.
This SDK allows you to integrate payments via Instamojo into your Android app. It currently supports following modes of payments:
1.Credit / Debit Cards
This SDK also comes pre-integrated with Juspay Safe Browser, which makes payments on mobile easier, resulting in faster transaction time and improvement in conversions.
1. 1-click OTP: Auto-processing Bank SMS OTP for 1-Click experience.
2. Network optimizations: Smart 2G connection handling to reduce page load times.
3. Input & Keyboard Enhancements: Displays right keyboard with password viewing option.
4. Smooth User Experience: Aids the natural flow of users with features like Automatic Focus, Scroll/Zoom, Navigation buttons.
Payment flow using SDK
The section describes how the payment flow probably looks like, when you integrate with this SDK. Note that, this is just for reference and you are free to make changes to this flow that works well for you.
When the buyer clicks on Buy button, your app makes a call to your backend to initiate a transaction in your system.
Your backend systems creates a payment order and returns the orderID to the app.
The app then initiates a payment via Instamojo SDK using the orderID.
If orderID is valid, the user is shown the available payment modes. This will take him via the payment process as per mode selected.
Once a payment is completed, a callback is received in your android activity with the payment_id, transaction_id and payment_status.
Your app shows the success / failure screen based on the payment status (either Credit or Failure).
For more details on the payment, your app may make a request to your backend servers with the transaction_id, which then returns the details after fetching the same from Instamojo servers.
The SDK currently supports Android Version >= ICS 4.0.3 (15). Just add the following to your application’s build.gradle file, inside the dependencies section.
The following are the minimum set of permissions required by the SDK. Add the following set of permissions in the application’s manifest file above the <application> tag.
If you are using Proguard for code obfuscation, add following rules in the proguard configuration file proguard-rules.pro.
# Rules for Instamojo SDK
Fetch Order ID from backend server
For initiating a payment, you should first create a payment order in your backend server and send the orderID to the app. Please check this documentation on how to create a payment order on your backend server using your Instamojo client credentials.
Add the following code snippet inside the onCreate() method of your activity class.
Implement the callback interface
Implement the Instamojo.InstamojoPaymentCallback callback interface in your activity class.
Now you can simply call initiatePayment with the orderID and the callback instance (which is the activity itself) to initiate a payment.
Receiving response from the SDK
Once the payment is initiated from your activity, it can receive the various SDK responses in the callback methods.
1.Payment through SDK is complete. The payment can be either a success or a failure
2.Payment is cancelled by the user
3.There was a error while initiating a payment (eg: the orderID is invalid)
Using Custom UI
We know that every application is unique. If you choose to create your own UI to collect payment information, Instamojo SDK has the necessary APIs to achieve this. Check out the CustomUIActivity activity with in the sample app to find out how this can be achieved.
Thanks for reading!!
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.