I have this response
webViewState Object {
"canGoBack": true,
"canGoForward": false,
"loading": false,
"navigationType": "other",
"target": 65507,
"title": "السداد بواسطة PayPal - راجع مدفوعاتك",
"url": "https://example.com/?paymentId=PAYID-L2ILTHQ83R55588UV606981X&token=EC-5EB6693455269621L&PayerID=BLG98CXTZAX8S",
}
How can i access paymentId and PayerID parameters from the URL??
I tried this line but it returns undefined for both const { PayerID, paymentId } = webViewState.url;
Any help please?
After getting your data you can do this:
var regexp = /[?&]([^=#]+)=([^&#]*)/g,params = {},check;
while (check = regexp.exec(webViewState.url)) {
params[check[1]] = check[2];
}
console.log("params",params)
params will give you a object like this
Object {
"PayerID": "BLG98CXTZAX8S",
"paymentId": "PAYID-L2ILTHQ83R55588UV606981X",
"token": "EC-5EB6693455269621L",
}
Hope this helps!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments