This filter allows you to adjust the cost of buying points using the buyCRED add-on. This filter is used both when calculating the cost when the request is made and when the payment gateway verifies the amount the user actually paid.

Available since version 1.4


Param Type Required Description
$cost int or float Yes

The cost of the purchase.

$amount int or float No

The amount of points being purchased.

$type string No

The point type key being purchased.

$gateway_prefs array No

The selected payment gateways settings.

$buycred_prefs array No

The buyCRED add-ons settings.

Remember that most payment gateways require the cost to be formatted using two decimal places.

Used By

Package Prio. Description
mycred/purchase 10 Used by the selected payment gateway to calculate the cost.


Example 1: Adjust the price of buying points based on the amount of points a user selects to buy.

Example 2: Apply a 10% discount on point purchases no matter how many points a user buys.

Example 3: Apply a 10% discount on purchases of a custom point type, no matter how many points the user selects to buy.