Skip to content

halvorai-ingest 0.5.0: Stripe adapter - #10

Merged
hedge-waleed merged 1 commit into
mainfrom
claude/project-thread-rk7bdz
Nov 10, 2026
Merged

hedge-waleed merged 1 commit into
mainfrom
claude/project-thread-rk7bdz

Conversation

@hedge-waleed

Copy link
Copy Markdown
Contributor

Summary

Python had no Stripe adapter, while the Node.js and Go SDKs both have one. In the SDK end-to-end test, the Errandly demo had to map Stripe Issuing webhooks by hand. This PR adds halvorai_ingest.stripe, ported from @halvorai/ingest/stripe:

  • halvor.stripe(event) maps a verified Stripe webhook event, queues it, and returns the event id. It returns None for types it doesn't handle and never raises.
  • map_stripe_event(event) covers 8 types. PaymentIntent authorized, succeeded and failed, charge.refunded and charge.dispute.created go on the stripe rail. Issuing authorization created and updated, and Issuing transaction created (capture or refund), go on the card rail.
  • tag_payment_intent and tag_issuing_card write metadata.halvor_* from agent_context or from keyword overrides. That includes the agent name and framework, cut to 128 and 64 characters.
  • stripe_webhook_handler and STRIPE_HANDLED_TYPES are also exported.
  • It has no dependency on the Stripe library. It accepts a dict or a stripe.Event (via to_dict()).
  • README section, CHANGELOG, and version bump to 0.5.0.

Tests and verification

  • tests/test_stripe.py adds 40 tests. The fixtures are copied from the Node.js SDK. expected.json holds the Node.js mapStripeEvent output for every fixture plus two edge cases (a named card, and Connect with SPT, a long name and a bad currency). Python output equals it exactly.
  • Every fixture goes through a real HalvorClient, gets signed, and passes validate_event.
  • Also covered: tag helpers (context, overrides, length limits) and a round trip from tag to webhook to a named agent.
  • I checked by hand that the mapper gives the same result for a real stripe.Event from stripe-python 16.1.0.
  • pytest: 185 passed. mypy --strict: clean. uv run --locked is OK. The wheel includes halvorai_ingest/stripe/.

Brain update

  • What changed: the Python SDK halvorai-ingest 0.5.0 adds a Stripe and Stripe Issuing adapter (halvorai_ingest.stripe, halvor.stripe(event), tag_payment_intent, tag_issuing_card).
  • Why: parity with the Node.js and Go SDKs. Python customers who pay with Stripe or agent cards had to write their own mapping.
  • Affected APIs, schemas, SDKs, integrations, or behavior: the Python SDK only. It adds a new module and a new HalvorClient.stripe method. No APE schema or server change.
  • Verification performed: parity tests against the Node.js mapper output, plus validation of signed events.
  • Deployment status (merged code is not necessarily deployed): not merged. It reaches PyPI only when a v0.5.0 GitHub Release is published, which runs the trusted-publishing workflow.
  • Known limitations and follow-up: the monorepo copy at halvorai-app/packages/sdk-python is behind this repo (it is still at 0.2.0). The halvorai-app docs pages are updated in a separate PR.

Generated by Claude Code

Adds halvorai_ingest.stripe, a port of @halvorai/ingest/stripe: halvor.stripe(event),
map_stripe_event, stripe_webhook_handler, tag_payment_intent and tag_issuing_card (agent name
and framework included). The tests compare the output with the Node.js mapper for every shared
fixture, so Python, Node.js and Go map Stripe webhooks the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CpycUZtFJDZbpUr3cUnE6Y
@hedge-waleed hedge-waleed self-assigned this Nov 10, 2026
@hedge-waleed
hedge-waleed merged commit 19ede52 into main Nov 10, 2026
1 check passed
@hedge-waleed
hedge-waleed deleted the claude/project-thread-rk7bdz branch November 10, 2026 09:42
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