Skip to content

Feat/add payment processing component#350

Open
HarshVz wants to merge 12 commits intododopayments:mainfrom
HarshVz:feat/add-payment-processing-component
Open

Feat/add payment processing component#350
HarshVz wants to merge 12 commits intododopayments:mainfrom
HarshVz:feat/add-payment-processing-component

Conversation

@HarshVz
Copy link
Copy Markdown
Contributor

@HarshVz HarshVz commented Jan 6, 2026

Add Payment Processing Component

Summary

Adds a new Payment Processing component that displays a full-screen loading state during payment transactions with customizable messaging and security indicators.

Changes

  • ✨ New payment processing component with animated spinner
  • 🔒 Security indicators with customizable icons
  • 📱 Responsive design with dark/light mode support
  • 📚 Complete documentation with usage examples

Files Added:

  • Component: src/registry/billingsdk/payment-processing.tsx
  • Demo: src/registry/billingsdk/demo/payment-processing-demo.tsx
  • Docs: content/docs/components/payment-processing/index.mdx
  • Registry: public/r/payment-processing.json

Files Modified:

  • registry.json - Added component entry
  • content/docs/meta.json - Updated navigation
  • src/mdx-components.tsx - Registered demo component
Generic.PnP.Monitor.2026-01-07.00.21.34.mp4

Installation

npx shadcn@latest add @billingsdk/payment-processing

Usage

import PaymentProcessing from '@/components/billingsdk/payment-processing';

<PaymentProcessing status={isProcessing} />

How to Test

  1. npm ci
  2. npm run typecheck
  3. npm run build
  4. npm run dev → Navigate to /docs/components/payment-processing

Checklist

  • Title is clear and descriptive
  • Manual verification completed
  • CI passes (typecheck & build)
  • Docs updated

Suggestion #246
Suggestion #335

Summary by CodeRabbit

  • New Features

    • Added a Payment Processing UI showing transaction status with spinner, customizable title, description, icon, process label, and security/warning message.
    • Added a demo that simulates a “Pay now” flow and toggles the processing state.
  • Documentation

    • Added a full MDX docs page with preview/code tabs, installation notes, usage examples, props table, theming, accessibility guidance, and best practices.

Adds a new payment processing component that displays a full-screen loading state during payment transactions.

Features:
- Full-screen overlay with animated spinner
- Customizable messaging (title, description, warning)
- Security indicators with icon support
- Responsive design with dark/light mode support

Files:
- Component: src/registry/billingsdk/payment-processing.tsx
- Demo: src/registry/billingsdk/demo/payment-processing-demo.tsx
- Demo copy: src/components/payment-processing-demo.tsx
- Documentation: content/docs/components/payment-processing/index.mdx
- Registry: registry.json (added payment-processing entry)
- Docs: content/docs/meta.json (navigation update)
- MDX: src/mdx-components.tsx (component registration)
@vercel
Copy link
Copy Markdown

vercel bot commented Jan 6, 2026

@HarshVz is attempting to deploy a commit to the Dodo Payments Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 6, 2026

Warning

Rate limit exceeded

@autofix-ci[bot] has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 617bb97 and 4025c8b.

📒 Files selected for processing (8)
  • public/r/payment-processing.json
  • public/r/pricing-table-five.json
  • public/r/registry.json
  • registry.json
  • src/components/billingsdk/payment-processing.tsx
  • src/components/payment-processing-demo.tsx
  • src/registry/billingsdk/demo/payment-processing-demo.tsx
  • src/registry/billingsdk/payment-processing.tsx
📝 Walkthrough

Walkthrough

Adds a new Payment Processing component, a client demo, MDX documentation page, and registry/public manifest entries to expose the component and demo throughout docs and registries.

Changes

Cohort / File(s) Summary
Documentation
content/docs/components/payment-processing/index.mdx
New MDX page describing the PaymentProcessing UI with Preview/Code tabs, installation, usage examples, props table, features, best practices, and theming notes.
Documentation Metadata
content/docs/meta.json
Registered the new documentation page in docs navigation.
Public Registry Aggregation
public/r/all.json, public/r/registry.json, public/r/payment-processing.json
Added @billingsdk/payment-processing to all registry dependencies and introduced a payment-processing registry block with component and demo entries and dependency metadata.
Registry Manifest
registry.json
Added payment-processing registry:block referencing component and demo files, declared dependencies (lucide-react) and registryDependencies (separator, utils).
Registry Components
src/registry/billingsdk/payment-processing.tsx, src/registry/billingsdk/demo/payment-processing-demo.tsx
New exported PaymentProcessing component and PaymentProcessingDemo demo (client). Component exposes PaymentProcessingTypes and renders a full-screen processing UI when active; demo toggles loading state and simulates an 8s process.
App Exports / MDX Integration
src/components/billingsdk/payment-processing.tsx, src/components/payment-processing-demo.tsx, src/mdx-components.tsx
Added client-side re-export for PaymentProcessing and its type, added a client PaymentProcessingDemo component, and exposed the demo in getMDXComponents for MDX usage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • tsahil01
  • thepushkaraj

Poem

🐰
A tiny hop, a glowing ring,
Spinners whirl and cash registers sing.
Shield held high, the process hums—
Click, wait, success becomes.
Hop forward, carrots for the crumbs. 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a new Payment Processing component to the codebase.
Description check ✅ Passed The description comprehensively covers all required sections: purpose, detailed changes with file listings, testing steps, and a completed checklist following the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Fix all issues with AI Agents
In @public/r/payment-processing.json:
- Around line 15-20: The demo imports setTimeout from the Node "timers" module
and uses it incorrectly with async/await; remove the import line that imports
setTimeout, then fix PaymentProcessingDemo by updating handleProcessing to
either return a Promise that resolves after a browser setTimeout (so await
works) or make handleProcessing synchronous and drop async/await in
onClickHandler; specifically edit the import block to remove the timers import
and update the handleProcessing and onClickHandler functions so setTimeout is
called as the global browser function and state is cleared inside the timeout
(use a Promise wrapper if you want to await completion).

In @src/components/payment-processing-demo.tsx:
- Line 5: The file wrongly imports setTimeout from the Node.js 'timers' module;
remove the line "import { setTimeout } from 'timers';" and rely on the
browser/global setTimeout instead, updating any references that assumed the
imported symbol (e.g., calls in this component) to use the global function
without an import.
- Around line 10-19: handleProcessing currently uses setTimeout without
returning a Promise so awaiting it in onClickHandler does nothing; change
handleProcessing to return a Promise that resolves after the delay (e.g. return
new Promise(resolve => setTimeout(resolve, 8000))) and move setLoading(false) to
after the await in onClickHandler so flow is: setLoading(true); await
handleProcessing(); setLoading(false). Use the existing function names
handleProcessing and onClickHandler and keep setLoading calls as described.

In @src/registry/billingsdk/demo/payment-processing-demo.tsx:
- Line 5: The file contains a Node.js-specific import "import { setTimeout }
from 'timers';" which will break in the browser; remove that import line and
rely on the global setTimeout instead (search for the import of setTimeout in
payment-processing-demo.tsx and delete it).
- Around line 10-19: The handleProcessing function is using setTimeout but is
async and awaited by onClickHandler, which is ineffective because setTimeout
doesn't return a Promise; fix by making handleProcessing return a Promise that
resolves after the timeout (e.g., replace the setTimeout call with a Promise
that resolves after 8000ms) so await handleProcessing() actually waits, or
remove the async/await and directly call setLoading(true) then set a setTimeout
to setLoading(false) inside onClickHandler; update the functions
handleProcessing and onClickHandler accordingly.
🧹 Nitpick comments (2)
src/components/payment-processing-demo.tsx (1)

24-24: Simplify the onClick handler.

The async arrow function wrapper is unnecessary here since onClickHandler can be called directly.

🔎 Proposed fix
       <Button
-        onClick={async () => await onClickHandler()}
+        onClick={onClickHandler}
         className={`${loading ? "hidden" : "block"}`}
       >
src/registry/billingsdk/demo/payment-processing-demo.tsx (1)

23-25: Simplify redundant async/await wrapper.

The onClick handler unnecessarily wraps onClickHandler in an async function and awaits it. Since onClickHandler is already async, you can pass it directly.

🔎 Proposed fix
       <Button
-        onClick={async () => await onClickHandler()}
+        onClick={onClickHandler}
         className={`${loading ? "hidden" : "block"}`}
       >
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bdf5fc8 and e406988.

📒 Files selected for processing (10)
  • content/docs/components/payment-processing/index.mdx
  • content/docs/meta.json
  • public/r/all.json
  • public/r/payment-processing.json
  • public/r/registry.json
  • registry.json
  • src/components/payment-processing-demo.tsx
  • src/mdx-components.tsx
  • src/registry/billingsdk/demo/payment-processing-demo.tsx
  • src/registry/billingsdk/payment-processing.tsx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: rajdesai17
Repo: dodopayments/billingsdk PR: 278
File: src/registry/billingsdk/demo/limited-offer-dialog-demo.tsx:1-55
Timestamp: 2025-10-03T13:12:09.970Z
Learning: In the dodopayments/billingsdk repository, demo files should be duplicated in both `src/components/` and `src/registry/billingsdk/demo/` directories with identical implementations. Do not suggest re-exporting or consolidating these demo files.
📚 Learning: 2025-10-03T13:12:09.970Z
Learnt from: rajdesai17
Repo: dodopayments/billingsdk PR: 278
File: src/registry/billingsdk/demo/limited-offer-dialog-demo.tsx:1-55
Timestamp: 2025-10-03T13:12:09.970Z
Learning: In the dodopayments/billingsdk repository, demo files should be duplicated in both `src/components/` and `src/registry/billingsdk/demo/` directories with identical implementations. Do not suggest re-exporting or consolidating these demo files.

Applied to files:

  • src/mdx-components.tsx
  • public/r/registry.json
  • src/registry/billingsdk/demo/payment-processing-demo.tsx
  • public/r/payment-processing.json
  • src/components/payment-processing-demo.tsx
  • registry.json
🧬 Code graph analysis (3)
src/registry/billingsdk/payment-processing.tsx (1)
src/components/ui/separator.tsx (1)
  • Separator (28-28)
src/registry/billingsdk/demo/payment-processing-demo.tsx (2)
src/components/payment-processing-demo.tsx (1)
  • PaymentProcessingDemo (8-32)
src/registry/billingsdk/payment-processing.tsx (1)
  • PaymentProcessing (13-55)
src/components/payment-processing-demo.tsx (2)
src/registry/billingsdk/demo/payment-processing-demo.tsx (1)
  • PaymentProcessingDemo (8-32)
src/registry/billingsdk/payment-processing.tsx (1)
  • PaymentProcessing (13-55)
🔇 Additional comments (10)
content/docs/meta.json (1)

47-47: LGTM!

The documentation page entry is correctly added to the navigation and properly positioned within the Payment Processing section.

public/r/all.json (1)

32-32: LGTM!

The registry dependency is correctly added to the All Components collection.

src/registry/billingsdk/payment-processing.tsx (2)

13-20: Verify the default status = true behavior.

The component defaults to showing the processing overlay (status = true). This means when instantiated without props, it will immediately display the full-screen loading state. Typically, loading/processing overlays default to hidden (status = false) and are explicitly shown when needed.

Please confirm this is the intended behavior for your use case.


21-55: LGTM!

The component implementation is clean and well-structured with proper:

  • Conditional rendering based on status
  • Responsive design classes
  • Customizable props for all UI elements
  • Proper TypeScript typing
  • Dark/light mode support via Tailwind classes
public/r/registry.json (2)

51-51: LGTM!

The payment-processing component is correctly added to the All Components registry dependencies.


905-924: LGTM!

The registry block entry is properly structured with:

  • Correct component and demo file paths
  • Appropriate dependencies (lucide-react for icons)
  • Correct registryDependencies (card, separator, utils)
  • Follows the established pattern of other components in the registry
registry.json (2)

51-51: LGTM! Correct registry integration.

The new payment-processing component is properly added to the "all" components aggregation list.


904-924: LGTM! Well-structured registry entry.

The payment-processing block follows the established registry pattern with appropriate dependencies and file targets.

src/mdx-components.tsx (1)

52-52: LGTM! Proper MDX component registration.

The PaymentProcessingDemo component is correctly imported and exposed in the MDX components registry, following the established pattern for other demo components.

Also applies to: 108-108

content/docs/components/payment-processing/index.mdx (1)

1-171: LGTM! Comprehensive and well-structured documentation.

The documentation provides clear installation instructions, usage examples, a complete props table, and helpful best practices. The structure follows the established pattern for other BillingSDK components.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
src/registry/billingsdk/demo/payment-processing-demo.tsx (2)

25-25: Simplify: Remove redundant async wrapper.

The async () => await onClickHandler() wrapper is unnecessary since onClickHandler is already async and React's onClick doesn't require awaiting the handler.

🔎 Proposed fix
-        onClick={async () => await onClickHandler()}
+        onClick={onClickHandler}

26-26: Simplify: Remove unnecessary template literal.

The template literal adds no value when the entire className is determined by a ternary expression.

🔎 Proposed fix
-        className={`${loading ? "hidden" : "block"}`}
+        className={loading ? "hidden" : "block"}
src/components/payment-processing-demo.tsx (2)

25-25: Simplify: Remove redundant async wrapper.

The async () => await onClickHandler() wrapper is unnecessary since onClickHandler is already async and React's onClick doesn't require awaiting the handler.

🔎 Proposed fix
-        onClick={async () => await onClickHandler()}
+        onClick={onClickHandler}

26-26: Simplify: Remove unnecessary template literal.

The template literal adds no value when the entire className is determined by a ternary expression.

🔎 Proposed fix
-        className={`${loading ? "hidden" : "block"}`}
+        className={loading ? "hidden" : "block"}
public/r/payment-processing.json (1)

15-20: Optional improvements in embedded demo code.

The embedded PaymentProcessingDemo contains the same optional simplifications noted in the standalone demo files:

  1. The onClick={async () => await onClickHandler()} wrapper is redundant
  2. The template literal in className is unnecessary

These refinements would be applied by updating the source demo files, which will then be reflected in this registry content.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e406988 and 617bb97.

📒 Files selected for processing (3)
  • public/r/payment-processing.json
  • src/components/payment-processing-demo.tsx
  • src/registry/billingsdk/demo/payment-processing-demo.tsx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: rajdesai17
Repo: dodopayments/billingsdk PR: 278
File: src/registry/billingsdk/demo/limited-offer-dialog-demo.tsx:1-55
Timestamp: 2025-10-03T13:12:09.970Z
Learning: In the dodopayments/billingsdk repository, demo files should be duplicated in both `src/components/` and `src/registry/billingsdk/demo/` directories with identical implementations. Do not suggest re-exporting or consolidating these demo files.
📚 Learning: 2025-10-03T13:12:09.970Z
Learnt from: rajdesai17
Repo: dodopayments/billingsdk PR: 278
File: src/registry/billingsdk/demo/limited-offer-dialog-demo.tsx:1-55
Timestamp: 2025-10-03T13:12:09.970Z
Learning: In the dodopayments/billingsdk repository, demo files should be duplicated in both `src/components/` and `src/registry/billingsdk/demo/` directories with identical implementations. Do not suggest re-exporting or consolidating these demo files.

Applied to files:

  • src/components/payment-processing-demo.tsx
  • src/registry/billingsdk/demo/payment-processing-demo.tsx
  • public/r/payment-processing.json
🧬 Code graph analysis (2)
src/components/payment-processing-demo.tsx (1)
src/registry/billingsdk/payment-processing.tsx (1)
  • PaymentProcessing (13-55)
src/registry/billingsdk/demo/payment-processing-demo.tsx (1)
src/registry/billingsdk/payment-processing.tsx (1)
  • PaymentProcessing (13-55)
🔇 Additional comments (3)
src/registry/billingsdk/demo/payment-processing-demo.tsx (1)

9-20: LGTM! Async logic correctly implemented.

The Promise-wrapped setTimeout and proper async/await flow correctly address the issues from previous reviews. The 8-second processing simulation works as intended.

src/components/payment-processing-demo.tsx (1)

9-20: LGTM! Async logic correctly implemented.

The Promise-wrapped setTimeout and proper async/await flow correctly address the issues from previous reviews. The processing simulation works as intended.

public/r/payment-processing.json (1)

1-14: LGTM! Registry metadata correctly configured.

The schema, dependencies, and component content are properly structured. The lucide-react dependency and registry dependencies (card, separator, utils) align with the component's imports.

@HarshVz
Copy link
Copy Markdown
Contributor Author

HarshVz commented Jan 29, 2026

@tsahil01 can you please review this PR!

Copy link
Copy Markdown
Member

@tsahil01 tsahil01 left a comment

Choose a reason for hiding this comment

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

@HarshVz Thanks for the PR!
Overall looks good, only minor fixes then we can merge it!

registry.json Outdated
}
],
"dependencies": ["lucide-react"],
"registryDependencies": ["card", "separator", "utils"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this component is not using card, can you remove it from registryDependencies?

"use client";

import { useState } from "react";
import PaymentProcessing from "@/registry/billingsdk/payment-processing";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We generally create the same component in the registry and simply export it from that file.

Please refer to the other demo files in /components and see how the main component is being imported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

alright, sorry i didnt check it. i have fixed it now, can you review it again?

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@public/r/payment-processing.json`:
- Around line 11-17: The PaymentProcessing component is only a named export but
PaymentProcessingDemo imports it as a default, causing a runtime import error;
fix by making the exports consistent—either add a default export for the
component (e.g., export default PaymentProcessing or change the function to
export default function PaymentProcessing) in the PaymentProcessing component,
or change the import in PaymentProcessingDemo to a named import (import {
PaymentProcessing } from "...") so PaymentProcessing and PaymentProcessingDemo
use the same export style.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 617bb97 and 91289e3.

📒 Files selected for processing (7)
  • public/r/payment-processing.json
  • public/r/pricing-table-five.json
  • public/r/registry.json
  • registry.json
  • src/components/billingsdk/payment-processing.tsx
  • src/components/payment-processing-demo.tsx
  • src/registry/billingsdk/payment-processing.tsx
✅ Files skipped from review due to trivial changes (1)
  • public/r/pricing-table-five.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/registry/billingsdk/payment-processing.tsx
  • registry.json
  • src/components/payment-processing-demo.tsx

@HarshVz HarshVz force-pushed the feat/add-payment-processing-component branch from 9790ecb to 02f2227 Compare March 1, 2026 06:59
@HarshVz
Copy link
Copy Markdown
Contributor Author

HarshVz commented Mar 2, 2026

@tsahil01 sir can you please review this again?

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.

3 participants