Stripe Webhooks aren't reliably catching charges

Yes, it has a ch_ id.

I’m using invoice.payment_succeeded to track subscription on users using customer_id that I create before adding a subscription.

You have to ping the webhook even in test-mode to see the real fields that stripe sends, cause if you test using stripe test webhook shows incomplete fields.

This is one of my real webhook ping coming from stripe to my app. (I added on some fields cause this is real data).

I’ve marked some of the important fields may you need to track properly a subscription creation/renewal.

{
“id”: “evt_1DXfup…”,
“object”: “event”,
“api_version”: “2018-07-27”,
“created”: 15425…,
“data”: {
“object”: {
“id”: “in_1DXfuoA…”,
“object”: “invoice”,
“amount_due”: 32900,
“amount_paid”: 32900,
“amount_remaining”: 0,
“application_fee”: null,
“attempt_count”: 1,
“attempted”: true,
“auto_advance”: false,
“billing”: “charge_automatically”,
“billing_reason”: “subscription_update”,
"charge": “ch_1DXfuoANJ5…”,
“closed”: true,
“currency”: “usd”,
"customer": “cus_Dyt7jr…”,
“date”: 1542…,
“default_source”: null,
“description”: null,
“discount”: null,
“due_date”: null,
“ending_balance”: 0,
“finalized_at”: 1542…,
“forgiven”: false,
“hosted_invoice_url”: “https://pay.stripe.com/invoice/…”,
“invoice_pdf”: “https://pay.stripe.com/invoice/…”,
“lines”: {
“object”: “list”,
“data”: [
{
“id”: “sli_fd5…”,
“object”: “line_item”,
“amount”: 32900,
“currency”: “usd”,
“description”: “1 × …”,
“discountable”: true,
“livemode”: true,
“metadata”: {
},
“period”: {
"end": 1574043698,
"start": 1542507698
},
“plan”: {
"id": “plan_DN…”,
“object”: “plan”,
“active”: true,
“aggregate_usage”: null,
“amount”: 32900,
“billing_scheme”: “per_unit”,
“created”: 1533…,
“currency”: “usd”,
“interval”: “year”,
“interval_count”: 1,
“livemode”: true,
“metadata”: {
},
“nickname”: “…”,
"product": “prod_DNy…”,
“tiers”: null,
“tiers_mode”: null,
“transform_usage”: null,
“trial_period_days”: null,
“usage_type”: “licensed”
},
“proration”: false,
“quantity”: 1,
"subscription": “sub_DzfFne…”,
“subscription_item”: “si_DzfFYn…”,
“type”: “subscription”
}
],
“has_more”: false,
“total_count”: 1,
“url”: “/v1/invoices/…”
},
“livemode”: true,
“metadata”: {
},
“next_payment_attempt”: null,
“number”: “8DD…”,
“paid”: true,
“payment_intent”: null,
“period_end”: 1542507698,
“period_start”: 1542507698,
“receipt_number”: null,
“starting_balance”: 0,
“statement_descriptor”: null,
“status”: “paid”,
“subscription”: “sub_Dzf…”,
“subtotal”: 32900,
“tax”: 0,
“tax_percent”: 0.0,
“total”: 32900,
“webhooks_delivered_at”: null
}
},
“livemode”: true,
“pending_webhooks”: 1,
“request”: {
“id”: “req_2V1…”,
“idempotency_key”: null
},
“type”: “invoice.payment_succeeded”
}