razorpay / razorpay-ios-sample-app

:iphone: Sample app demonstrating integration of Razorpay iOS Framework
MIT License
14 stars 13 forks source link

Razorpay Checkout not opening in IOS #35

Open varsh8th opened 3 years ago

varsh8th commented 3 years ago

Description

Razorpay checkout not opening in mobile app, but only in ios. It works fine in android

Razorpay SDK Version :

Bundle version string : 1.2.13 react-native-razorpay": "^2.2.7"

Xcode Version :

Version 12.2 (12B45b)

What you did:

Tried to use checkout by clicking on a button in the app

What happened:

Nothing happens, the loader circles a little but other than that the checkout screen never opens. At least in simulator sometimes it pops up but in production on any device it doesn't open.

Steps To Reproduce

https://www.loom.com/share/bf4b55f639de403baee817824fea837a

Suggested solution:

Code example, screenshot, or link to a repository:

fetch(https://api.razorpay.com/v1/orders, { method: 'POST', headers: new Headers({ Accept: 'application/json', 'Content-Type': 'application/json', 'Authorization': Bearer Key Here

  }),
  body: JSON.stringify({
    amount: 100,
    currency: currency,
    payment: {
      capture: "automatic",
      capture_options: {
        refund_speed: "normal"
      }
    },
    transfers: [
      {
        account: linkedAccount,
        amount: 100,
        currency: currency,
        notes: {
          name: '1',
          email: '1'
        },
        linked_account_notes: [name , email]
      },
    ]
  })
})
  .then((res) => {
    return res.json()
  })
  .then((payment) => {

    this.setState({ loading: false })

    // console.log("PAYMENT", payment)

    var options = {
      description: 'Kalzi Membership',
      image: 'jpg here',
      currency: currency,
      key: 'key here', // Your api key
      amount: 100,
      name: 'Hi',
      prefill: {
        email: 'email',
        name: 'name',
      },
      order_id: payment.id,
      theme: { color: 'blue' },
    }

    RazorpayCheckout.open(options).then().catch()

})
.catch()