Skip to content

in iOS React Native payment intent opens and closes suddently #519

@SamarthKadam

Description

@SamarthKadam

Currently on iOS, when RazorpayCheckout.open() is called, the payment sheet opens and dismisses almost immediately without giving the user a chance to interact with it. This makes the checkout flow completely unusable on iOS.

The expected behavior is that the Razorpay payment modal should stay open and allow the user to select a payment method, enter details, and complete the transaction — similar to how it works on Android.

I'd like this to be investigated and fixed so that the checkout flow works reliably on iOS without the abrupt dismissal.

Suggested implementation:

This could be related to how the native iOS module presents the view controller. A few things worth checking:

  • The RCTPresentedViewController or root view controller reference might be getting deallocated or changing before the checkout UI finishes presenting, causing the dismissal.
  • If the checkout is being presented on a background thread rather than the main thread, UIKit may silently dismiss it.
  • React Native's New Architecture or concurrent rendering could be triggering a re-render that unmounts the component calling open(), leading to premature cleanup.

A potential fix would be to ensure the presented view controller holds a strong reference and that presentation happens on the main dispatch queue.

Alternatives

  • Wrapping the RazorpayCheckout.open() call in a setTimeout or InteractionManager.runAfterInteractions() to delay presentation — resolved the issue

Teachability, Documentation, Adoption, Migration Strategy:

Once fixed, no migration should be needed — RazorpayCheckout.open(options) should just work as documented. It would be helpful to add a troubleshooting section in the README noting common iOS pitfalls (e.g., ensuring the root view controller is available before calling open(), and calling it on the main thread).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions