Skip to main content

benecaster_buyup_definition_created

Action Premium Since v1.0.0

Fires after a buy-up definition is created and persisted, immediately before the REST endpoint returns. The full stored record is passed, so no follow-up read is needed.

Buy-ups are one-off paid upgrades a subscriber can purchase on top of their tier. Use this action to mirror new definitions into an external catalog, or to trigger provisioning that Benecaster does not perform itself.

Parameters

Name Type Default Description
$buyup_id int ID of the newly created buy-up definition.
$buyup array The stored buy-up record as returned by the repository.

Examples

Mirror new buy-ups into an external catalog

add_action( 'benecaster_buyup_definition_created', function ( int $buyup_id, array $buyup ): void {
    my_catalogue_upsert( $buyup_id, $buyup );
}, 10, 2 );

Notes

Stripe price provisioning happens separately. Do not assume a Stripe price ID is present on $buyup at the moment this fires.