Skip to content

feat: add Paykit subscriptions - #1186

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

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

Conversation

@ben-kaufman

@ben-kaufman ben-kaufman commented Aug 26, 2026

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.
  • Keeps subscribe-and-pay inside one continuously presented sheet, including initial-payment failure and retry, without the modal dismissal/reappearance gap.
  • Retains the settled payment rail in completed request and subscription history so Lightning feedback is purple and on-chain feedback is orange, including success confetti.

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 Tests

  • Receive an immediate-start private subscription proposal and verify review → payment → success stays in one continuously presented sheet.
  • Exercise initial-payment failure and retry and verify the Send sheet remains presented while the first period stays due.
  • Verify Lightning and on-chain subscription success choose purple/orange confetti and matching completed-payment icons.
  • Receive a future-start proposal, trigger its due notification, and open the exact billing-period payment.
  • Dismiss and reopen a due request from the bell queue and Payments tab, then pay it with fresh private payment details.
  • Review active, expired, fixed-term, and open-ended subscription details and cancel an active subscription.

Automated Checks

  • Full testDevDebugUnitTest suite
  • Focused PaykitPaymentRequestRepoTest, PaykitPaymentRequestRepoSubscriptionTest, SubscriptionsScreenTest, and AppViewModelSendFlowTest
  • compileDevDebugKotlin
  • compileDevDebugAndroidTestKotlin
  • detekt --rerun-tasks
  • arm64 assembleDevDebug, install, and cold launch on API 36 emulator CodexBullTlsUiApi36
  • 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