#balthius_api

1 messages ¡ Page 1 of 1 (latest)

sour masonBOT
#

👋 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/1287880134178635866

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

buoyant lintel
#

Hi there

#

The StackOverflow link you shared uses an older legacy Checkout (redirectToCheckout)

#

Products > get checkout code Snippet
Can you clarify what you mean by this?

mighty rune
#

<!-- Load Stripe.js on your website. -->
<script src="https://js.stripe.com/v3"></script>

<!-- Create a button that your customers click to complete their purchase. Customize the styling to suit your branding. -->
<button
style="background-color:#6772E5;color:#FFF;padding:8px 12px;border:0;border-radius:4px;font-size:1em;cursor:pointer"
id="checkout-button-price_1Q1DF807C1wouvreeFWhh2AX"
role="link"
type="button"

Checkout
</button>

<div id="error-message"></div>

<script>
(function() {
var stripe = Stripe('pk_live_51P4DE907C1wouvrevRLScsoJxtmhsjWB6KNhazFR0BFoGHTzM2LgR8R4kq7webUemFhcfEzfitykcF8Ztez7IavI00iPjGAKC0');

var checkoutButton = document.getElementById('checkout-button-price_1Q1DF807C1wouvreeFWhh2AX');
checkoutButton.addEventListener('click', function () {
/*
* When the customer clicks on the button, redirect
* them to Checkout.
/
stripe.redirectToCheckout({
lineItems: [{price: 'price_1Q1DF807C1wouvreeFWhh2AX', quantity: 1}],
mode: 'payment',
/

* Do not rely on the redirect to the successUrl for fulfilling
* purchases, customers may not always reach the success_url after
* a successful payment.
* Instead use one of the strategies described in
* https://docs.stripe.com/payments/checkout/fulfill-orders
/
successUrl: window.location.protocol + '//claimclimbers.com/success',
cancelUrl: window.location.protocol + '//claimclimbers.com/canceled',
})
.then(function (result) {
if (result.error) {
/

* If redirectToCheckout fails due to a browser or network
* error, display the localized error message to your customer.
*/
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
});
})();
</script>

#

Sure, there's how I got to the script, using RedirectToCheckout.

#

Delighted to use a newer one, but this is where it sent me on Stripe itself, and what it wanted me to use.

buoyant lintel
#

Sorry for the delay