Search code examples
phpsymfonystripe-paymentspayum

Stripe checkout with custom form symfony


I have a checkout form that I am using to send shopping cart details to different payment gateways like paypal using Symfony and Payum.

Now I am trying to send payment details to stripe in case user selects stripe checkout option. At the moment the integration with stripe is working fine, i can send the payment and get the response from stripe however in order to send credit card details to stripe i get redirected to capture

enter image description here

where i see the "pay with card" button and if i click on it the popup appears to enter credit card details

enter image description here

What I would like to do is allow user to add credit card details on checkout form that I have rather than the form you see on popup. Is it possible to achieve this? How can i use my own form to send data to stripe rather than using stripe popup?

I found a close example of the process in this and this example. Is there any example for stripe? Any help will be greatly appreciated.


Solution

  • Stripe Checkout is designed this way. You see the button click it, fill all the required info and that's it.

    If you want to fill credit card details earlier you can do that, but in that case you have to use

    • Stripe "direct". Implemented in Omnipay and used via Omnipay Bridge
    • You have to pass omnipay credit cards like this (better way is not implemented yet):

      $order->setDetails(array( 'card' => new CreditCard($data), ));

      • and use $this->forward instead of redirect. Because credit card is not saved to database you have to process them immediately. (example)