#monshery-pi
1 messages · Page 1 of 1 (latest)
Ok background the way i have it setup right now
I have a table for transaction
that holds some details
paymentIntentId
price
etc etc
and some user details
when i do
customer: user.stripeCustomerId,
amount: price,
currency,
payment_method: paymentMethodId,
off_session: true,
confirm: true,
metadata: {
transactionId: transaction.id
}
});
transaction.intentId = paymentIntent.id;
await transaction.save({transaction: t});
after the user already paid once
So basically i create a new charge then create a trsansaction with the detail i specified above
those operations are update locked
and it seems that the webhook reaches my server so fast the save operation doesnt even finish
which mean that the webhook cannot fetch the transaction line
So to solve this i am thinking of avoiding the webhook alltogether and relaying just on the successful return of the above call
Another solution is to move the paymentIntent update operation to the webhook itself
one sec reading
Sure
and it seems that the webhook reaches my server so fast the save operation doesnt even finish
so you can't try to be synchronous with webhook events, you'll have to implement something on your end where you respond to the webhook event first, then wait until your db has saved the PI record.
Alternatively, you could just update your db when you receive the webhook Event
i think that what i'll do
i think i will just update the payment intent in the webhook
Thanks