Is anyone doing this? We're using the gift certificate info from the event return receipt. Now, box office wants it to show the balance as people start to use their gift certificates to purchase tickets. I would love to see any code people have that show the balance.
Thanks,Melissa
Hi Melissa,
I've added this into my order confirmations. You have to get to the Finance resource in the API, which I have done with this code in C# syntax:
var payUrl = "TXN/Payments?referenceId=" + Model.OrderProductView.Id; var getPayment = Model.RestClient.AtUrl(payUrl).Get<Payments>().ResponseObject;}foreach (var payment in getPayment) {if (payment.PaymentMethod.Description == "Gift Certificate") { paymentMethod = payment.PaymentMethod.Description + " #" + payment.GiftCertificate.Number; var gcUrl = "Finance/GiftCertificates/" + payment.GiftCertificate.Number; var getGC = Model.RestClient.AtUrl(gcUrl).Get<GiftCertificateInfo>().ResponseObject; gcBalance = getGC.Balance; }}
And then I display the gcBalance variable using HTML syntax. <br><text>(Remaining balance: @string.Format("{0:C}", @gcBalance))</text>
Hope that helps! Let me know if you have any questions!
-Sara