Purchase Actions Reference

surecart/purchase_created

Occurs whenever a purchase is created. This typically happens when a customer successfully pays for an order at checkout. This event can be triggered for both manual payments and gateway payments.

do_action(
	'surecart/purchase_created',
	(\SureCart\Models\Purchase::class) $purchase,
	(array) $webhook_data
)

How to use

add_action( 'surecart/purchase_created', 'purchaseCreated' );
function purchaseCreated($purchase, $webhook_data = []) {
   //
}

surecart/purchase_revoked

Occurs whenever a purchase is revoked. This can happen if an order's line-item is refunded,
or a subscription is canceled or expired.

do_action(
	'surecart/purchase_revoked',
	(\SureCart\Models\Purchase::class) $purchase,
	(array) $webhook_data
)

surecart/purchase_invoked

Occurs whenever a purchase is invoked. (This is the opposite of revoked). This can only occur if the purchase has been previously revoked.

do_action(
	'surecart/purchase_invoked',
	(\SureCart\Models\Purchase::class) $purchase,
	(array) $webhook_data
)

surecart/purchase_updated

Occurs whenever a purchase is updated. This only occurs when a subscription's product or quantity changes.

do_action(
	'surecart/purchase_updated',
	(\SureCart\Models\Purchase::class) $purchase,
	(array) $webhook_data
)