#raheel3031_code

1 messages ยท Page 1 of 1 (latest)

steady condorBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

alpine hill
#

Hi there, can you open browser console and see if there are any errors?

umbral hemlock
#

No nothing

#

Can I talk with you in one hour

#

I have to drop the kids

#

And how can I share the code

alpine hill
#

You can paste the code here

#

The thread will be closed after a while. Feel free to use the button on #help to create a new thread.

umbral hemlock
#

Yes

#

I will share code

#

in AppServiceProvider I have this :

    {
        PageBuilder::configureUsing(function (PageBuilder $builder) {
            $builder->collapsible(); //You can use any method supported by the Builder field
            $builder->collapsed();            
        });
        Cashier::useCustomerModel(Customer::class);
    }    ```
#

in web.php

    Route::view('dashboard', 'dashboard')->name('dashboard');
    Route::view('profile', 'profile')->name('profile');
    Route::get('/checkout', CheckoutPage::class)->name('checkout');
    Route::get('/success', SuccessPage::class)->name('success');
    Route::get('/cancel', CancelPage::class)->name('cancel');
    Route::post('/webhook', [CheckoutPage::class, 'webhook'])->name('checkout.webhook');    

    // Route::view('my-orders', 'my-orders')->name('my-orders');
    // Route::get('/my-order/{order}', OrderDetailPage::class)->name('orderDetail');
    // Route::view('my-wishlist', 'my-wishlist')->name('my-wishlist');  
});```
#

i want to add multiple payment elements

alpine hill
#

Pleae remove the secret key from this chat.

#

Discord is a public place so everyone can see the content here

umbral hemlock
#

ok

#

i have removed the message

alpine hill
#

Ok, is there a public URL that I can visit to check your integration in test mode?

umbral hemlock
#

no

#

i have a repo on github

alpine hill
#

Looks like all the code related to PaymentIntent is commented out

#

Can you tell me how you create a paymentIntent, and pass its clientSecert to the frontend?

#

Or you switch to Checkout Session API?

umbral hemlock
#

it is in the code

#

no

#

i want the customer to stay on the site

#

the part with the redirect to the stripe website is not what i want

#

but i have the form with customer details which is working with livewire

#

this part is from stripe

<script src="https://js.stripe.com/v3/"></script>
<script>
    const stripe = Stripe('{{ config('services.stripe.key') }}');
    const elements = stripe.elements();
    const cardElement = elements.create('card');

    // DOM elements
    const cardHolderName = document.getElementById('card-holder-name');
    const cardButton = document.getElementById('payment-method');
    const clientSecret = cardButton.dataset.secret;

    cardElement.mount('#card-element');

    cardElement.addEventListener('change', function(event) {
        const displayError = document.getElementById('card-errors');
        if(event.error) {
            displayError.textContent = event.error.message;
        } else {
            displayError.textContent = '';
        }
    });

    // Handle Form Submission
    const paymentForm = document.getElementById('payment-form');

    paymentForm.addEventListener('submit', function(event) {
        event.preventDefault();

        stripe
            .handleCardSetup(clientSecret, cardElement, {
                payment_method_data: {
                    billing_details: {
                        name: cardHolderName.value
                    }
                }
            })
            .then(function(result) {
                if(result.error) {
                    //inform the user when there was an error
                    var errorElement = document.getElementById('card-errors');
                    errorElement.textContent = result.error.message;
                } else {
                    const paymentMethodInput = document.getElementById('payment-form');
                    paymentMethodInput.value = result.setupIntent.payment_method;
                    paymentForm.submit();
                }
            })
    });

</script>
    
@endpush```
alpine hill
#

This is completely different from what you shared with me earlier.

#

To allow me start the investigation quickly. Can I suggest you to deploy your latest code to your staging server, so that I can check it out?

umbral hemlock
#

i dont have a staging server

#

that code is in the checkout.blade.php

#

i shared it before

#

but i also have a checkout.php where the logic for the customer data and order data is

alpine hill
#

Your code contains checkout session, card element and even ideal-element, so I have no idea what kind of integration that you want to complete and what objective you want to achieve.

umbral hemlock
#

i want multiple payment methods

alpine hill
#

Can I recommend you to use our no-code solution?

#

Accept a payment or sell subscriptions without building additional standalone websites or applications with Payment Links. Share the link as many times as you want on social media, in emails, or on your website.

umbral hemlock
#

i wanted to use the card option first

alpine hill
#

You can use payment link to start accepting payments without writing any code.

umbral hemlock
#

and then later incorporate other payments options

#

no that is not what i want

alpine hill
umbral hemlock
#

yes this is what i want

#

but i need some help with incorporating this

#

wha ami doing wrong in checkout.php

alpine hill
#

I'd recommend you go through this doc to start your integration fresh. This page contains lots of example code that you can copy and paste in your project.

umbral hemlock
#

u didn't check my code

#

in the documentation it doesn't say what routes to create

#

the problemis with the customer data and order data

#

i have to collect that as well

alpine hill
#

You can still use your existing code for collecting customer and order data. You just need to follow the integration doc for the payment integration.