Skip to content

feat: add subscription proration and the preview endpoint - #13

Merged
jimmyn merged 3 commits into
masterfrom
feat/subscription-proration
Sep 21, 2026
Merged

jimmyn merged 3 commits into
masterfrom
feat/subscription-proration

Conversation

@jimmyn

@jimmyn jimmyn commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Regenerated from OpenAPI v1.12.1.

  • prorate and next_payment_at on UpdateSubscriptionRequest
  • last_proration and last_proration_at on Subscription
  • subscriptions.preview(id, PreviewSubscriptionUpdateRequest), with a test at the HTTP layer (method, path, camelCase body). The existing subscription tests patch the API method itself, so they would not catch a wrong path.
  • README refund example: optional bodies are keyword arguments, and refund_reason needs PaymentRefundReason(...) with an enum value. It raised TypeError before.

Summary by CodeRabbit

  • New Features
    • Added subscription update previews, including estimated charges, refunds, net adjustments, effective dates, and payment-period details.
    • Added support for previewing subscription changes such as billing interval, amount, proration, and next payment date.
    • Added proration and payment scheduling fields to subscription updates and subscription details.
  • Documentation
    • Updated API examples for processing refunds and reporting payment status.
    • Updated the documented API specification to version 1.12.1.
  • Tests
    • Added coverage for subscription preview requests, serialization, and proration results.

Regenerated from OpenAPI v1.12.1: prorate and next_payment_at on update,
last_proration and last_proration_at on Subscription, and
subscriptions.preview().
Optional request bodies are keyword arguments, and refund_reason needs
the PaymentRefundReason model with an enum value.
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

Warning

Review limit reached

  • Run on-demand review

This review includes 119 billable files and costs up to $29.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 15 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 5 included reviews currently available. Your 18 included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: d22bf481-1db9-4ff4-aff1-8a9fa3d6ff20

📥 Commits

Reviewing files that changed from the base of the PR and between bf7b2d6 and 8045e35.

📒 Files selected for processing (119)
  • Monei/__init__.py
  • Monei/api/apple_pay_certificate_api.py
  • Monei/api/apple_pay_domain_api.py
  • Monei/api/bizum_api.py
  • Monei/api/payment_methods_api.py
  • Monei/api/payments_api.py
  • Monei/api/pos_auth_token_api.py
  • Monei/api/subscriptions_api.py
  • Monei/api_client.py
  • Monei/configuration.py
  • Monei/exceptions.py
  • Monei/model/activate_apple_pay_certificate_request.py
  • Monei/model/activate_subscription_request.py
  • Monei/model/address.py
  • Monei/model/api_exception.py
  • Monei/model/apple_pay_certificate.py
  • Monei/model/apple_pay_certificates_remove200_response.py
  • Monei/model/bad_request_error.py
  • Monei/model/bad_request_error_all_of.py
  • Monei/model/bizum_validate_phone200_response.py
  • Monei/model/cancel_payment_request.py
  • Monei/model/cancel_subscription_request.py
  • Monei/model/capture_payment_request.py
  • Monei/model/confirm_payment_request.py
  • Monei/model/confirm_payment_request_payment_method.py
  • Monei/model/confirm_payment_request_payment_method_card.py
  • Monei/model/create_payment_request.py
  • Monei/model/create_pos_auth_token_request.py
  • Monei/model/create_subscription_request.py
  • Monei/model/internal_server_error.py
  • Monei/model/internal_server_error_all_of.py
  • Monei/model/not_found_error.py
  • Monei/model/not_found_error_all_of.py
  • Monei/model/pause_subscription_request.py
  • Monei/model/payment.py
  • Monei/model/payment_billing_details.py
  • Monei/model/payment_cancellation_reason.py
  • Monei/model/payment_customer.py
  • Monei/model/payment_last_refund_reason.py
  • Monei/model/payment_message_channel.py
  • Monei/model/payment_message_language.py
  • Monei/model/payment_methods.py
  • Monei/model/payment_methods_metadata.py
  • Monei/model/payment_methods_metadata_alipay.py
  • Monei/model/payment_methods_metadata_apple_pay.py
  • Monei/model/payment_methods_metadata_bancontact.py
  • Monei/model/payment_methods_metadata_bizum.py
  • Monei/model/payment_methods_metadata_blik.py
  • Monei/model/payment_methods_metadata_card.py
  • Monei/model/payment_methods_metadata_click_to_pay.py
  • Monei/model/payment_methods_metadata_click_to_pay_discover.py
  • Monei/model/payment_methods_metadata_click_to_pay_mastercard.py
  • Monei/model/payment_methods_metadata_click_to_pay_visa.py
  • Monei/model/payment_methods_metadata_eps.py
  • Monei/model/payment_methods_metadata_giropay.py
  • Monei/model/payment_methods_metadata_google_pay.py
  • Monei/model/payment_methods_metadata_i_deal.py
  • Monei/model/payment_methods_metadata_klarna.py
  • Monei/model/payment_methods_metadata_mbway.py
  • Monei/model/payment_methods_metadata_sepa.py
  • Monei/model/payment_methods_metadata_sofort.py
  • Monei/model/payment_methods_metadata_trustly.py
  • Monei/model/payment_methods_methods.py
  • Monei/model/payment_next_action.py
  • Monei/model/payment_payment_method.py
  • Monei/model/payment_payment_method_bizum.py
  • Monei/model/payment_payment_method_bizum_input.py
  • Monei/model/payment_payment_method_card.py
  • Monei/model/payment_payment_method_card_input.py
  • Monei/model/payment_payment_method_input.py
  • Monei/model/payment_payment_method_klarna.py
  • Monei/model/payment_payment_method_mbway.py
  • Monei/model/payment_payment_method_paypal.py
  • Monei/model/payment_payment_method_sepa.py
  • Monei/model/payment_payment_method_trustly.py
  • Monei/model/payment_payment_methods.py
  • Monei/model/payment_refund_reason.py
  • Monei/model/payment_sequence.py
  • Monei/model/payment_sequence_recurring.py
  • Monei/model/payment_session_details.py
  • Monei/model/payment_shipping_details.py
  • Monei/model/payment_shop.py
  • Monei/model/payment_status.py
  • Monei/model/payment_trace_details.py
  • Monei/model/payment_transaction_type.py
  • Monei/model/pos_auth_token_create200_response.py
  • Monei/model/preview_subscription_update_request.py
  • Monei/model/recurring_payment_request.py
  • Monei/model/refund_payment_request.py
  • Monei/model/register_apple_pay_domain_request.py
  • Monei/model/send_payment_link_request.py
  • Monei/model/send_payment_receipt_request.py
  • Monei/model/send_payment_request_request.py
  • Monei/model/send_subscription_link_request.py
  • Monei/model/send_subscription_status_request.py
  • Monei/model/service_unavailable_error.py
  • Monei/model/service_unavailable_error_all_of.py
  • Monei/model/subscription.py
  • Monei/model/subscription_interval.py
  • Monei/model/subscription_last_payment.py
  • Monei/model/subscription_last_proration.py
  • Monei/model/subscription_payment_method.py
  • Monei/model/subscription_payment_method_card.py
  • Monei/model/subscription_payment_methods.py
  • Monei/model/subscription_retry_schedule.py
  • Monei/model/subscription_retry_schedule_inner.py
  • Monei/model/subscription_status.py
  • Monei/model/subscription_trial_amount.py
  • Monei/model/subscription_trial_interval_count.py
  • Monei/model/subscription_update_preview.py
  • Monei/model/unauthorized_error.py
  • Monei/model/unauthorized_error_all_of.py
  • Monei/model/unprocessable_entity_error.py
  • Monei/model/unprocessable_entity_error_all_of.py
  • Monei/model/update_apple_pay_certificate_request.py
  • Monei/model/update_subscription_request.py
  • Monei/model/validate_bizum_phone_request.py
  • Monei/model_utils.py
  • Monei/rest.py

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: d03235a2-e825-460e-b5f6-0f5d4401088d

📥 Commits

Reviewing files that changed from the base of the PR and between 6020613 and bf7b2d6.

📒 Files selected for processing (126)
  • .openapi-generator/FILES
  • Monei/__init__.py
  • Monei/api/apple_pay_certificate_api.py
  • Monei/api/apple_pay_domain_api.py
  • Monei/api/bizum_api.py
  • Monei/api/payment_methods_api.py
  • Monei/api/payments_api.py
  • Monei/api/pos_auth_token_api.py
  • Monei/api/subscriptions_api.py
  • Monei/api_client.py
  • Monei/configuration.py
  • Monei/exceptions.py
  • Monei/model/activate_apple_pay_certificate_request.py
  • Monei/model/activate_subscription_request.py
  • Monei/model/address.py
  • Monei/model/api_exception.py
  • Monei/model/apple_pay_certificate.py
  • Monei/model/apple_pay_certificates_remove200_response.py
  • Monei/model/bad_request_error.py
  • Monei/model/bad_request_error_all_of.py
  • Monei/model/bizum_validate_phone200_response.py
  • Monei/model/cancel_payment_request.py
  • Monei/model/cancel_subscription_request.py
  • Monei/model/capture_payment_request.py
  • Monei/model/confirm_payment_request.py
  • Monei/model/confirm_payment_request_payment_method.py
  • Monei/model/confirm_payment_request_payment_method_card.py
  • Monei/model/create_payment_request.py
  • Monei/model/create_pos_auth_token_request.py
  • Monei/model/create_subscription_request.py
  • Monei/model/internal_server_error.py
  • Monei/model/internal_server_error_all_of.py
  • Monei/model/not_found_error.py
  • Monei/model/not_found_error_all_of.py
  • Monei/model/pause_subscription_request.py
  • Monei/model/payment.py
  • Monei/model/payment_billing_details.py
  • Monei/model/payment_cancellation_reason.py
  • Monei/model/payment_customer.py
  • Monei/model/payment_last_refund_reason.py
  • Monei/model/payment_message_channel.py
  • Monei/model/payment_message_language.py
  • Monei/model/payment_methods.py
  • Monei/model/payment_methods_metadata.py
  • Monei/model/payment_methods_metadata_alipay.py
  • Monei/model/payment_methods_metadata_apple_pay.py
  • Monei/model/payment_methods_metadata_bancontact.py
  • Monei/model/payment_methods_metadata_bizum.py
  • Monei/model/payment_methods_metadata_blik.py
  • Monei/model/payment_methods_metadata_card.py
  • Monei/model/payment_methods_metadata_click_to_pay.py
  • Monei/model/payment_methods_metadata_click_to_pay_discover.py
  • Monei/model/payment_methods_metadata_click_to_pay_mastercard.py
  • Monei/model/payment_methods_metadata_click_to_pay_visa.py
  • Monei/model/payment_methods_metadata_eps.py
  • Monei/model/payment_methods_metadata_giropay.py
  • Monei/model/payment_methods_metadata_google_pay.py
  • Monei/model/payment_methods_metadata_i_deal.py
  • Monei/model/payment_methods_metadata_klarna.py
  • Monei/model/payment_methods_metadata_mbway.py
  • Monei/model/payment_methods_metadata_sepa.py
  • Monei/model/payment_methods_metadata_sofort.py
  • Monei/model/payment_methods_metadata_trustly.py
  • Monei/model/payment_methods_methods.py
  • Monei/model/payment_next_action.py
  • Monei/model/payment_payment_method.py
  • Monei/model/payment_payment_method_bizum.py
  • Monei/model/payment_payment_method_bizum_input.py
  • Monei/model/payment_payment_method_card.py
  • Monei/model/payment_payment_method_card_input.py
  • Monei/model/payment_payment_method_input.py
  • Monei/model/payment_payment_method_klarna.py
  • Monei/model/payment_payment_method_mbway.py
  • Monei/model/payment_payment_method_paypal.py
  • Monei/model/payment_payment_method_sepa.py
  • Monei/model/payment_payment_method_trustly.py
  • Monei/model/payment_payment_methods.py
  • Monei/model/payment_refund_reason.py
  • Monei/model/payment_sequence.py
  • Monei/model/payment_sequence_recurring.py
  • Monei/model/payment_session_details.py
  • Monei/model/payment_shipping_details.py
  • Monei/model/payment_shop.py
  • Monei/model/payment_status.py
  • Monei/model/payment_trace_details.py
  • Monei/model/payment_transaction_type.py
  • Monei/model/pos_auth_token_create200_response.py
  • Monei/model/preview_subscription_update_request.py
  • Monei/model/recurring_payment_request.py
  • Monei/model/refund_payment_request.py
  • Monei/model/register_apple_pay_domain_request.py
  • Monei/model/send_payment_link_request.py
  • Monei/model/send_payment_receipt_request.py
  • Monei/model/send_payment_request_request.py
  • Monei/model/send_subscription_link_request.py
  • Monei/model/send_subscription_status_request.py
  • Monei/model/service_unavailable_error.py
  • Monei/model/service_unavailable_error_all_of.py
  • Monei/model/subscription.py
  • Monei/model/subscription_interval.py
  • Monei/model/subscription_last_payment.py
  • Monei/model/subscription_last_proration.py
  • Monei/model/subscription_payment_method.py
  • Monei/model/subscription_payment_method_card.py
  • Monei/model/subscription_payment_methods.py
  • Monei/model/subscription_retry_schedule.py
  • Monei/model/subscription_retry_schedule_inner.py
  • Monei/model/subscription_status.py
  • Monei/model/subscription_trial_amount.py
  • Monei/model/subscription_trial_interval_count.py
  • Monei/model/subscription_update_preview.py
  • Monei/model/unauthorized_error.py
  • Monei/model/unauthorized_error_all_of.py
  • Monei/model/unprocessable_entity_error.py
  • Monei/model/unprocessable_entity_error_all_of.py
  • Monei/model/update_apple_pay_certificate_request.py
  • Monei/model/update_subscription_request.py
  • Monei/model/validate_bizum_phone_request.py
  • Monei/model_utils.py
  • Monei/models/__init__.py
  • Monei/rest.py
  • README.md
  • test/test_preview_subscription_update_request.py
  • test/test_subscription_last_proration.py
  • test/test_subscription_update_preview.py
  • test/test_subscriptions_preview.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • MONEI/common (manual)

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The SDK updates generated OpenAPI metadata to version 1.12.1 and adds subscription preview models, endpoint support, proration fields, exports, manifests, and tests. It also updates payment expiration documentation and the refund example.

Changes

Subscription preview and proration

Layer / File(s) Summary
Preview models and proration data
Monei/model/preview_subscription_update_request.py, Monei/model/subscription_update_preview.py, Monei/model/subscription_last_proration.py, Monei/model/subscription.py, Monei/models/__init__.py
Adds generated preview and proration models. Adds last_proration_at and last_proration to Subscription.
Preview endpoint and validation
Monei/api/subscriptions_api.py, test/test_subscriptions_preview.py, test/test_*subscription*.py
Adds POST /subscriptions/{id}/preview, the public preview method, model exports, manifests, and preview request/response tests.
Subscription update fields
Monei/model/update_subscription_request.py, Monei/model/subscription.py
Adds prorate and next_payment_at fields and documents subscription scheduling and proration rules.

Generated package metadata

Layer / File(s) Summary
OpenAPI version metadata
Monei/**/*.py, .openapi-generator/FILES, Monei/rest.py
Updates generated OpenAPI metadata from 1.9.0 to 1.12.1 across the package.
Generated documentation examples
Monei/model/create_payment_request.py, README.md
Expands payment expiration documentation and updates the refund example to use PaymentRefundReason and report payment status.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

Documents the remaining prorate rejections: Bizum, prorate with nothing to
settle, an interval change over a pending cancel/pause/skip, and a refund on
an account with refunds disabled.
@jimmyn
jimmyn merged commit 0c65292 into master Sep 21, 2026
9 checks passed
@jimmyn
jimmyn deleted the feat/subscription-proration branch September 21, 2026 15:03
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