samedi 27 février 2021

Managing order processing of different types of items

Currently We have two step order confirmation:

  1. Create order in database with paid field as 0
  2. Accept request of user payment and on successful payment update paid to total order amount

I am having problem following this mehtod for other type of items introduced later.

So,

Item A is a service. Order is created in the database and a razorpay order is also created. It is a service based item so a booking is also created for this item. It's upto the user to pay anytime he wasnts.

On other hand,

Item B is not a service. So, Order is created in the database and a razorpay order is also created. But user has to pay to complete the order.

The problem is if booking is canceled for a service or a order is unpaid for combos, those orders just hangs in the db consuming space.

So I end up with having four APIs for handling order and payment of both types:

  1. /orders/service
  2. /payments/service
  3. /orders/combo
  4. /payments/combo

It's clear the above list will just grow if new items were introduced in the system.

Is there anyway I could combine them into single step?

I am using razorpay as payment gateway, which needs a unique order number so I have to create order in database before creating a razorpay order ot process payment.

Links: Razorpay Payment Flow

Aucun commentaire:

Enregistrer un commentaire