Broadleaf Microservices
  • v1.0.0-latest-prod

Common Customizations

This page describes common customizations that can be implemented in the Billing service.

Custom Billing Frequency

Setting up a custom billing frequency takes a few simple steps:

  1. Set up an Enum value to correspond to the desired frequency.

    • Default framework values can be found at DefaultSubscriptionBillingFrequencyEnum

  2. Add a custom processor extending AbstractSubscriptionNextBillDateProcessor

    • This customized handler only requires overriding two simple methods to start billing at your desired cadence!

Custom Retry Schedule

This section walks through various ways to create a custom RetrySchedule.

A default retry schedule can be set for all payments and/or refunds. A unique feature of this route is that a BillingRetrySchedule can be set up via configuration properties.

This route requires at minimum that the user provide values for the following:

  • the retry schedule’s id

  • a boolean for allowing to try other accounts from the user’s wallet for billing

  • a maximum retry attempt count

  • a list of IntervalBillingRetrySpecs defining how many days to wait for each consecutive retry attempt.

Note
Property names should match the BillingRetrySchedule fields to be a valid object.

While the regular persistence route via an endpoint is not available, the BillingRetrySchedule object is simple enough to be defined by liquibase. It can then be referenced using its id (i.e. code) in BillingEventPayments and RefundEventDetails.

Note
If you’re not familiar with retry schedules, see Retry Schedules. If you simply want to learn more about their usage, see Retries.

Adding a payment gateway

Aside from steps necessary to add a new payment gateway to PaymentTransactionServices, BillingServices can be configured to interact with the gateway in a distinct way.

For both of these properties, the payment gateway name should be inserted instead of [payment gateway name]: The payment gateway name should be in capital letters, such as `STRIPE for a Stripe gateway. This is matched with how the PaymentTransactionServices provides the gateway name.

  • billing.job.payment-gateway-config.[payment gateway name].should-call-processor-if-transaction-not-found

  • billing.job.payment-gateway-config.[payment gateway name].alternative-gateway-type-values

Learn more about these properties in Billing Configuration.

Adding a tax processor

All steps to configure and add a tax processor lie outside the Billing service. The Tax Common documentation provides a great walkthrough/

To prioritize a specific tax processor, customize DefaultDelegatingTaxService#determinePreferredProviderId.