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

6 comments

  • LucienVersendaalLucienVersendaal Posts: 23Moderator, Lightspeed Staff moderator

    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

  • umairakram500umairakram500 Posts: 3Member

    I have followed every single step but I am still getting this error

  • Adrian SamuelAdrian Samuel Posts: 495Moderator, Lightspeed Staff moderator

    @umairakram500,

    Once a gift card has been topped up with a value you can only charge/use gift cards via a Sale

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

  • jonasverhulstjonasverhulst Posts: 1Member
    edited August 6

    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?

  • umairakram500umairakram500 Posts: 3Member

    @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/

  • Adrian SamuelAdrian Samuel Posts: 495Moderator, Lightspeed Staff moderator

    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

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

Sign In or Register to comment.