skip to Main Content

React-Native Phonepe SDK used for Phonepe integration if I pass base64 response and shasha256 hash key for SDK to PhonePe Custom UPI Open Intent it always gives {"error": "Transaction Interrupted!", "status": "FAILURE"} error but if try standard checkout(asking the user to enter UPI id and payment request) everything works fine.
test credentials used for testing
custom up intent api docs I tried with passing the same values in API it works fine it returns redirect url but in sdk it throws error

app.js

 import PhonePePaymentSDK from 'react-native-phonepe-pg';
PhonePePaymentSDK.init(
      "UAT",
      "PGTESTPAYUAT",
      "F4:1E:2F:64:BA:E6:19:1A:A7:C2:29:6D:5F:5D:2F:0A:29:E8:6E:5B",
      true
    ).then(result => {
      console.log("sdk intitialisation successfull", result);
      // setMessage("Message: SDK Initialisation ->" + JSON.stringify(result));
    }).catch(error => {
      setMessage("error:" + error.message);
    })

 PhonePePaymentSDK.startPGTransaction(   "ewogICJtZXJjaGFudElkIjogIlBHVEVTVFBBWVVBVCIsCiAgIm1lcmNoYW50VHJhbnNhY3Rpb25JZCI6ICJ0cmFuc2FjdGlvbl8xMjMiLAogICJtZXJjaGFudFVzZXJJZCI6ICI5MDIyMzI1MCIsCiAgImFtb3VudCI6IDEwMDAsCiAgIm1vYmlsZU51bWJlciI6ICI5OTk5OTk5OTk5IiwKICAiY2FsbGJhY2tVcmwiOiAiaHR0cHM6Ly93ZWJob29rLnNpdGUvY2FsbGJhY2stdXJsIiwKICAicGF5bWVudEluc3RydW1lbnQiOiB7CiAgICAidHlwZSI6ICJVUElfSU5URU5UIiwKICAgICJ0YXJnZXRBcHAiOiAiY29tLnBob25lcGUuYXBwIgogIH0sCiAgImRldmljZUNvbnRleHQiOiB7CiAgICAiZGV2aWNlT1MiOiAiQU5EUk9JRCIKICB9Cn0=", //base64 string 
      "2b5b25e756441323391dd1612810c59f021463bb0082cdf5fe18c9a6f1a5dc21###1",//check sum value
     "/pg/v1/pay",
      { 'Content-Type': 'application/json' },
      "com.phonepe.app",
      "https://webhook.site/callback-url"
    ).then(a => {
      console.log("tracsaction res", a);
    }).catch(error => {
      console.log("trsaction api error", error);
    })

Response object
sample reponse object

{
  "merchantId": "PGTESTPAYUAT",
  "merchantTransactionId": "transaction_123",
  "merchantUserId": "90223250",
  "amount": 1000,
  "mobileNumber": "9999999999",
  "callbackUrl": "https://webhook.site/callback-url",
  "paymentInstrument": {
    "type": "UPI_INTENT",
    "targetApp": "com.phonepe.app"
  },
  "deviceContext": {
    "deviceOS": "ANDROID"
  }
}

test crentials

2

Answers


  1. I’m using Expo app, so can’t use phonepe-sdk, that’s why I’m trying to make webpage for payment gateway in react and then I’ll redirect user to webpage via <WebView />
    But issue is, I tried using Paytm to make gateway and I got stuck for more than a week in error resolving, could not resolve so now trying to make using Phonepe. If that doesnot work then last option will be Google Pay – which looks pretty easy to integrate but require some more steps like verifications.

    Login or Signup to reply.
  2. You can use this package react-native-phonepesdk instead.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search