#raheel3031_code
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/1328252819173544007
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there, can you open browser console and see if there are any errors?
No nothing
Can I talk with you in one hour
I have to drop the kids
And how can I share the code
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.
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 checkout.php
in checkout.blade.php
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
Pleae remove the secret key from this chat.
Discord is a public place so everyone can see the content here
Ok, is there a public URL that I can visit to check your integration in test mode?
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?
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```
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?
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
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.
i want multiple payment methods
Can I recommend you to use our no-code solution?
i wanted to use the card option first
You can use payment link to start accepting payments without writing any code.
Ok, then I'd recommend you to follow this doc https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements to integrate payment-element, it supports card payments, and many other local payment methods.
yes this is what i want
but i need some help with incorporating this
wha ami doing wrong in checkout.php
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.
You can also obtain the sample code from this github repo https://github.com/stripe-samples/accept-a-payment/tree/main/custom-payment-flow
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
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.