Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Marcus Guedes 5 posts 25 karma points
    Jul 02, 2024 @ 17:23
    Marcus Guedes
    0

    Invalid HTML after /umbraco/commerce/storefront/api/v1/checkout/{orderId}/token

    Hi,

    Using Umbraco 13.1, trying to do a headless checkout workflow with Hosted option (just redirect to payment), following the documentation, everything goes fine until the call /umbraco/commerce/storefront/api/v1/checkout/{orderId}/token, and redirect to the payUrl, the payURL is something like:

    https://domain.com/umbraco/commerce/storefront/api/v1/checkout/2a0bfa0e-26e0-4e1a-ae38-0190746bcec4/pay/aa5973cd-cdaf-4d80-9770-9561909aa2de

    Redirecting to the URL gives a broken HTML and it doesn't work. I already tried the same thing using the https://github.com/umbraco/Umbraco.Headless.Demo, it also has the same problem using the redirect option on UMBRACOCOMMERCECHECKOUT_MODE.

    the HTML returned:

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="utf-8">
        <title>Umbraco Commerce - Redirecting...</title>
        <script
            src="https://js.stripe.com/v3/"><script>
                    var stripe = Stripe('pk_test_xxxxxxxxxxxx');
                    window.handleStripeCheckout = function (e) {
                        e.preventDefault();
                    stripe.redirectToCheckout({
                        sessionId: 'cs_test_xxxxxxxxxx'
            }).then(function (result) {
                        // If `redirectToCheckout` fails due to a browser or network
                        // error, display the localized error message to your customer
                        // using `result.error.message`.
                    });
                    return false;
        }
                    <script></head><body><form action="https://domain.com/umbraco/commerce/payment/continue/stripe-checkout/2a0bfa0e-26e0-4e1a-ae38-0190746bcec4/ORDER-01645-61742-GPQPJ/b905d5b42dc26929a36594a6126879fb7a817297" method="post" id="form6235abd338fe4bbca11d98466d5ecb3a"></form><script>window.onload = function(event) { var frm = document.getElementById("form6235abd338fe4bbca11d98466d5ecb3a"); if (frm.hasAttribute("onsubmit")) {frm.dispatchEvent(new Event("submit", { cancelable: true })); } else {frm.submit(); } }</script>
        </body>
    
    </html>
    

    using the devtools console, with that broken page, and create the stripe object and do stripe.redirectToCheckout(), it redirect correct to stripe and I can make the payment..

    can anyone help me?

  • Alex 3 posts 73 karma points
    Jul 03, 2024 @ 05:19
    Alex
    0

    the closing tag for the Stripe script is missing, which is causing the rest of the script not to run properly.

    <script
            src="https://js.stripe.com/v3/"><strong></script>

  • Marcus Guedes 5 posts 25 karma points
    Jul 09, 2024 @ 12:35
    Marcus Guedes
    0

    there is a bug in Umbraco, it will be fixed in the next build. https://github.com/umbraco/Umbraco.Commerce.Issues/issues/532

Please Sign in or register to post replies

Write your reply to:

Draft