In this flow, SDK provides a webview based checkout implementation to facilitate a quick integration with our payment gateway. Your customers can fill in the necessary details in the web page and complete the payment.
This mode also handles all the business logic and UI Components to make the payment smooth and easy to use.
This flow is for merchants who wants to quickly provide UPI Intent functionality using cashfree’s mobile SDK. In this flow, SDK provides a pre-built native Android screen to facilitate a quick integration with our payment gateway. Your customers will see a list of UPI apps installed in their phone which they can select to initiate payment.
This mode handles all the business logic and UI Components to make the payment smooth and easy to use. The SDK allows the merchant to customize the UI in terms of color coding, fonts.
The React Native SDK is hosted on npm.org you can get the sdk here.
Our React Native SDK supports Android SDK version 19 and above and iOS minimum deployment target of 10.3 and above. Navigate to your project and run the following command.
The first step in the integration is to create an Order. You can add an endpoint to your server which creates this order and integrate this server endpoint with your frontend.
Order creation must happen from your backend (as this API uses your secret key). Please do not call this directly from your mobile application.
Here’s a sample request for creating an order using your desired backend language. Telr offers backend SDKs to simplify the integration process.
Once the order is created, the next step is to open the payment page so the customer can make the payment. The React Native SDK offer below payment flow:
In this flow, SDK provides a webview based checkout implementation to facilitate a quick integration with our payment gateway. Your customers can fill in the necessary details in the web page and complete the payment.
This mode also handles all the business logic and UI Components to make the payment smooth and easy to use.
This flow is for merchants who wants to quickly provide UPI Intent functionality using cashfree’s mobile SDK. In this flow, SDK provides a pre-built native Android screen to facilitate a quick integration with our payment gateway. Your customers will see a list of UPI apps installed in their phone which they can select to initiate payment.
This mode handles all the business logic and UI Components to make the payment smooth and easy to use. The SDK allows the merchant to customize the UI in terms of color coding, fonts.
To complete the payment, we can follow the following steps:
This object contains essential information about the order, including the payment session ID (payment_session_id) and order ID (order_id) obtained from Step 1. It also specifies the environment (sandbox or production).
Copy
import { CFEnvironment, CFSession,} from 'cashfree-pg-api-contract';try { const session = new CFSession( 'payment_session_id', 'order_id', CFEnvironment.SANDBOX );}catch (e: any) { console.log(e.message);}
Make sure to set the callback at componentDidMount and remove the callback at componentWillUnmount as this also handles the activity restart cases and prevents memory leaks.
Always call setCallback before calling doPayment method of SDK
This object combines all the configurations into a single checkout configuration.
Finally, call doWebPayment() to open the Telr checkout screen. This will present the user with the payment options and handle the payment process.
This flow is for merchants who wants to quickly provide UPI functionality using cashfree’s mobile SDK without handling other modes like Cards or Net banking.
Once the payment is completed, you need to confirm whether the payment was successful by checking the order status. After payment user will be redirected back to your component.
You must always verify payment status from your backend. Before delivering the goods or services, please ensure you call check the order status from your backend. Ensure you check the order status from your server endpoint.
Copy
export default class App extends Component { ... componentDidMount() { CFPaymentGatewayService.setCallback({ //verify order status from backend onVerify(orderID: string): void { this.changeResponseText('orderId is :' + orderID); }, onError(error: CFErrorResponse, orderID: string): void { this.changeResponseText( 'exception is : ' + JSON.stringify(error) + '\norderId is :' + orderID ); }, }); }}
To verify an order you can call our /pg/orders endpoint from your backend. You can also use our SDK to achieve the same.
If you are facing trouble while making a payment, you can take a look at the SDK debug logs to try and identify the issue. To enable SDK logging add the following to your values.xml file.
From our Reacr SDK version 2.0.1 onwards, you can subscribe to the analytics events generated from our Drop checkout payment flow and push it to the analytics platform of your choice directly from your application.
If you want to enable this feature in Drop Payment flow you can add the following line to your values.xml file.