Skip to main content

benecaster_buyup_currency

Filter Premium

Filters the ISO 4217 currency code used when provisioning a buy-up price in Stripe. Defaults to usd.

This is read at provisioning time, so it affects prices created after the filter is in place. Stripe prices are immutable once created — changing this later does not re-denominate an existing buy-up, and existing subscribers keep the price they signed up on.

Parameters

Name Type Default Description
$currency string Lowercase ISO 4217 currency code. Default `usd`.
$buyup_id int Buy-up definition ID being provisioned.

Returns: string

Examples

Provision buy-ups in GBP

add_filter( 'benecaster_buyup_currency', function (): string {
    return 'gbp';
} );

Notes

Set this before creating buy-ups. Your Stripe account must support the currency, and it should match the currency used elsewhere on the show to avoid presenting subscribers with mixed denominations.

Always accept two arguments — add_filter( 'benecaster_buyup_currency', $cb, 10, 2 ). There are two call sites, and both pass $buyup_id: the Stripe provisioner, and the subscriber purchase endpoint, which reads the currency when building the 409 amount_mismatch error payload. A callback registered for one argument raises ArgumentCountError — a 500 on the price-changed path, which is exactly the moment the subscriber is already being told something went wrong.

Return lowercase; expect to see it uppercased in one place. Stripe requires lowercase, so that is what the filter deals in and what gets provisioned. The purchase endpoint uppercases the result for display only — a callback returning gbp provisions gbp in Stripe and surfaces as GBP in the API error payload. Both are correct; they are the same value formatted for different audiences.

Need this built rather than just documented? See our services →