I’m trying to collect e-gift card purchases in a cron job that will check if the customer purchased a enough for our companies bonus voucher, the cron job will create our own voucher and send it to the customer during our ‘promotion’.
The problem is that some customers email’s arent being given via the API. These customers seem to be
From squareup.com when I click on this customer the email is hidden from us, but if I click on the gift card that was created it does show the email the gift card was sent to. How would I access this email from the API? I’ve tried retrieving the customer, order, transaction, and gift card itself, but none of these have the email attached.
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
The email address you’re looking for is not directly accessible via the API. The INSTANT_PROFILE creation source indicates that the customer profile was automatically created by Square during a transaction. These profiles often have limited information and the email address is not exposed through the Customers API.
However, if the customer used their email address during a gift card purchase, that email should be associated with the gift card. Unfortunately, the Gift Cards API currently does not provide the ability to retrieve the email address associated with a gift card.
As a workaround, you might consider implementing a step in your purchase flow where you explicitly ask customers for their email address and then store it in your own system. This way, you can ensure you always have the customer’s email address for your records.