Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search

jianliu86

Circle Member
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Here is the answer from Stripe regarding the windows location portocal "Thanks for contacting Stripe support. I understand that you had an issue where an error occurred for the checkout due to the code being generated not containing the HTTPS protocol. I have looked into this and can advise that the code generated is directly affected by the 'business website' input in your account settings. So if HTTPS is not included in your business address, it will not be included in the generated URL snippet. I see that to fix the issue, you included the HTTPS directly into the code and removed the 'window.location.protocol' section of the code. As the window.location.protocol object would return either HTTPS or HTTP from your business address, it is not required if you are directly inputting the protocol into the code, the outcome is as expected. "
  2. Thanks for the reply @tazmeah. So the error I was getting with the code was: Uncaught IntegrationError: successUrl must start with either http:// or https:// After talking with Stripe, we found out that it was the "window.location.protocol" from the successUrl and the cancelUrl that was causing the button not to work. After removing that and adding "https:" to the urls , the button worked like a charm. Couple of other things to keep in mind. Make sure you are using the live public key, the domain you are working with is added in Stripe. That's it! The Stripe rep said he will follow up on why the generated snippet from Stripe excludes the https: and includes "window.location.protocol". Will report back if there is anything important there.
  3. Site URL: http://www.kilohanaconsulting.com/test Hello, Squarespace does not allow tax exemption on particular products so I'm trying to use a workaround where I just direct people through Stripe checkout. Using Stripe, I have created the code snippet below. I created a simple test page with a code injection block and that code: http://www.kilohanaconsulting.com/test. However, the checkout button doesn't redirect upon click. Any ideas? Thanks! <!-- 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" id="checkout-button-price_1I3TbCGnshx2TCYrnAcW1HCT" role="link" type="button" > Checkout </button> <div id="error-message"></div> <script> (function() { var stripe = Stripe('pk_live_NglqNclDqUqmbRGTpR8cUrmz00U4WqUg7y'); var checkoutButton = document.getElementById('checkout-button-price_1I3TbCGnshx2TCYrnAcW1HCT'); checkoutButton.addEventListener('click', function () { /* * When the customer clicks on the button, redirect * them to Checkout. */ stripe.redirectToCheckout({ lineItems: [{price: 'price_1I3TbCGnshx2TCYrnAcW1HCT', 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://stripe.com/docs/payments/checkout/fulfill-orders */ successUrl: window.location.protocol + '//kilohanaconsulting.com/success', cancelUrl: window.location.protocol + '//kilohanaconsulting.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>
  4. Fixed. The forum automatically included the . so that broke the url. Thanks!
  5. @bangank36 That worked like a charm. Thank you so much for your help!!
  6. Hello, I'm trying to utilize this timeline code from Codepen but I cannot figure out how to get it to work: https://codepen.io/itbruno/pen/KwarLp I have limited coding knowledge so any help would be great! I tried copy and pasting the CCS under custom CSS and then I copied the HTML and put it in a code block on a page. I also tried putting the CCS under the advanced setting. I think I'm missing a key step or two. Thanks!
×
×
  • Create New...