Giftcard API error on Charging

We are trying to integrate GiftCard API. All is working well but when try to charge GiftCard using API return error
"CALL TO A MEMBER FUNCTINO getValue() or null".
i have attached the screen short of my php script and response of API call
7 comments
Hi @umairakram500 ,
What you can do best is take a look here: https://developers.lightspeedhq.com/retail/tutorials/gift-cards/ and if you follow the steps from: https://developers.lightspeedhq.com/retail/endpoints/CreditAccount/ this will work.
Let me know if this worked for you.
Kind Regards,
Lucien Versendaal
I have followed every single step but I am still getting this error
@umairakram500,
Once a gift card has been topped up with a value you can only charge/use gift cards via a Sale
Adrian Samuel
Software Developer
Lightspeed HQ
Hi Adrian,
If I understand well, we are not talking about using the gift cards. The issue occurs when trying to top up the gift card for the first time. According to the code this is done via a Sale transaction with paymentTypeId 1 and paymentTypeId 5.
So why are we getting this error message here?
@Adrian Samuel
The Problem is that I am unable to top up my gift card through API
We are following every step carefully but still get that error response from the server that I have sent you previously
https://developers.lightspeedhq.com/retail/tutorials/gift-cards/
Hey @umairakram500 @jonasverhulst,
This payload works, try this using a API client such as Postman:
{
"employeeID": EMPLOYEE_ID,
"registerID": REGISTER_ID, // ensure register matches shop
"shopID": SHOP_ID,
"completed": true,
"SalePayments": {
"SalePayment": [{
"amount": -100,
"creditAccountID": creditAccountID,
"paymentTypeID": "5"
},
{
"amount": 100,
"paymentTypeID": PAYMENT_TYPE_ID // PaymentMethod the customer pays with
}
]
}
}
Adrian Samuel
Software Developer
Lightspeed HQ
When using the payload above, my gift card is not being charged.
In the result of the sale the "CreditAccountID" is set to "0", although I did include it in my call exactly like above...
Could someone help me out here please?