#sergx_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/1217795107789602889
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
public function buy($priceId, Request $request)
{
$request->validate([
'quantity' => 'required|numeric|min:1',
'business_name' => 'required',
]);
$user = User::find(auth()->id());
return $request->user()->checkout([$priceId], [
'line_items' => [
[
'price' => $priceId,
'quantity' => $request->quantity,
],
],
'client_reference_id' => $user->id,
'billing_address_collection' => 'required',
'allow_promotion_codes' => false,
'locale' => 'es',
'automatic_tax' => [
'enabled' => true,
],
'tax_id_collection' => [
'enabled' => true,
],
'success_url' => route('dashboard.pay', ['purchase' => 'successful']),
'cancel_url' => route('dashboard.pay'),
'invoice_creation' => [
'enabled' => true,
],
'custom_fields' => [
[
'key' => 'business',
'label' => [
'type' => 'custom',
'custom' => 'Write your business name',
],
'type' => 'text',
'optional' => false,
// 'text' => [
// 'value' => $request->business_name,
// ],
],
],
'mode' => 'payment',
]);
}
๐ happy to help
I have an input on frontend, I would like to pass input data to the custom field in Stripe Checkout
unfortunately you can't pass default values for custom fields
but it seems like a good feature request
Great thank you very much! Yep, as a feedback that feature would be really useful
I just submitted your feedback
Thank you very much tarzan
let me know if you need any more help