Unable to pass amount to gpay in ionic 4 using webintent.
Here is my code:
pay() {
this.payeeVPA = '******';
this.payeeName = '*****';
this.payAmount = 1;
this.transactionReference = '#123456';
this.currency = 'INR';
this.transactionNote = 'Payment for Groceries';
const url = 'upi://pay?pa=' + this.payeeVPA + '&pn=' + this.payeeName + '&tr=' + this.transactionReference + 'tn=' + this.transactionNote + '&am=' + this.payAmount + '&cu=' + this.currency;
const options = {
action: this.webIntent.ACTION_VIEW,
url
};
this.webIntent.startActivityForResult(options).then(success => {
console.log(success);
if(success.extras.Status == 'SUCCESS') {
// SUCCESS RESPONSE
alert(JSON.stringify(success))
} else if(success.extras.Status == 'SUBMITTED') {
alert(JSON.stringify(success))
// SUBMITTED RESPONSE
} else if(success.extras.Status == 'Failed' || success.extras.Status == 'FAILURE') {
alert(JSON.stringify(success))
// FAILED RESPONSE
} else {
alert(JSON.stringify(success))
// FAILED RESPONSE
}
}, error => {
alert(JSON.stringify(error))
console.log(error);
}).catch((e)=>{
alert(JSON.stringify(e))
});
}
This will open gpay and ask user to enter amount.
i need to pass the amount to gpay and set amount readonly. How to achieve this?