Repository navigation
feat: add an example Stripe Checkout payment page - #140
Draft
iloveitaly wants to merge 7 commits into
Draft
iloveitaly wants to merge 7 commits into
iloveitaly wants to merge 7 commits into
Conversation
Wire an unauthenticated /pay flow through the stripe helpers so checkout session secrets, retrieval, country/zip, and dispute checks are exercised. Live charges still need STRIPE_SECRET_KEY and VITE_STRIPE_PUBLIC_KEY. Co-authored-by: Michael Bianco <mike@mikebian.co>
cursor
Bot
force-pushed
the
cursor/example-stripe-payment-7574
branch
from
November 2, 2026 19:27
50d3ecd to
9ed371e
Compare
Save a pending example order before confirm, mark it paid when Stripe redirects to the complete route, and read that order on the confirmation page. Co-authored-by: Michael Bianco <mike@mikebian.co>
Walk through /pay with a test card, assert the order is paid, and store visual snapshots of the payment intro and confirmation page. Co-authored-by: Michael Bianco <mike@mikebian.co>
Sort the Python imports, format the payment pages, and keep the Stripe checkout instance in state so the submit handler does not read a ref during render. Co-authored-by: Michael Bianco <mike@mikebian.co>
The loading check still referenced checkoutReady after the Stripe instance moved into state. Co-authored-by: Michael Bianco <mike@mikebian.co>
Autogenerate the example_payment_order table and status enum so db_lint matches the model. Co-authored-by: Michael Bianco <mike@mikebian.co>
The payment images were captured with different font metrics than GitHub Actions, and the home snapshots now include the example payment link. Co-authored-by: Michael Bianco <mike@mikebian.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The Stripe helpers needed a real checkout flow.
commands.mdalready specifies that flow: create a session, save a pending order, complete it on the Stripe return, then read the order from the confirmation page.Description
/payfollows those four steps:POST /unauthenticated/example-payment/sessioncreates a Checkout Session.return_urlis the backend complete route, with Stripe's unescaped{CHECKOUT_SESSION_ID}placeholder.POST /unauthenticated/example-payment/pendingsaves anExamplePaymentOrder(email plus checkout session id) immediately before confirm. A retry updates the same order.GET /unauthenticated/example-payment/completemarks the order paid when Stripe redirects back, then sends the browser to/pay/confirmation.GET /unauthenticated/example-payment/statusreads that order and fills country, postal code, and dispute state from the stripe helpers.ui_modeiselements. That is the current name of the template'scustommode, and it matchesinitCheckoutElementsSdk.just db_generate_migration add_example_payment_orderadded revision801c44619be3. It creates theexamplepaymentorderstatusenum and theexample_payment_ordertable, including the unique checkout session id.Screenshots / Test
tests/integration/example_payment_test.pypays with Stripe test card4242and asserts the order is paid. Visual snapshots:01-payment-form.pngis the stable page intro. Stripe iframes change height between loads, so they are not part of this shot.02-payment-complete.pngmasks the email and Stripe ids.The checkout test passed on GitHub Actions. Snapshot comparison failed because the payment images were captured with different font metrics than
ubuntu-latest, and the home snapshots now include the Example payment link. Those images were replaced with the actuals from that run.The revision was applied on the dev and test databases.
uv run alembic checkreported no new operations, andjust db_lintfound 0 squawk issues.Payment page intro
Payment confirmation
Home page with payment link
Links
To show artifacts inline, enable in settings.