#raheel3031_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ 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/1328303023289663570
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- raheel3031_code, 36 minutes ago, 58 messages
Hello
I want to integrate stripe payment elements in my store.
My code is not working
I need help with this
what exactly is not working?
Uncaught IntegrationError: Please call Stripe() with your publishable key. You used an empty string.
at l (v3/:1:178529)
at new e (v3/:1:507790)
at xd (v3/:1:558710)
at checkout:1037:18
ok
let's start over
i will sharea screen shot
I think the error message is self-explanatory
Can you make sure that the publishable key is correctly set?
That should fix the problem.
i want the multiple stripe elements with different patment methods displayeddisplayed
i have set this
const stripe = Stripe('{{ env('STRIPE_KEY') }}');
i don't understand the message
It seems like env('STRIPE_KEY') doesn't set the Stripe key correctly.
It seems to be empty. You need to find out why.
this is in the env file with keys
STRIPE_KEY=
STRIPE_SECRET
Uncaught ReferenceError: Stripe is not defined
at <anonymous>:3:20
at swapCurrentPageWithNewHtml (livewire.js?id=38dc8241:7692:19)
at livewire.js?id=38dc8241:7870:11
at preventAlpineFromPickingUpDomChanges (livewire.js?id=38dc8241:7947:5)
at livewire.js?id=38dc8241:7860:9
at getPretchedHtmlOr (livewire.js?id=38dc8241:7425:14)
at fetchHtmlOrUsePrefetchedHtml (livewire.js?id=38dc8241:7941:5)
at navigateTo (livewire.js?id=38dc8241:7854:7)
at livewire.js?id=38dc8241:7848:11
at HTMLAnchorElement.handler4 (livewire.js?id=38dc8241:7333:11)
in console io have this now
What have you changed in your code?
I don't know what framework you're using and how the variables are injected in the HTML files, but it seems like STRIPE_KEY is an empty string.
Is this the whole file? Or is there an actual key STRIPE_KEY=pk_test_xxx?
i am using laravel with laravelk cashier
in te fornt end for the form for customer and order data livewire
yes i have this STRIPE_KEY=pk_test_xxx
this is in the checkout.php
this script is in the checkout.blade.php which i have share
<script>
// Initialize Stripe
const stripe = Stripe('{{ env('STRIPE_KEY') }}');
const elements = stripe.elements();
// Create an instance of the card Element
const card = elements.create('card');
card.mount('#card-element');
// Handle form submission
var form = document.getElementById('payment-form');
form.addEventListener('submit', async function(event) {
event.preventDefault();
// Disable the submit button to prevent multiple submissions
document.getElementById('submit').disabled = true;
// Create a payment method using the card Element
const { token, error } = await stripe.createToken(card);
if (error) {
// Display error message to the user
document.getElementById('card-errors').textContent = error.message;
document.getElementById('submit').disabled = false;
} else {
// Send the token to the backend for processing
@this.call('processStripePayment', token.id);
}
});
</script>
I don't know much about how Laravel Cashier works, but the problem is that the env('STRIPE_KEY') is an empty sting. Seems like the env variables are not imported correctly. You need to find out how to fix it in your framework.
ok
thanks
i thought you guys would know how to solve this
i have shared a lot of code with you
It's a problem of how you import env variables in your app, so it's not directly related to Stripe.
if you had better documentation then it would be easier
the code is from your stripe documentation how i import the keys
Could you please share the documetation you're following?
Laravel Cashier is not an official Stripe library, which is why the quality of documetation might be different.
can you share the documentation from the stripe website to folow
i want to integrate credit card, ideal , bancontact and klarna
where can i find how to integrate these options
i don't want a redirect to stripe checkout
this is the error now
I recommend you to use Payment Element, and not integrate each payment method type individually, which is a deprecated approach. Payment Element supports displaying all Stripe-supported payment method types. You can see examples of a standard integration in your preferred programming language: https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements&lang=php