opsway / react-native-paytm

Unofficial React Native wrapper for PayTM iOS/Android SDK
10 stars 10 forks source link

need OrderId and transaction response #9

Closed vaibsshukla closed 4 years ago

vaibsshukla commented 4 years ago

I need a response with transaction details. The status I am getting is Success, Failure, Cancel.

onPayTmResponse = (resp) => { const {STATUS, status, response} = resp; if (Platform.OS === 'ios') { if (status === 'Success') { const jsonResponse = JSON.parse(response); const {STATUS} = jsonResponse;

  if (STATUS && STATUS === 'TXN_SUCCESS') {
    console.log('Transaction Success')
  }
}

} else { if (STATUS && STATUS === 'TXN_SUCCESS') { // Payment succeed! console.log('Transaction Success android'+STATUS) } } };

philly25 commented 4 years ago

You have all the information in the response:

interface PaytmResponseIos {
    ORDERID: string;
    MID: string;
    TXNID: string;
    TXNAMOUNT: string;
    PAYMENTMODE: string;
    CURRENCY: string;
    TXNDATE: string;
    STATUS: string;
    RESPCODE: string;
    RESPMSG: string;
    GATEWAYNAME: string;
    BANKTXNID: string;
    BANKNAME: string;
    CHECKSUMHASH: string;
}

interface PaytmResponseAndroid extends PaytmResponseIos {
    status: string;
}

What are you missing?

philly25 commented 4 years ago

Fell free to reopen the issue.