Skip to content

feat: add Paykit subscriptions - #1186

Open
ben-kaufman wants to merge 13 commits into
masterfrom
codex/paykit-subscriptions-android
Open

feat: add Paykit subscriptions#1186
ben-kaufman wants to merge 13 commits into
masterfrom
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 #1199, which is 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.
  • Shows a normalized Monthly Cost across all active subscriptions, independent of whether the current periods are already paid.
  • 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

This comment has been minimized.

@jvsena42

Copy link
Copy Markdown
Member

could test the PR stack feature for this case

@ben-kaufman
ben-kaufman force-pushed the codex/paykit-payment-proofs-android branch from f189535 to a1a7907 Compare August 28, 2026 13:29
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from 2eecc75 to baf9894 Compare August 28, 2026 14:36
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-payment-proofs-android branch from 9e4ee27 to 19823e6 Compare August 31, 2026 13:10
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from baf9894 to 5a876f8 Compare August 31, 2026 13:10
Comment thread app/src/main/java/to/bitkit/repositories/PaykitPaymentProofRepo.kt
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from 5a876f8 to bb2f12f Compare August 31, 2026 17:53
@ben-kaufman
ben-kaufman changed the base branch from codex/paykit-payment-proofs-android to codex/paykit-hardware-payment-proofs-android August 31, 2026 17:54
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from bb2f12f to 050b32b Compare August 31, 2026 17:58
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

Done: the PR now uses the stack directly. #1186 is based on the hardware-proof fix #1199, which is based on #1178, so each review contains only its own layer.

ovitrif

This comment was marked as resolved.

@ben-kaufman
ben-kaufman requested a review from ovitrif August 31, 2026 23:02

@jvsena42 jvsena42 left a comment

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.

Duplicated component

Image

@ben-kaufman
ben-kaufman force-pushed the codex/paykit-hardware-payment-proofs-android branch from 82d6c73 to e1053b0 Compare September 1, 2026 12:48
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from 1cbcc6f to 4cfdf4e Compare September 1, 2026 12:48
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-hardware-payment-proofs-android branch from e1053b0 to 850c252 Compare September 1, 2026 12:54
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from 4cfdf4e to dd53772 Compare September 1, 2026 12:54
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

@jvsena42 Fixed in dd53772. The duplicated fiat value came from replacing the subscription review sheet while its content was still composed. The flow now reuses the existing dismiss-delay-present sheet transition and waits for that transition before validating the destination. The focused send-flow regression passes.

@ben-kaufman
ben-kaufman requested a review from jvsena42 September 1, 2026 13:03
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

The duplicated subscription payment UI is fixed in signed commit dd53772. The review sheet now completes its normal dismiss transition before the Send sheet is presented, and the focused send-flow regression covers the sequence. @jvsena42 please re-review the updated head when E2E finishes.

ovitrif
ovitrif previously requested changes Sep 1, 2026

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

prepareHardwareContactPayment marks the on-chain proof started before the hardware device signs, but onHardwareSignCancelled and send-sheet dismiss never call failOnchainPayment. The due request then stays in inFlightRequestIds and a later prepare() fails with OperationInProgress.

Also:

  • Several new Kotlin sites still use inline fully-qualified names where an import would do.
  • wallet__payment_request_timestamp is unused after paymentRequestDateTime was removed.

Comment thread app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt
Comment thread app/src/main/java/to/bitkit/ui/screens/subscriptions/SubscriptionsScreen.kt Outdated
Comment thread app/src/main/java/to/bitkit/ui/screens/subscriptions/SubscriptionsScreen.kt Outdated
Comment thread app/src/main/java/to/bitkit/repositories/PaykitPaymentRequestPresentationStore.kt Outdated
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-hardware-payment-proofs-android branch from 850c252 to bac8656 Compare September 1, 2026 18:06
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from dd53772 to 9bd7677 Compare September 1, 2026 18:06
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-hardware-payment-proofs-android branch from bac8656 to 6bb8501 Compare September 1, 2026 18:19
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-hardware-payment-proofs-android branch from d0bf6c2 to e84d74a Compare September 2, 2026 13:46
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from 3b32ae0 to e623010 Compare September 2, 2026 13:47
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-hardware-payment-proofs-android branch from e84d74a to 35c0b4c Compare September 2, 2026 13:56
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch 3 times, most recently from 3e5bab0 to bbce563 Compare September 2, 2026 14:15
ovitrif

This comment was marked as resolved.

ovitrif

This comment was marked as resolved.

@ben-kaufman
ben-kaufman requested a review from ovitrif September 2, 2026 14:58
@jvsena42 jvsena42 mentioned this pull request Sep 2, 2026
2 tasks
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions-android branch from 09f85e6 to 92b10eb Compare September 2, 2026 17:52
ovitrif
ovitrif previously approved these changes Sep 2, 2026

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

utACK

Base automatically changed from codex/paykit-hardware-payment-proofs-android to master September 3, 2026 12:58
@jvsena42
jvsena42 dismissed ovitrif’s stale review September 3, 2026 12:58

The base branch was changed.

@ben-kaufman
ben-kaufman requested a review from ovitrif September 3, 2026 18:22
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

Updated per the Figma clarification: the overview now shows a normalized Monthly Cost across all active subscriptions, independent of whether their current periods are paid. Daily, weekly, monthly, and yearly recurrences are annualized to a monthly value; each subscription is rounded to the nearest satoshi before safe aggregation. The obsolete calendar-month refresh was removed, and regression coverage includes recurrence normalization, paid active subscriptions, inactive exclusions, and low-value rounding.

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could not drive the six Manual Tests on this head. Two emulators onboarded with Paykit enabled and paired as contacts, but Bitkit has no create-subscription path, so SubscriptionsScreen stayed empty.

QA Notes

Pixel_8_Pro emulator-5554 and Pixel_10_Pro_XL emulator-5556 (dev/regtest). Onboarding, the Paykit toggle, the Subscriptions empty state, and mutual pubky pairing worked. Immediate-start, retry, confetti, future-start notification, bell-queue, and cancel were not exercised.

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