question

kyle avatar image
kyle asked kyle commented

Event listener for listening to email receipt/ text receipt sent?

Hi

Wondering if there is any way I can get the customer's email/ phone number, with order id, when they send the receipt to themselves? So that, hopefully, I can send them a followup email as an attachment to the digital receipt.

Thanks of the help. Kyle

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Mark Mullan avatar image
Mark Mullan Deactivated answered kyle commented

Hi Kyle,

We don't fire a broadcast directly on email/text receipt. A workaround would be to register a BroadcastReceiver for com.clover.intent.action.PAYMENT_PROCESSED. One of the extras passed is the OrderID, which you can then use to fetch the Order:

Order o = orderConnector.getOrder(intent.getStringExtra(Intents.EXTRA_CLOVER_ORDER_ID));

You can then

o.getCustomers().get(0).getPhoneNumbers(); or o.getCustomers().get(0).getEmailAddresses();, checking for not null conditionals along the way.

You'll want to implement a sleep between when you receive the intent, and when you fetch the order. You'll receive that intent before the customer has had the option of entering their phone number/email for a receipt.

Hope this helps-

Mark

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kyle avatar image kyle commented ·

Thanks for the answer, I was trying to implement it but I found something weird...

when customers are paying with cash, `o.getCustomers()` returns null-- even if they texted or emailed their receipt. Does it means clover doesn't saved that information?

However, I noticed that when going back to the order tab on the clover machine and look at the order, I can retrieve that email/ phone number. Are there anything I am missing here?

0 Likes 0 ·

Welcome to the
Clover Developer Community