send21-haystack
A Haystack 2.x component that asks send21 to prepare a payment request and returns a pay link, plus a webhook signature helper.
This is a community package. It is not an official deepset integration.
send21 prepares payment instructions. A person opens the pay link and signs in their own wallet; funds go straight from the payer's wallet to the receiver's wallet. send21 never holds keys or funds, never signs and never broadcasts. Use an API key with the drafts:write scope only. That key can prepare a payment request but cannot move funds.
Install
Not on PyPI yet. Install from git:
pip install git+https://github.com/send21io/send21-haystack
Usage in a pipeline
from haystack import Pipeline
from send21_haystack import Send21PaymentRequest
# reads SEND21_API_KEY from the environment (scope: drafts:write)
payment = Send21PaymentRequest(currency="USDC", network="base", address="0xYourReceivingAddress")
p = Pipeline()
p.add_component("payment", payment)
out = p.run({"payment": {"amount": 1.50, "fiat_currency": "USD",
"order_id": "run-42", "memo": "agent top-up"}})
print(out["payment"]["pay_link"]) # https://send21.io/p/...
Outputs: id, pay_link, raw (the full tool result).
Offline: pass client=MockSend21Client() to get deterministic fake ids with no network. See examples/pipeline.py.
What it sends
The component calls the send21 MCP server at https://send21.io/mcp (Streamable HTTP, Authorization: Bearer <key>), tool create_payment_request, with these fields only:
fiatCurrency, fiatAmount, options: [{currency, network, address}], orderId, memo, expiryHours (null if unset), idempotencyKey.
It reads id and payPath from the result; the pay link is https://send21.io + payPath. Arguments are checked against the server's live inputSchema before the call.
Webhooks
from send21_haystack import verify_send21_webhook
ok, scheme = verify_send21_webhook(raw_body_bytes, headers, signing_secret) # scheme: "v2", "v1" or None
It checks X-Send21-Signature-V2 first: t=<timestamp>,v1=<lowercase hex HMAC-SHA256 of "<timestamp>.<delivery id>.<raw body>">, keyed with the endpoint signing secret, and refuses deliveries older than 5 minutes, so a copied delivery cannot be replayed. The legacy X-Send21-Signature (sha256=<lowercase hex HMAC-SHA256 of the raw body>, no timestamp) is still sent for compatibility and is used only as a fallback when no V2 header is present (allow_legacy=False turns it off). verify_send21_signature_v2 and the legacy verify_send21_signature are also exported. Check the raw bytes before parsing. Store X-Send21-Delivery and ignore repeats; deliveries can be retried and arrive out of order. A stdlib receiver is in examples/webhook_receiver.py.
Tests
pip install -e ".[dev]" && pytest
Tests run fully offline (the MCP client is mocked).
Unverified
Not confirmed against the live API yet; check https://send21.io/docs and the live MCP tools/list first.
- The
statusandexpiresAtvalues in thecreate_payment_requestresponse, and the exactpayPathformat. OnlyidandpayPathare relied on. - Exact accepted
currencyandnetworknames foroptions; the examples useUSDC/base. - Whether API keys can target testnet. Assume mainnet; use small amounts.
- Webhook payload fields beyond
eventanddata.orderId(for examplepaymentRequestId,fiatAmount). - Whether a key's scopes can be read through the API. Create the key with
drafts:writeonly.
Related
- Agent spend-cap handoff example: https://github.com/send21io/send21-over-budget-handoff
- More examples: https://github.com/send21io/send21-examples
- Docs: https://send21.io/docs
License and contact
MIT. Questions: info@send21.io
Metadata
Release files for send21-haystack 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| send21_haystack-0.1.1.tar.gz | 8.7 kB | Without provenance | Details for send21_haystack-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| send21_haystack-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for send21_haystack-0.1.1-py3-none-any.whl |
Total release size: 17.9 kB
Release files / send21_haystack-0.1.1.tar.gz
| Download URL | send21_haystack-0.1.1.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68569ff61d1f060a96c96ba6798a7473979fccf8efef9cc3b1bd2af080b1ed58
|
|
BLAKE2b-256 checksum How to use checksums |
05e24e9bad09d250d93f5ba3b8f56ce42d7a713cc54664acfca2acefd23764bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / send21_haystack-0.1.1-py3-none-any.whl
| Download URL | send21_haystack-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
974acf498b3530959e08c3cc39c82ebcc25b84c9715c88573c367b1785cf418f
|
|
BLAKE2b-256 checksum How to use checksums |
3f15742e798f3e130fc4c7804a5b3c345c6e04b6a6ba25ff711f8660f350ff7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for send21-haystack 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.