The flow to subscribe and pay for a plan is as follow:
POST to /api/cart/
GET /api/billing/:organization/checkout/
compute the total amount to charge from the list of invoicables.
POST to RazorPay
POST /api/billing/:organization/checkout/ with {“processor_token”: token-returned-by-razorpay}
This will call RazorpayBackend.create_charge_on_card to capture the total amount of invoicables.
GET /api/billing/charges/:charge (:charge being return by the previous call as "processor_key")
This will call Charge.payment_successful and create the Transaction in the database as well as switch Charge.state from "created" to “done".
RazorPay works somewhat differently from Stripe. The processor_token passed back by RazorPay is an actual charge id. The processor_token passed back by Stripe is a card id. It is quite possible that payment_successful could be called after razorpay.capture and make step #6 optional in RazorPay setup.
The flow to subscribe and pay for a plan is as follow:
RazorpayBackend.create_charge_on_card
to capture the total amount of invoicables.Charge.payment_successful
and create theTransaction
in the database as well as switch Charge.state from "created" to “done".RazorPay works somewhat differently from Stripe. The processor_token passed back by RazorPay is an actual charge id. The processor_token passed back by Stripe is a card id. It is quite possible that
payment_successful
could be called afterrazorpay.capture
and make step #6 optional in RazorPay setup.