#raheel3031_best-practices

1 messages ยท Page 1 of 1 (latest)

gilded sentinelBOT
#

๐Ÿ‘‹ 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.

dark herald
#

hi there!

#

what's your question?

dawn ember
#

Hello

#

I want to integrate stripe payment elements in my store.

#

My code is not working

#

I need help with this

dark herald
#

what exactly is not working?

gilded sentinelBOT
dawn ember
#

Hello

#

Stripe elements are not showing in my frontend

glacial osprey
#

Which documentation are you following?

#

Do you see any errors in the console?

dawn ember
#

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

glacial osprey
#

I think the error message is self-explanatory

dawn ember
glacial osprey
#

Can you make sure that the publishable key is correctly set?

#

That should fix the problem.

dawn ember
#

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

glacial osprey
#

It seems like env('STRIPE_KEY') doesn't set the Stripe key correctly.

#

It seems to be empty. You need to find out why.

dawn ember
#

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

glacial osprey
glacial osprey
glacial osprey
dawn ember
#

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>

glacial osprey
#

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.

dawn ember
#

ok

#

thanks

#

i thought you guys would know how to solve this

#

i have shared a lot of code with you

glacial osprey
#

It's a problem of how you import env variables in your app, so it's not directly related to Stripe.

dawn ember
#

if you had better documentation then it would be easier

#

the code is from your stripe documentation how i import the keys

glacial osprey
dawn ember
#

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

glacial osprey