Support

Home Forums Event Espresso Premium Bug? Promotion code that covers all cost does not send Payment Received message

Bug? Promotion code that covers all cost does not send Payment Received message

Posted: December 27, 2019 at 10:42 am

Viewing 6 reply threads


Daniel

December 27, 2019 at 10:42 am

I had a customer who applied a $50 cash promotion code to a $49 event.

I reviewed all related messages and only the Registration Approved email was sent – they did not receive a Payment Received message.

Is this a bug or an intended behavior?

Thanks!


Tony

  • Support Staff

December 28, 2019 at 2:04 pm

Hi Daniel,

That’s expected behaviour as promotions applied to transactions are not the same as a ‘payment’.

The ‘Payment Received’ message type will only be trigger when a payment method generates a payment object within the transaction.


Daniel

December 28, 2019 at 2:44 pm

Hi Tony!
Thanks for the clarification.

I see I am in disagreement with the way EE handles Promotions – in the Checkout (in a previous ticket) and (here) in the Fulfillment.

A promotion code *is* a payment in our system – we do not send the price paid in the Registration Approved message. We send the Payment Received message to confirm the amount.

In our system the promotion code is used for issuing credits and gift certificates. So, it would be nice to be able to send a “receipt” in the form of an automated “payment received” message.

The distinction between CC payment and Promotion payment seems artificial to me. Both are forms of tokenized payment – one token goes to the CC company and eventually gets paid, and the other goes to the “balance” of the promotion code and gets paid immediately. The registration is approved and *something* got them past the checkout – the “Payment Received” message seems like where the notation of what got them past the checkout should be.

Can you point me to anywhere that I can modify this behavior?

Regards,
D


Tony

  • Support Staff

December 28, 2019 at 5:28 pm

A promotion code *is* a payment in our system – we do not send the price paid in the Registration Approved message. We send the Payment Received message to confirm the amount.

Unfortunately, the fact that you are using the promotion system to apply ‘payments’ does not mean that is how it is/was designed to be used. Applying a promotion within EE does not create a payment within the transaction, it adds line items to the transaction and that’s important for later on…

In our system the promotion code is used for issuing credits and gift certificates. So, it would be nice to be able to send a “receipt” in the form of an automated “payment received” message.

The promotion system as it is now and how it was designed, was not intended to be a ‘Gift certificate system’, it does not track as payments and it does not track gift certificate value usage (for example a $100 promotion applied to a $30 ticket does not leave $70 remaining, it just counts as a use). Can it be used as a simple gift certificate system, sure, but it’s not going to give you all the functionality that one would expect with that type of system.

The distinction between CC payment and Promotion payment seems artificial to me. Both are forms of tokenized payment – one token goes to the CC company and eventually gets paid, and the other goes to the “balance” of the promotion code and gets paid immediately.

Ok, so let’s go with an example for the type of use case the promotions system was designed for. I want to run a promotion and give the first 10 people that sign up to my event a 25% discount.

I create a 25% discount code with a use limit of 10 and set it to apply to “Tony’s Event” which has a ticket value of $100.

The first 10 people use that promotion code and their 25% discount.
Did they make a payment to receive such a discount? No.
Is there some form of tokenized payment applied here? No.
Any kind of ‘payment’ in relation to the promotion applied? No.

The same logic can be applied even to a 100% (or $ value greater than the ticket value) discount. The promotions system is not and was not designed to be a payment system, it’s a promotion system which applies promotions of whatever value to the checkout.

The remaining balance of the above example can and very likely will create a payment object to apply to the transaction for that value, that is a payment and will trigger the notifications, the promotion will not as the promotions system was not designed to be a gift certificate system, nor a ‘payment’ system.

Can a promotion greater than the value of the checkout and be applied? Sure it can, but again, that’s a ‘use’ not a ‘value’ or payment in EE. I mentioned in your other thread with regards to 100% promotions that the checkout completes because no payment can not be applied, because one isn’t needed and the same applies here, there is no payment applied to the transaction, a promotion was.

A gift certificate system is an entirely different system to the promotion system and for the functionality, you are looking for there is a lot more to it than simply triggering an email. Even in its simplest form a gift certificate system ould need to track payments, be that the initial payment to create the certificate, or (if applied in such a manner) the ‘payment’ on the checkout and that isn’t wat the promotion system was designed for.

The registration is approved and *something* got them past the checkout – the “Payment Received” message seems like where the notation of what got them past the checkout should be.

The promotion they applied got them past the checkout, not a payment. You using the promotion system as a payment system, unfortunately, doesn’t change this and no payment object is created within EE. I mention that again because it leads onto this:

Can you point me to anywhere that I can modify this behavior?

I can’t because there is no payment, to explain a little.

The message system has a related object each message type is based on.

Registration related messages are based around an EE_Registration object.
Payment related messages are based around EE_Payments.

Messages can (and do) have access to related objects but their core object is required and there’s no getting around that. So could I find a place in the code that applies the promotion that you could hook into and attempt to trigger a notification, likely yes.

However, as there isn’t a payment object related to the transaction what is the payment related message supposed to use to generate the content? The next suggestion would likely be to create a payment object related to the promotion, now you’re getting into ticky/hacky workarounds as you have promotions applied as line items AND a payment object which isn’t going to end well.


Daniel

December 29, 2019 at 8:02 am

Hi Tony!

Thanks for the explanation. It helps to understand the original design goals of the promotions system! I see that the promotions were created to “reduce the price” and in that sense the promotions system is perfectly fit-for-use.

I still see it a different way; IMO, promotions (in the general sense) should always be handled as “payments” not just line item price reductions.

The key insight for me came a few years back when I designed the coupon system for a custom ecommerce system. Promotions / coupons / discounts and the like in an commerce system with an accounting functionality are actually liabilities against an account.

So, in an accounting sense when you create a promotion, you are creating a debt. The only way to balance a debt is to pay it off by “moving” money or reconciling in some way (promotions expire, etc…). Generalizing like this covers the promotions “reduce the price” use case and the gift certificate use case.

With regards to EE messaging … your helpful write up provides some key insight for me around the EE messaging system – especially with regards to how the messages are related to the various objects in the EE system.

The system I just launched is going to be growing a lot this year – I think I’ll be designing and building a Gift Certificate plugin – so, I’ll need to know all of it – including how to use the EE messaging system to generate PDF Gift Certificates and tap into the Payment system to track the creation and redemption as debits and credits against an “account.”

Is there a simple example plugin that I can begin learning with as I begin to build my own?

Thank you!
D


Tony

  • Support Staff

December 30, 2019 at 8:59 am

So, in an accounting sense when you create a promotion, you are creating a debt. The only way to balance a debt is to pay it off by “moving” money or reconciling in some way (promotions expire, etc…). Generalizing like this covers the promotions “reduce the price” use case and the gift certificate use case.

Whilst I’m certainly no expert, we’ve previously had pushback when suggesting people create “payments that aren’t payments” to provide discounts within the admin.

Either way, I’ll pass this feedback along for discussion 🙂

Is there a simple example plugin that I can begin learning with as I begin to build my own?

Your own EE add-on? Sure, we have a skeleton add-on within EE and some docs here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/D–Addon-API

That has references to and add-on and message types although if you are looking for examples of using the message system to create your own PDF’s etc I’d recommend looking at the Printable Tickets Add-on as it does the same.


Daniel

December 31, 2019 at 2:43 pm

This is great! I had no idea there was an entire developer documentation and sample code. Very nice work.

Viewing 6 reply threads

The support post ‘Bug? Promotion code that covers all cost does not send Payment Received message’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso