Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changelog/runtime-async-http.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
pympp: minor
---

Let asynchronous HTTP clients share a `PaymentRuntime` with origin and uncertain-outcome safeguards.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ async with PaymentRuntime([method]) as runtime:

The runtime borrows its methods and runs them on the caller's event loop.

The same runtime can power asynchronous HTTP clients while limiting which
origins may receive payment credentials:

```python
async with PaymentRuntime(
[method],
allowed_origins=["https://api.example.com"],
) as runtime:
async with Client(runtime=runtime) as client:
response = await client.get("https://api.example.com/paid")
```

If a credential is sent but its outcome cannot be confirmed, matching attempts
Comment thread
parvahuja marked this conversation as resolved.
raise `mpp.errors.PaymentOutcomeUnknownError`. Reconcile them externally before
calling `runtime.reset_unknown_outcomes(reconciled=True)`.

## Examples

| Example | Description |
Expand Down
Loading
Loading