Add Stripe machine payments facade - #236
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
7dbbe7c to
b817f1f
Compare
- 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>
b817f1f to
7d56bd6
Compare
|
might be easier to review commit by commit; the second commit is just a rename |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| spt: list[StripeMethod | TempoMethod] = [self.spt.charge()] | ||
| return [self.tempo.charge(), *spt] if self._tempo_address is not None else spt |
There was a problem hiding this comment.
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 👍 / 👎.
| 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, |
There was a problem hiding this comment.
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 👍 / 👎.
| from mpp.methods.tempo._defaults import CHAIN_ID, TESTNET_CHAIN_ID | ||
|
|
||
| if TYPE_CHECKING: | ||
| from stripe import StripeClient |
|
@bensandler-stripe can you look at the p1 codex comment? design-wise this looks good to me |
7d56bd6 to
1c6a0a1
Compare
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>
1c6a0a1 to
ad5fbc5
Compare
|
@brendanjryan addressed! |
Implement a higher-level Stripe machine-payments facade like we previously implemented in mppx.