Пользователь добавляет элементы в свою корзину. < /P>
Они переходят к оформлению, и платеж создается или обновляется. на оплату и статус подтвержден. Я получаю эту ошибку: < /p>
pgsql < /p>
Order not found for PaymentIntentId: pi_xxx
< /code>
При отладке я заметил, что платеж, возвращаемый из полосы, не соответствует платежнике, хранящемуся в заказе. OrderPaymentStatus должен быть выплачен. < /P>
Статус заказа должен быть подтвержден. < /P>
Но ничего из этого не происходит потому, что WebHook не может найти заказ по платетину. var existingOrder = (await _unitWork.Repository().GetAllAsync())
.FirstOrDefault(o => o.CartId == cart.Id && o.PaymentIntentId == cart.PaymentIntentId);
if (existingOrder != null)
return cart;
if (!string.IsNullOrEmpty(cart.PaymentIntentId))
{
await service.UpdateAsync(cart.PaymentIntentId, options);
}
else
{
intent = await service.CreateAsync(createOptions);
cart.PaymentIntentId = intent.Id;
cart.ClientSecret = intent.ClientSecret;
}
< /code>
обработчик Webhook
csharp < /p>
case "payment_intent.succeeded":
var succeededOrder = await _paymentService.UpdateOrderPaymentSucceeded(succeededIntent.Id);
if (succeededOrder == null)
{
_logger.LogWarning("Webhook received for unknown PaymentIntentId: {Id}", succeededIntent.Id);
}
Could it be a timing issue, where the webhook fires before the order is saved with the PaymentIntentId?
Am I missing a step linking the PaymentIntent to the actual order?
Verified the PaymentIntentId stored in the cart and what Stripe returns.
Logged all PaymentIntentId values at intent creation and webhook.
Checked Stripe dashboard: payment is successful.
< /code>
asp.net core 7 < /p>
stripe .net sdk < /p>
Репозиторий + единица рабочего шаблона < /p>
Порядок создается после платежа со ссылкой на Cart Info < /p>
Я использую Redis для корзины
Подробнее здесь: https://stackoverflow.com/questions/796 ... -payment-s