How can I get payment type of ticket via API

To get list items and entities we use this command:

{getTicket(id:1000) {id,uid,type,number,date,entities{name,type,id,typeId},orders{id,uid,name,quantity,price},states{state,stateName},totalAmount,remainingAmount}}

But we need know also how customer pay. If he pay cash or credit card.
Where can I read this information via API?

You mean in GraphQL right? You can get it via custom report and then fetch that report via GraphQL.

1 Like

right GraphQL. I will try via getCustomReport, thanks for tip

GrapQL
query q {getCustomReport(name:"TicketPayment",parameters:[{name:"TicketId",value:"64"}])
{
    name
    tables {
      rows {
        cells
      } 
    }
  }
}


SambaPOS report
[Ticket Payments:2, 2, 2, 2, 2, 2]

>|TID|Cash|Credit|Online|PAY SUM

|{REPORT TICKET DETAILS:T.Id,T.TicketNumber:T.Id==$TicketId}|[=F(TN('{REPORT PAYMENT DETAILS:P.Amount.Sum:T.Id==$TicketId AND ((PT=Cash))}'),'0.00;(0.00);-')]|[=F(TN('{REPORT PAYMENT DETAILS:P.Amount.Sum:T.Id==$TicketId AND ((PT=Credit Card))}'),'0.00;(0.00);-')]|[=F(TN('{REPORT PAYMENT DETAILS:P.Amount.Sum:T.Id==$TicketId AND ((PT=Online))}'),'0.00;(0.00);-')]|[=F(TN('{REPORT PAYMENT DETAILS:P.Amount.Sum:T.Id==$TicketId}'),'0.00;(0.00);-')]


result GraphQL
{
  "data": {
    "getCustomReport": {
      "name": "TicketPayment",
      "tables": [
        {
          "rows": [
            {
              "cells": [
                "",
                "64",
                "64",
                "20.00",
                "49.00",
                "-",
                "69.00"
              ]
            }
          ]
        }
      ]
    }
  },
  "errors": null
}