I have a Vue application with a checkout view using Stripe.
The js to trigger the Stripe payment is the next one:
await stripe.confirmPayment({
elements,
confirmParams: {
return_url: `${window.location.origin}/account/#/orders/yyyyyy`,
payment_method_data: {
billing_details: billingDetails,
},
}
});
The payment and the redirection are working fine, but the new url include query parameters that the Vue app will keep in following navigations.
Example about the url generated by Stripe: http://xxxxxx/account/?payment_intent=pi_xxxxxx&payment_intent_client_secret=pi_xxxxxx_secret_xxxxxx&redirect_status=succeeded#/orders/yyyyyy
I would like something like http://xxxxxx/account/#/orders/yyyyyy?payment_intent=pi_xxxxxx&payment_intent_client_secret=pi_xxxxxx_secret_xxxxxx&redirect_status=succeeded
But because changing how the url is created by Stripe will be impossible, I would like to remove all the query parameters ?payment_intent=pi_xxxxxx&payment_intent_client_secret=pi_xxxxxx_secret_xxxxxx&redirect_status=succeeded
and rewrite the url, so following navigation will be clear again.