Skip to main content

Purchase invoice rendition

Use this API to download the rendition (PDF file) of a purchase invoice, returned as a Base64 string.

POST
URLhttps://open-api.tingee.vn/v1/e-invoice/input/preview-base64

Download the PDF rendition of a purchase invoice as Base64.

Header Request​

HeaderRequiredDescription
Content-Type✓application/json
x-client-id✓Partner identifier issued by TINGEE.
x-signature✓HMAC SHA512 authentication signature. See How to generate the signature.
x-request-timestamp✓Time the request is sent (format: yyyyMMddHHmmssSSS, UTC+7)

Body Parameter​

FieldTypeRequiredDescription
merchantIdnumber~Merchant ID
(Required if you connect with a Master Merchant account).
accountIdnumber✕E-invoice account ID (from List accounts). Leave empty to use the default account.
invoiceCodestring✓Invoice identifier, from the List purchase invoices API.

Code samples​

curl --location --request POST 'https://open-api.tingee.vn/v1/e-invoice/input/preview-base64' \
--header 'accept: application/json' \
--header 'x-client-id: YOUR_CLIENT_ID' \
--header 'x-request-timestamp: 20240509154004003' \
--header 'x-signature: YOUR_SIGNATURE' \
--header 'Content-Type: application/json' \
--data '{
"invoiceCode": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
}'

Sample Response​

{
"code": "00",
"message": "Success",
"data": {
"fileBase64": "JVBERi0xLjQKMSAwIG9iago8PA..."
}
}
FieldTypeDescription
codestringResult code (00 = Success).
messagestringResponse message.
data.fileBase64stringBase64-encoded PDF file content.

Common error codes​

CodeDescriptionHow to handle
2039File does not existThe invoice has no rendition yet. Try again after syncing.
400Failed to get the purchase invoice renditionCheck invoiceCode. message contains the details.
2036The account is not registered for the purchase invoice serviceUpdate the account so that services contains input-invoice via the Create/Update account API.
2007The provider is not supportedPurchase invoices only support x-cyber provider accounts.
2032No default account is configuredPass accountId, or set an account as the default.
1057Account information not foundCheck accountId.
1095, 1096Master Merchant merchantId errorPass a merchantId belonging to the Master Merchant calling the API.
90, 91, 92, 97Request authentication error (timestamp, client-id, signature)See System error codes.
OthersOther errorsSee Error codes.