How to only save instance of a class once Checkout Fulfilled (One-time payment) #517
-
Hi all, Loving this gem! Just a quick question. Let's say I have a Job model. And I want to make sure the user has paid before the Job they have created is saved, does anyone know how I can do this with the pay gem? I've been trying to figure out how to tweak the code below (which is in the docs) to do this.
The workaround I was thinking of was adding a paid column to the Jobs table, which would be a boolean, and then set it to true when checkout is complete. Then I could only show the Jobs where paid == true |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Since the webhook is asynchronous, the approach I would take is track the
|
Beta Was this translation helpful? Give feedback.
Since the webhook is asynchronous, the approach I would take is track the
status
of the Job instead of waiting to save it.status
=:pending
payment_status
of the Checkout Session is paid, update thestatus
=:paid