Order and Payment confirmation/validation with Magento2

Hi!

I’m having a bit of trouble understanding how order flow functions end-2-end so if anyone can point what I’m missing I’d be very grateful :slight_smile:

My current understanding is this:

  1. User is shown payment methods on checkout (fetched from Magento2)
  2. User picks desired payment method
  3. Payment module does its work
  4. Once done, payment module triggers checkout-do-placeOrder event
  5. VSF takes over and sends the order over to VSF-API which sends it to Magento2
  6. Order lands in Magento2 with status pending
  7. ??? (Payment should be confirmed here and order status updated, maybe invoice generated)
  8. Profit

The point 7 is what I’m unable to understand how it’s supposed to work, so I looked in to existing payment modules and how they work:

Paypal:

  • has m2-paypal-payment magento module which doesn’t do anything regarding payment validation
  • VSF-API part just fetched order and return 200

Klarna Checkout:

  • I didn’t get this one to work fully but payment validation on VSF-API doesn’t sync with Magento2

Stripe:

  • Purchase token is added to order data but that’s about it.

Any payment can be validated in 2 ways on the backend:

  1. You call the payment provider (Paypal)
  2. Payment provider calls you (Klarna)

So my questions basically boils down to this:

How and where do you validate payments?

Thanks :slight_smile:

Hi there! You’re right currently the most of VSF payment modules are not updating the backend status with what comes from payment provider. It’s pretty hard to have general mechanism for that - each payment module requires different data to be stored in different places in magento. Our idea was to create the payment status endpoints in the vue-storefront-api that are able to change the order status via API (in Magento or any other platform)

We’re open to any contributions on that. You need to implement status changes on your own as for now

Some of our users are using just the Magento checkout as a fallback instead: https://github.com/Vendic/vsf-external-checkout