The savings object cannot exist by itself: rather, it is attached to a baseline periodicity.
Savings objects are usually inferred from an underlying Plan .
Savings of type fixed-discount
are used to always reduce the base periodicity's cents by the defined amount
. E.g., if you wanted to let someone save $5 for the next 3 billing cycles, you would create a Savings where type=fixed-discount
, amount=500
, and cycles=3
.
Savings of type fixed-price
are used to directly overwrite the base periodicity's cents. E.g., if you wanted to let someone pay $0.99 for the next 3 billing cycles, you would create a Savings where type=fixed-price
, amount=99
, and cycles=3
.
Savings of type percent
are used to reduce the base periodicity's cents by the percentage defined by the amount. E.g., if you wanted to let someone save 25% for the next 3 billing cycles, you would create a Savings where type=percent
, amount=25
, and cycles=3
.
It is impossible to charge a negative amount. If a savings is attached with a fixed-discount
of 500, but the baseline periodicity only charges 399, the billing cycle will simply be skipped (effectively, the Account will be charged 0 cents).
Attributes:
Name | Type | Description |
---|---|---|
type | string | One of fixed-discount , percent , or fixed-price . |
amount | integer | If this is a fixed-discount this is the number of cents to discount from the regular recurring price.if this is a fixed-price , this is the number of cents to charge for each period.If this is a percent , it is the percentage (as an integer) to discount (e.g., "Save 25%" would be encoded as a percent with an amount of 25). |
cycles | integer | How many billing cycles to apply the defined savings. A value of 0 will create a never-ending discount. |