#alessandro.ricci

1 messages · Page 1 of 1 (latest)

uneven houndBOT
gleaming oar
#

Hi! Let me help you with this.

#

Where do you see the error? Do you have a screenshot?

topaz heart
#

sure just one moment

#

this is the code

#

paymentForm.addEventListener("submit", async (event) => {
event.preventDefault();

    const { error } = await stripe.confirmPayment({
        //`Elements` instance that was used to create the Payment Element
        elements,
        confirmParams: {
            return_url: `${base_url}booking/${adv_id}/?payment=confirmed`,
        },
    });

    if (error) {
        // This point will only be reached if there is an immediate error when
        // confirming the payment. Show error to your customer (for example, payment
        // details incomplete)
        const messageContainer = document.querySelector("#card-errors");
        messageContainer.textContent = error.message;
    } else {
        // Your customer will be redirected to your `return_url`. For some payment
        // methods like iDEAL, your customer will be redirected to an intermediate
        // site first to authorize the payment, then redirected to the `return_url`.
    }
});
#

with this response

#

{
"error": {
"code": "url_invalid",
"doc_url": "https://stripe.com/docs/error-codes/url-invalid",
"message": "Not a valid URL",
"param": "return_url",
"payment_intent": {
"id": "pi_3MeGLrEutbHy81io0y0qREna",
"object": "payment_intent",
"amount": 187500,
"amount_details": {
"tip": {
}
},
"automatic_payment_methods": {
"enabled": true
},
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"client_secret": "pi_3MeGLrEutbHy81io0y0qREna_secret_cAqbxTvwQ9F3mCM1hGmIVZeW8",
"confirmation_method": "automatic",
"created": 1677064751,
"currency": "eur",
"description": null,
"last_payment_error": null,
"livemode": false,
"next_action": null,
"payment_method": null,
"payment_method_types": [
"card",
"bancontact",
"eps",
"giropay",
"ideal",
"link"
],
"processing": null,
"receipt_email": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"status": "requires_payment_method"
},
"request_log_url": "https://dashboard.stripe.com/test/logs/req_oTEIDpf3q8NUIW?t=1677064759",
"type": "invalid_request_error"
}
}

Learn more about error codes and how to resolve them.

#

is it possible that the invalid url is why im using a local envirorment ?

gleaming oar
#

I see you are sending return_url: "//localhost:3000/booking/...",

A valid URL needs to have a protocol in the beginning: http://localhost:3000/booking/...

topaz heart
#

ohhh thankyou there where a misconfiguration by my side