#sergx_code

1 messages ยท Page 1 of 1 (latest)

hardy anchorBOT
#

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

merry willow
#
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',
        ]);
    }
wild sparrowBOT
viscid kernel
#

๐Ÿ‘‹ happy to help

merry willow
#

I have an input on frontend, I would like to pass input data to the custom field in Stripe Checkout

viscid kernel
#

unfortunately you can't pass default values for custom fields

#

but it seems like a good feature request

merry willow
#

Great thank you very much! Yep, as a feedback that feature would be really useful

viscid kernel
#

I just submitted your feedback

merry willow
#

Thank you very much tarzan

viscid kernel
#

let me know if you need any more help