Get Invoice by Payment ID API
POST /getInvoiceByPaymentId
Description
This endpoint retrieves details of a specific invoice based on its associated payment ID.
Request
Endpoint: /getInvoiceByPaymentId
Method: POST
Body:
query getInvoiceByPaymentId ($paymentId: Int!) {
getInvoiceByPaymentId (paymentId: $paymentId) {
id
firstName
lastName
clientCompanyName
address
taxId
email
phoneNumber
groupId
amountForGroup
multiLogin
amountForMultiLogin
totalAmount
paymentMethod
paymentDate
invoiceDate
updateDate
}
}
GraphQL Variables:
{
"paymentId": 0
}
Example Request
cURL:
curl --location 'YOUR_API_ENDPOINT' \
--header 'Content-Type: application/json' \
--data '{"query":"query getInvoiceByPaymentId ($paymentId: Int!) {\n getInvoiceByPaymentId (paymentId: $paymentId) {\n id\n firstName\n lastName\n clientCompanyName\n address\n taxId\n email\n phoneNumber\n groupId\n amountForGroup\n multiLogin\n amountForMultiLogin\n totalAmount\n paymentMethod\n paymentDate\n invoiceDate\n updateDate\n }\n}","variables":{"paymentId":0}}'
Response
The response will include:
id
: Unique identifier of the invoice.firstName
: First name of the client.lastName
: Last name of the client.clientCompanyName
: Company name of the client.address
: Address of the client.taxId
: Tax identification number of the client.email
: Email address of the client.phoneNumber
: Phone number of the client.groupId
: Group ID associated with the invoice.amountForGroup
: Amount billed for the group.multiLogin
: Number of multi-logins billed.amountForMultiLogin
: Amount billed for multi-logins.totalAmount
: Total amount of the invoice.paymentMethod
: Method used for payment.paymentDate
: Date when the payment was made.invoiceDate
: Date when the invoice was issued.updateDate
: Date when the invoice was last updated.
Errors
- 400 Bad Request: Invalid
paymentId
provided. - 404 Not Found: Invoice with the given
paymentId
does not exist. - 500 Internal Server Error: Server error while processing the request.
Notes
- Ensure that
paymentId
provided is valid; otherwise, the response may be an error or empty. - The response includes sensitive client information. Ensure proper access controls and permissions are in place.
- If the payment ID does not correspond to any invoice, the response should handle this gracefully, potentially returning an error or an empty result.