Search code examples
androidkotlinwebpayment

How to get results from web chrome to activity android


I am working with payment using net banking and doing payment from web chrome now when i back to the activity i want to check that payment is done or cancelled... how to check this in my activity when i came back from web in my android application project?


Solution

  • You can use applinks.

    When you have done with payment your backend redirects to custom urls and you can listen them with intent-filters.

    <intent-filter android:autoVerify="true">
       <action android:name="android.intent.action.VIEW" />
       <category android:name="android.intent.category.BROWSABLE" />
       <category android:name="android.intent.category.DEFAULT" />
    
          <data
             android:path="/PaymentCancelled"
             android:host="yourhost.com"
             android:scheme="https" />
    
    
          <data
             android:path="/PaymentDone"
             android:host="yourhost.com"
             android:scheme="https" />
    </intent-filter>