Skip to content

Feat/dodo products creation#98

Merged
SteakFisher merged 7 commits into
ScrawnDotDev:devfrom
0xanshu:feat/dodo-products-creation
Jul 6, 2026
Merged

Feat/dodo products creation#98
SteakFisher merged 7 commits into
ScrawnDotDev:devfrom
0xanshu:feat/dodo-products-creation

Conversation

@0xanshu

@0xanshu 0xanshu commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This pull request refactors and improves the onboarding flow for Dodo Payments integration. The main changes are automatic creation of product IDs during onboarding (instead of requiring them from the user), better error handling for common Dodo Payments API errors, and stricter, normalized validation of the currency field. These changes simplify the onboarding process and make it more robust.

Onboarding Flow Improvements:

  • Product IDs for Dodo Payments (dodo_live_product_id, dodo_test_product_id) are now created automatically during onboarding, rather than being provided by the user. The code creates both live and test products and stores their IDs.
  • Webhook creation for both live and test environments is performed in parallel, and the webhook URLs have been updated to a new endpoint (createCheckout).

Validation and Schema Updates:

  • The currency field in onboardingSchema is now a strict enum (usd, eur, gbp, inr, jpy) and is mapped to uppercase codes for consistency.

Error Handling Improvements:

  • Adds specific error handling for AuthenticationError and BadRequestError from the Dodo Payments SDK, returning clearer error messages to the user when onboarding fails due to invalid API keys or configuration issues.

These changes make onboarding with Dodo Payments more user-friendly and reliable.

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown

Greptile Summary

This PR updates the Dodo Payments onboarding flow. The main changes are:

  • Automatic creation of live and test Dodo product IDs during onboarding.
  • Parallel setup of live and test Dodo webhooks and products.
  • Rollback cleanup for created Dodo webhooks and products when setup or database persistence fails.
  • Stricter onboarding currency validation with normalized Dodo currency codes.
  • Clearer user-facing errors for Dodo authentication and bad request failures.

Confidence Score: 5/5

Safe to merge based on the reviewed changes.

The changed onboarding path now has rollback coverage for created Dodo resources and addresses the earlier webhook URL, cleanup, and import concerns.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • I ran the pre-artifact onboarding currency schema test to compare legacy behavior.
  • The pre-artifact run showed legacy behavior where arbitrary or uppercase currency strings were accepted without normalization, and caller-supplied product IDs were required.
  • I ran the post-artifact onboarding currency schema test and confirmed 12 passing assertions, including stricter enum validation, uppercase normalization, and an uppercase USD in the mirrored payload shape.
  • I captured and attached artifacts including the two test logs and the TypeScript test definitions to help inspectors verify the changes.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
src/routes/http/api/onboarding.ts Creates live/test Dodo webhooks and products during onboarding, stores generated product IDs, improves Dodo-specific errors, and cleans up products/webhooks on failure.
src/zod/internals.ts Removes required Dodo product IDs from onboarding input and restricts currency to supported lowercase values transformed to Dodo currency codes.

Reviews (6): Last reviewed commit: "fix(products): correct path to import Cu..." | Re-trigger Greptile

Comment thread src/routes/http/api/onboarding.ts Outdated
Comment thread src/routes/http/api/onboarding.ts Outdated
Comment thread src/zod/internals.ts Outdated
@SteakFisher SteakFisher merged commit 41ebfe6 into ScrawnDotDev:dev Jul 6, 2026
3 checks passed
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