Skip to content

feat: add Paykit subscriptions - #685

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

feat: add Paykit subscriptions#685
ben-kaufman wants to merge 13 commits into
masterfrom
codex/paykit-subscriptions

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 #683.

  • 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:

Linked Issues/Tasks

Screenshot / Video

Final iOS 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 failed and uncertain initial payments and verify retry stays in the same sheet while the first period remains due.
  • Complete Lightning and on-chain subscription payments and verify purple/orange success 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

  • 99 focused PaykitPaymentRequestServiceTests and PaykitPaymentProofServiceTests
  • E2E regtest Debug build for an arm64 iOS simulator
  • Exact build installed and cold-launched on an iOS simulator
  • SwiftFormat validation for all 13 changed Swift files
  • Localization validation
  • git diff --check

@greptile-apps

This comment has been minimized.

Comment thread Bitkit/Services/PaykitPaymentProofService.swift
Comment thread Bitkit/Services/PaykitPaymentProofService.swift
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-payment-proofs branch from fee8601 to 01c4164 Compare August 28, 2026 14:13
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions branch from a8d71d0 to 059eb83 Compare August 31, 2026 13:10
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-payment-proofs branch from 01c4164 to bcf1d8a Compare August 31, 2026 14:25
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions branch from 059eb83 to 69a0746 Compare August 31, 2026 14:25
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions branch from 69a0746 to 3a1bcd2 Compare August 31, 2026 18:22
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

Restacked on the updated payment-proof branch at c3f2d8c. The subscription layer is unchanged; all commits remain signed, and the complete payment-proof suite (including recurring periods and uncertain on-chain recovery) passes 22/22.

@ben-kaufman
ben-kaufman force-pushed the codex/paykit-payment-proofs branch from c3f2d8c to 281b865 Compare August 31, 2026 18:30
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions branch from 3a1bcd2 to cf4cea2 Compare August 31, 2026 18:30
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

Restacked again on the final signed payment-proof hardening head 281b8654; current signed subscriptions head is cf4cea28. Focused PaykitPaymentProofServiceTests: 21/21 passing.

@ben-kaufman ben-kaufman mentioned this pull request Aug 31, 2026
2 tasks
ovitrif

This comment was marked as resolved.

@ben-kaufman
ben-kaufman requested a review from ovitrif September 1, 2026 03:20
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-payment-proofs branch from 281b865 to e66771b Compare September 1, 2026 12:44
@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions branch 3 times, most recently from d68a602 to c274b0a Compare September 1, 2026 16:38
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

The subscriptions branch is now correctly restacked on the current signed #683 head (6bcff553); the subscription-only head is c274b0a4, and every commit is verified. After restacking, PaykitPaymentProofServiceTests, PaykitPaymentRequestServiceTests, and PaymentNavigationHelperTests pass 112/112. The earlier details-flow and payment-sheet sequencing fixes remain present. @ovitrif @jvsena42 please re-review the current head; fresh CI is still running.

ovitrif

This comment was marked as resolved.

@ben-kaufman
ben-kaufman force-pushed the codex/paykit-subscriptions branch from c274b0a to e641682 Compare September 1, 2026 17:18
@ben-kaufman

Copy link
Copy Markdown
Contributor Author

Restacked onto #683 signed head 489b1e61; the new subscriptions head is e6416820. The one conflict was in the shared secondary button and was resolved by keeping the subscriptions/Figma-correct shared height plus #683’s shouldExpand behavior. All five subscriptions commits were re-signed.

Post-restack simulator verification passes 134/134 across HwFundingSignerTests, PaykitPaymentProofServiceTests, PaykitPaymentRequestServiceTests, and PaymentNavigationHelperTests.

@ben-kaufman
ben-kaufman requested a review from ovitrif September 1, 2026 17:18
ovitrif

This comment was marked as resolved.

@ben-kaufman
ben-kaufman requested a review from ovitrif September 1, 2026 18:45
ovitrif
ovitrif previously approved these 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.

utACK

Base automatically changed from codex/paykit-payment-proofs to master September 2, 2026 10:57
@jvsena42
jvsena42 dismissed ovitrif’s stale review September 2, 2026 10:57

The base branch was changed.

ovitrif

This comment was marked as resolved.

@ben-kaufman

Copy link
Copy Markdown
Contributor Author

Follow-up pushed in db1aeae: definitive hardware broadcast failures now clear a started proof with failOnchainPayment before cancelling any unstarted preparation. This prevents a failed hardware broadcast from leaving an orphaned started proof, while uncertain broadcasts remain persisted for reconciliation. Focused PaykitPaymentProofServiceTests pass 23/23, and SwiftFormat plus diff validation are clean.

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

@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.

PaykitPaymentRequestManager.acceptedAt(for:) is unused after Monthly Cost stopped reading calendar-month due counts.

Comment thread Bitkit/Services/PaykitPaymentRequestService.swift Outdated
@ovitrif
ovitrif dismissed their stale review September 3, 2026 21:38

The hardware before-broadcast path now marks the on-chain proof started.

@ben-kaufman
ben-kaufman requested a review from ovitrif September 3, 2026 22:14
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