Skip to content

feat: add stripe_agent for product and price management#127

Open
Copilot wants to merge 3 commits intomainfrom
copilot/add-stripe-agent
Open

feat: add stripe_agent for product and price management#127
Copilot wants to merge 3 commits intomainfrom
copilot/add-stripe-agent

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

Adds a standalone stripe_agent.py module for managing Stripe products and prices, complementing the existing api/stripe_inauguration.py checkout flow.

New module: stripe_agent.py

  • ensure_product(name, *, description, metadata) — idempotent product creation; searches by name first, falls back to create on InvalidRequestError (test-mode accounts)
  • create_price(product_id, unit_amount, currency, *, recurring, metadata) — one-time or recurring price; validates non-empty product_id and unit_amount >= 0; normalises currency to lowercase
  • list_active_prices(product_id) — returns all active prices via auto_paging_iter as plain dict list

All three functions resolve STRIPE_SECRET_KEY from env via a shared _configure_stripe() helper, consistent with api/stripe_inauguration.py.

product = ensure_product("TryOnYou Snap", description="Zero-Size · PCT/EP2025/067317")
price = create_price(product["id"], 9800, "eur", recurring={"interval": "month"})
prices = list_active_prices(product["id"])

Other changes

  • .gitignore — excludes stripe_agent_*.json / stripe_agent_*.log (local API dumps that may contain sensitive product/price IDs)
  • tests/test_stripe_agent.py — 23 unit tests using unittest.mock.patch; covers validation errors, search-hit/miss paths, fallback on InvalidRequestError, recurring prices, and paging behaviour

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tryonyou-pilot Error Error Apr 8, 2026 2:06pm

Request Review

Copilot AI changed the title [WIP] Add stripe_agent for product and price management feat: add stripe_agent for product and price management Apr 8, 2026
Copilot AI requested a review from LVT-ENG April 8, 2026 14:08
Copy link
Copy Markdown
Member

@LVT-ENG LVT-ENG left a comment

Choose a reason for hiding this comment

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

Yes

Copy link
Copy Markdown
Member

@LVT-ENG LVT-ENG left a comment

Choose a reason for hiding this comment

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

Yes

@LVT-ENG LVT-ENG marked this pull request as ready for review April 8, 2026 14:13
Copy link
Copy Markdown
Member

@LVT-ENG LVT-ENG left a comment

Choose a reason for hiding this comment

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

Yes

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