#sadeghiamir_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1302865196250959936
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
if (subscription != null) {
appTracker.sendServiceLog("process_stripe_3.1_invoice_id", SERVICE_NAME, user.getId(), null, false, subscription.getLatestInvoice(), BigQueryEventLevel.INFO);
Invoice invoice = null;
if (subscription.getLatestInvoice() != null) {
invoice = stripeGateway.getLastInvoiceOfSubscription(subscription.getLatestInvoice());
}
log.info("invoice {} for subscription {}", invoice, subscription);
if (invoice == null) log.error("subscription has not invoice id :{}", subscription);
appTracker.sendServiceLog("process_stripe_3.2_webhook_payment_intent_id", SERVICE_NAME, user.getId(), null, false, invoice != null ? invoice.getPaymentIntent() : null, BigQueryEventLevel.INFO);
PaymentIntent paymentIntent = null;
if (invoice != null && invoice.getPaymentIntent() != null)
paymentIntent = stripeGateway.getPaymentIntent(invoice.getPaymentIntent());
if (paymentIntent == null) log.error("payment intent does not exist :{}", invoice);
appTracker.sendServiceLog("process_stripe_3.3_webhook_payment_intent", SERVICE_NAME, user.getId(), null, false, paymentIntent != null ? paymentIntent.toJson() : null, BigQueryEventLevel.INFO);
if (paymentIntent != null && Objects.equals(paymentIntent.getStatus(), "succeeded"))
updateSubscriptionFromStripeSubscriptionWebhook(subscription, user);
}
Hi there, in_1QHIBADNZsE8LVSagONcSHYs is not finalized and that's why its paymentIntent is null
after finalize payentIntent , I get customer.subscription.updated again?
You mean when the invoice is finalized? you will receive a invoice.finalized event
I listen to customer.subscription.updated only and update end of subscription in my application with this webhook event.
if I Ignore getting invoice and payment Intent , the current period end of subscription is not valid for using in my application.
but if I got this event again after payent ment succeeded , I can trust to this webhook
if the primary objective is to get notified if the invoice payment succeeds. Then you should listen to invoice.paid event
https://docs.stripe.com/billing/subscriptions/event-destinations these are the webhook events for subscriptions
other question:
When a payment fails, Stripe automatically retries a few times. If payment does not succeed after multiple tries, do we get a customer.subscription.deleted webhook?
It depends on your you settings on smart retries https://docs.stripe.com/billing/subscriptions/overview#smart-retries
If you settings set teh subscription transition to "cancelled" if recovery fails, then yes you'll receive customer.subscription.deleted
how can get only active subscriptions related to customer from stripe api in spring boot?