Skip to content

Instantly share code, notes, and snippets.

@mayorova
Created April 17, 2018 09:59
Show Gist options
  • Save mayorova/4061d83a646b1504a43e0f2745c8b796 to your computer and use it in GitHub Desktop.
Save mayorova/4061d83a646b1504a43e0f2745c8b796 to your computer and use it in GitHub Desktop.
3scale billing on application plan change

The behavior depends on several factors:

  • the mode of Billing: Prepaid or Postpaid
  • when the plan change is made

Prepaid billing

1. If the application plan is changed on the same day as is it was created, and so it has never been invoiced before, the fixed costs for the old plan are included to the invoice, and are discounted with a 'Refund' line item. The fixed costs for the old plan are also added to the invoice.

Example. A customer signed up for the Plan A (200$), and upgraded to the Plan B (300$) on the same day. One invoice will be generated in this case, and it will contain the following line items:

Description Cost
Fixed fee ('Plan A') 200
Refund ('Plan A') -200
Application upgrade ('Plan A' to 'Plan B') 300
Total 300

2. If application plan is changed after the invoice was already generated for this application:

  • In case of an upgrade, the developer will be issued two invoices: one for the initial charge, and another one for the upgrade.

Example. A customer signed up for the Plan A (200$) on the first day of the month, and then upgraded to the Plan B (300$) in the middle of the month. The following invoices will be generated:

Description Cost
Fixed fee ('Plan A') 200
Total 200
Description Cost
Refund ('Plan A') -100
Application upgrade ('Plan A' to 'Plan B') 150
Total 50

In the second invoice, the refunded cost (100$) and the new cost (150$) are prorated, as the upgrade is made in the middle of the billing period.

  • Refunding on application downgrade (change to a plan with a lower cost) is not supported at the moment.

Postpaid billing

In Postpaid billing mode a single invoice will be issued, and it will include the 'Refund' and 'Application upgrade' line items.

IMPORTANT:

This behavior was changed on January 17, 2017, the following changes were introduced:

  • A bug was fixed where the initial charge (for the initial application plan) was not included in the invoice when the application was upgraded on the same day as created.

  • Previously only one line item was added on application upgrade, including the difference between the cost of the new and the old plan. For example, in the scenario 2 described in Prepaid billing section above (application upgrades from Plan A – 200$, to Plan B – 300$), the second generated invoice would be:

Description Cost
Application upgrade ('Plan A' to 'Plan B') 50
Total 50

where 50$ is the difference between the prorated costs of the new and old plan for the rest of the month (150$ - 100$).

After January 17, 2017, the calculations are reflected more clearly in the invoice (including refund and charge separately), while the total cost remains the same as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment