Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lara28580's avatar

How should I validate user stripe input?

I am using stripe as a payment system for my app. What I am wondering is how to validate these input. Did it like normal but is this not necessary because cant find something about validation? I did it like so

  $this->validate($request, [
          'plan' => 'required|in:price_1Gr4FJJAUy1fGeT4djKb1iHX,price_1Gr4FJJAUy1fGeT4ynylHGhL',
        ]);

All the tutorials I found there was no validation in place so I am curious how it is done?

0 likes
2 replies
Snapey's avatar

what exactly do you need to validate?

lara28580's avatar

I need to validate the select box for my stripe plans. I also asked myself do I have to do this also when I create a subscription because in the docs there is never any validation mentioned.

$this->authorize('addCard', User::class);

      $paymentMethod = $request->payment_method;

      $user = auth()->user();
      $options = ['name' => $user->name];
      $user->createAsStripeCustomer($options);
      $user->addPaymentMethod($paymentMethod);
      $user->updateDefaultPaymentMethod($paymentMethod);
      $user->updateDefaultPaymentMethodFromStripe();

Do I have to check here for the payment method? Or is this ok like it is?

Please or to participate in this conversation.