Home > Blockchain >  MY issue is all data is coming except the name when i begin with success url in stripe
MY issue is all data is coming except the name when i begin with success url in stripe

Time:01-16

The issue is when i add parameters in success url all data come but when i add name it gives error i have tried it and the conclusion i made is if i remove the spaces between letters then it work fine but i want to make it proper workable can you help me with it

 success_url: `${YOUR_DOMAIN}/success/${product.email}/${product.quantity}/${product.amount}`,

It works completely fine with data that have no space between them but doesnt work on data havong space All i need is to add name in it so this url look like this

 success_url: `${YOUR_DOMAIN}/success/${product.name}/${product.email}/${product.quantity}/${product.amount}`,

But it gives this error if i add name

Here is the error when i add product.name in it

CodePudding user response:

The URL must be encoded. If it is not done automatically, just wrap the URL inside this function: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI

It replaces i.e. spaces with valid URL characters

  • Related