Sending Purchase event with test prices

Add JS Code block with this content

AnalyticsManager.on('Stripe submit error', function(e) {
	if (
		e.decline_code === "test_mode_live_card" ||
		e.code === "test_mode_live_card" ||
		(e.message || '').indexOf('stripe.com/docs/testing') > -1
	){
		let price = getActivePriceInfo();

		AnalyticsManager.logEvent('Purchase', { value: price.amount_real });

		setTimeout(function(){
			window.location.pathname = '/after-pay-meta';
		}, 500);
	}
});

AnalyticsManager.on('Stripe create subscription error', function(e) {
	debugger;

	if (
		e.decline_code === "test_mode_live_card" ||
		e.code === "test_mode_live_card" ||
		(e.message || '').indexOf('stripe.com/docs/testing') > -1
	){
		let price = getActivePriceInfo();

		AnalyticsManager.logEvent('Purchase', { value: price.amount_real });

		setTimeout(function(){
			window.location.pathname = '/after-pay-meta';
		}, 500);
	}
});