Skip to content

feat: add Paykit subscriptions - #1186

Open
ben-kaufman wants to merge 2 commits into
codex/paykit-payment-proofs-androidfrom
codex/paykit-subscriptions-android
Open

feat: add Paykit subscriptions#1186
ben-kaufman wants to merge 2 commits into
codex/paykit-payment-proofs-androidfrom
codex/paykit-subscriptions-android

Conversation

@ben-kaufman

Copy link
Copy Markdown
Contributor

Description

Adds the payer side of Paykit subscriptions, stacked on #1178.

  • Receives private subscription proposals and lets the payer review and confirm them.
  • Requires an immediately due first period to be paid before showing the subscribed success state; failed or uncertain payments remain due and can be retried.
  • Turns each unpaid billing period into the existing incoming payment-request flow, including automatic presentation, the bell queue, and the Payments tab.
  • Schedules local due-payment notifications and opens the corresponding request when the notification is selected.
  • Adds the Figma-aligned Subscriptions and Payments tabs, subscription detail/status views, cancellation, empty states, and fixed/open-ended summaries.
  • Associates payment proofs with their exact billing period so recurring periods remain independent while retaining private-only resolution and fresh Private Payment List requirements.

This PR intentionally covers payer-side receipt only. Subscription creation, Discover, automatic payment without confirmation, and renewal are not included because they are outside this MVP or are not currently exposed by Paykit.

Dependencies:

Preview

Final Android and cross-platform proof recordings were completed locally; they are not attached to the PR.

QA Notes

Manual coverage:

  1. Receive an immediate-start private subscription proposal, review it, confirm it, pay the first period, and verify that Subscribed appears only after payment succeeds.
  2. Exercise failed and uncertain initial payments and verify that the first period remains due with a retry path.
  3. Receive a future-start proposal, verify its active state, trigger its due notification, and open the associated payment flow.
  4. Dismiss a due subscription request, reopen it from the bell queue and Payments tab, and complete payment.
  5. Review active, expired, fixed-term, and open-ended subscription details and cancel an active subscription.
  6. Pay a later period and verify that it uses fresh private payment details without trying another endpoint from a consumed list or falling back to public details.

Automated and static checks:

  • PaykitPaymentRequestRepoSubscriptionTest
  • PaykitSubscriptionTest
  • PaykitPaymentProofRepoTest
  • AppViewModelSendFlowTest
  • SubscriptionsScreenTest
  • compileDevDebugKotlin
  • compileDevDebugAndroidTestKotlin
  • testDevDebugUnitTest
  • detekt
  • git diff --check

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown

Greptile Summary

Adds payer-side Paykit subscriptions, recurring-period payment requests, period-specific payment proofs, local due notifications, and subscription/payment management UI.

  • Materializes recurring billing periods into the existing payment-request and send flows.
  • Persists subscription presentation, dismissal, acceptance, and in-flight proof state.
  • Adds subscription status/detail/cancellation screens and scheduled notification routing.
  • Extends Lightning and on-chain send handling to associate proofs with exact billing periods.

Confidence Score: 4/5

The subscription restoration defect should be fixed before merging because it can silently remove valid unpaid billing periods from every payment entry point.

When local acceptance state is unavailable, the repository substitutes a later paid-period or record-event timestamp, and period generation consequently filters out earlier unpaid obligations.

Files Needing Attention: app/src/main/java/to/bitkit/repositories/PaykitPaymentRequestRepo.kt; app/src/main/java/to/bitkit/repositories/PaykitSubscription.kt

Important Files Changed

Filename Overview
app/src/main/java/to/bitkit/repositories/PaykitPaymentRequestRepo.kt Coordinates subscription acceptance, restoration, due-period generation, dismissal, cancellation, and notification state; restored acceptance timestamps can omit earlier unpaid periods.
app/src/main/java/to/bitkit/repositories/PaykitSubscription.kt Defines recurrence parsing, period generation, lifecycle classification, and conversion of periods into payment requests.
app/src/main/java/to/bitkit/repositories/PaykitPaymentProofRepo.kt Adds period-specific Lightning and on-chain proof persistence, reconciliation, submission, and cancellation protection.
app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt Integrates subscription requests and payment-proof preparation with existing send success, pending, failure, and retry paths.
app/src/main/java/to/bitkit/repositories/PaykitSubscriptionNotificationScheduler.kt Schedules unique local work for upcoming subscription periods and routes notification selections to exact requests.
app/src/main/java/to/bitkit/ui/screens/subscriptions/SubscriptionsScreen.kt Adds subscription/payment tabs, detail and status views, summaries, cancellation, and empty states.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Private subscription proposal] --> B[Review and accept]
    B --> C[Persist acceptance state]
    C --> D[Materialize billing periods]
    D --> E[Pending payment request]
    E --> F[Existing send flow]
    F --> G{Payment result}
    G -->|Failed| E
    G -->|Pending| H[Retain in-flight proof]
    G -->|Succeeded| I[Submit period-specific proof]
    I --> J[Paid-period history]
    D --> K[Schedule due notification]
    K --> E
Loading

Reviews (1): Last reviewed commit: "feat: add Paykit subscription payments" | Re-trigger Greptile

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.

1 participant