Skip to content

Add invoice.upcoming trigger support via test clock fixture#1582

Open
SumitKumar-17 wants to merge 1 commit into
stripe:masterfrom
SumitKumar-17:feat/invoice-upcoming-trigger
Open

Add invoice.upcoming trigger support via test clock fixture#1582
SumitKumar-17 wants to merge 1 commit into
stripe:masterfrom
SumitKumar-17:feat/invoice-upcoming-trigger

Conversation

@SumitKumar-17
Copy link
Copy Markdown

Reviewers

r? @
cc @stripe/developer-products

Summary

Fixes the issue where stripe trigger invoice.upcoming failed
with "event is not supported", even though stripe listen --events invoice.upcoming
already worked.

Root cause: invoice.upcoming is a system-generated event fired by
Stripe's billing engine 3 days before a subscription renews.

Fix: Add pkg/fixtures/triggers/invoice.upcoming.json using Stripe's
test clock API — the approach Stripe's own documentation recommends for
testing time-based billing events.

The fixture:

  1. Creates a test clock frozen at Jan 1, 2024
  2. Creates a customer tied to that test clock (with pm_card_visa as default payment method)
  3. Creates a product + monthly recurring price
  4. Creates a subscription (first invoice paid immediately at Jan 1)
  5. Advances the clock to Jan 29, 2024 — 3 days before the Feb 1 renewal —
    which causes Stripe's billing engine to emit invoice.upcoming

Using static timestamps keeps the fixture deterministic.

Verified end-to-end against live test keys:

image

Stripe returned evt_... with "type": "invoice.upcoming",
"billing_reason": "upcoming", and a draft invoice (no ID) attached —
exactly the payload a real invoice.upcoming webhook carries.

Changes

  • pkg/fixtures/triggers/invoice.upcoming.json — new fixture file

@SumitKumar-17 SumitKumar-17 requested a review from a team as a code owner May 10, 2026 10:46
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 10, 2026

CLA assistant check
All committers have signed the CLA.

@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 10, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 10, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@SumitKumar-17
Copy link
Copy Markdown
Author

If Approved adds the invoice.upcoming triggers also fixes #558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant