Skip to content

Add Stripe machine payments facade - #236

Open
bensandler-stripe wants to merge 3 commits into
tempoxyz:mainfrom
bensandler-stripe:bensandler/stripe-machine-payments-clean
Open

Add Stripe machine payments facade#236
bensandler-stripe wants to merge 3 commits into
tempoxyz:mainfrom
bensandler-stripe:bensandler/stripe-machine-payments-clean

Conversation

@bensandler-stripe

Copy link
Copy Markdown
Contributor

Implement a higher-level Stripe machine-payments facade like we previously implemented in mppx.

  • Configure SPT and Tempo offers from one initialized Stripe client.
  • Record settled Tempo payments in Stripe without making recording part of settlement.
  • Apply Stripe minimums, machine-payment metadata, and attributed preview API requests.

@socket-security

socket-security Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​stripe@​15.6.199100100100100

View full report

@bensandler-stripe
bensandler-stripe force-pushed the bensandler/stripe-machine-payments-clean branch 7 times, most recently from 7dbbe7c to b817f1f Compare August 31, 2026 17:00
bensandler-stripe and others added 2 commits August 31, 2026 13:08
- Configure SPT and Tempo offers from one initialized Stripe client.
- Record settled Tempo payments in Stripe without making recording part of settlement.
- Apply Stripe minimums and attributed preview API requests.

Related mppx work:
- [Stripe machine-payments facade](wevm/mppx#764)
- [Offer availability](wevm/mppx#776)
- [Graceful default methods](wevm/mppx#782)
- [Remove obsolete MPP metadata](wevm/mppx#816)

Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
- Expose `spt()` as the canonical Shared Payment Token factory.
- Keep `stripe()` compatible while warning callers to migrate.

Related mppx work:
- [Stripe machine-payments facade](wevm/mppx#764)

Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@bensandler-stripe
bensandler-stripe force-pushed the bensandler/stripe-machine-payments-clean branch from b817f1f to 7d56bd6 Compare August 31, 2026 17:15
@bensandler-stripe bensandler-stripe changed the title DNR feat: add Stripe machine payments facade Add Stripe machine payments facade Sep 1, 2026
@bensandler-stripe
bensandler-stripe marked this pull request as ready for review September 1, 2026 15:03
@bensandler-stripe

Copy link
Copy Markdown
Contributor Author

r? @brendanjryan

might be easier to review commit by commit; the second commit is just a rename

@brendanjryan

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T13:14:54.328667Z 7d56bd6 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d56bd624f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +152 to +153
spt: list[StripeMethod | TempoMethod] = [self.spt.charge()]
return [self.tempo.charge(), *spt] if self._tempo_address is not None else spt

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enforce the SPT minimum for the single-method default

When deposit_addresses is omitted, this returns only the SPT method, so Mpp.charge() and Mpp.pay() take their single-method paths (src/mpp/server/mpp.py lines 529-565 and 617-660), which never invoke can_offer. Consequently, the default facade still advertises and attempts Stripe payments below the configured 50-cent minimum, rather than reporting that no offer is available. Ensure the minimum is enforced even when SPT is the sole default method.

Useful? React with 👍 / 👎.

Comment on lines +234 to +237
options = {
"headers": {"X-Request-Source": stripe_defaults.STRIPE_REQUEST_SOURCE},
"idempotency_key": f"mpp_{challenge_id}_{spt}",
"stripe_version": stripe_defaults.MACHINE_PAYMENTS_API_VERSION,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Send attribution through a supported Stripe option

For installations allowed by the new stripe>=8.0.0 dependency, stripe-python's request options do not support a headers entry, so this value is ignored rather than emitted as X-Request-Source; the Tempo recording path uses the same unsupported option. The fake clients only assert that the dictionary was received and therefore miss that real SDK requests are not attributed. Use a Stripe SDK mechanism that actually forwards the custom header, or raise the minimum Stripe version to one that explicitly supports it.

Useful? React with 👍 / 👎.

@brendanjryan brendanjryan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

from mpp.methods.tempo._defaults import CHAIN_ID, TESTNET_CHAIN_ID

if TYPE_CHECKING:
from stripe import StripeClient

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@brendanjryan

Copy link
Copy Markdown
Collaborator

@bensandler-stripe can you look at the p1 codex comment? design-wise this looks good to me

@bensandler-stripe
bensandler-stripe force-pushed the bensandler/stripe-machine-payments-clean branch from 7d56bd6 to 1c6a0a1 Compare September 2, 2026 21:08
Route methods= through composition even with one method so offer availability hooks apply consistently. Preserve direct method= behavior and multi-method result shapes.

Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@bensandler-stripe
bensandler-stripe force-pushed the bensandler/stripe-machine-payments-clean branch from 1c6a0a1 to ad5fbc5 Compare September 2, 2026 21:27
@bensandler-stripe

Copy link
Copy Markdown
Contributor Author

@brendanjryan addressed!

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.

2 participants