#wackjeston_code

1 messages · Page 1 of 1 (latest)

bitter birchBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1413529372492693595

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

hard isle
#

Trying to update the amount showing £240

#

Basically when the user selects a different shipping option I need it to update the amount to account for the new shipping cost.

patent valley
#

Hi, what do you see when you make the fetchUpdates() call here?

hard isle
#

Hello, one sec just getting the error for you

#

I only get this error when using update() & fetchUpdates()

#

I am initialising the element without an intent, then when the user first clicks on one of the express methods, I register:

#

function stripeRegister() {
if (stripeClientSecret == null) {
if (stripeDebug) {
console.log('Registering Stripe Payment Intent');
}

    var params = {
        expressCheckout: true,
        amount: stripeAmount
    };

    var url = '/System/API/Stripe/Register.php';
    url += '?' + $.param(params);

    fetch(url).then(async function(response) {
        if(response.status == 200) {
            response.json().then(function(data) {
                stripeOrderId = data.orderId;
                stripePaymentId = data.paymentId;
                stripeAmount = data.amount;
                stripeClientSecret = data.clientSecret;

                stripeElements.update({
                    clientSecret: stripeClientSecret
                });

                stripe.retrievePaymentIntent(stripeClientSecret).then(function(result) {
                    if(result.error) {
                        stripeShowError(result.error.message);
                    } else {
                        stripePaymentIntent = result.paymentIntent;
                        stripeExpressCheckoutInitialise();
                    }
                });
            });
            
        } else {
            var errors = await response.json();

            return Promise.reject(errors.join('<br>'));
        }
    }).catch(function(error) {
        stripeLog('Error payment intent could not be registered.');

        stripeShowError(error);
    });
}

}

#

This is my register function

#

Any luck?

hard isle
#

Yeah I've tried this, doesn't seem to do anything

#

I am now finishing work so I will be leaving in a minute. I will get back in touch next week if I'm still struggling with this issue.

#

Thanks for your help anyway

#

have a nice weekend

patent valley
#

What does not seem to work? What do you see intead?