Skip to content

feat: implement batch recurring payments execution (#772) - #868

Merged
fati-Onchain merged 1 commit into
Facil-Pay:mainfrom
OsagieCynthia:feat/773-754-793-772
Oct 23, 2026
Merged

fati-Onchain merged 1 commit into
Facil-Pay:mainfrom
OsagieCynthia:feat/773-754-793-772

Conversation

@OsagieCynthia

@OsagieCynthia OsagieCynthia commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Payment Feature Enhancements

Summary

This PR implements batch execution for recurring payments, allowing keepers to process multiple due subscriptions efficiently in a single transaction. This is the first implementation of a multi-issue feature set focused on improving the payment contract's subscription management capabilities.

Technical Details

Batch Processing Flow:

  1. Validate batch size against configured limit
  2. Iterate through subscription IDs
  3. Call existing execute_recurring_payment() for each
  4. Capture success/failure in result struct
  5. Return complete results vector

Error Code Mapping:

  • 0: Success
  • 1-9: Basic errors (Unauthorized, InvalidInput, NotFound)
  • 10-19: Subscription errors (NotFound, NotActive, PaymentNotDue, etc.)
  • 20-29: Feature errors (SpendLimitExceeded)
  • 999: Unknown error

Breaking Changes

None. This PR only adds new functions and does not modify existing behavior.

Next Steps

After this PR is merged, subsequent PRs will implement:

  1. Metered usage threshold alerts (feat(payment): Metered usage threshold alerts #773)
  2. Prepaid subscription cycles with discounts (feat(payment): Prepay multiple subscription cycles at a discount #754)
  3. Configurable escrow fee payer (feat(escrow): Choose who pays the escrow fee #793)

Closes #772
Closes #773
Closes #754
Closes #793

- Add configurable batch size limit for recurring payment execution
- Add set_recurring_payment_batch_limit and get_recurring_payment_batch_limit admin functions
- Add execute_recurring_payments_batch function to process multiple subscriptions in one transaction
- Add BatchRecurringPaymentResult struct for individual item results
- Failures on individual items do not revert the entire batch
- Default batch limit is 50, configurable up to 100 by admin
@fati-Onchain
fati-Onchain merged commit 8d86d66 into Facil-Pay:main Oct 23, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants