Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worked, How do I get PIH (previous invoice hash)? #6

Closed
sudo-sand opened this issue Sep 25, 2022 · 6 comments
Closed

Worked, How do I get PIH (previous invoice hash)? #6

sudo-sand opened this issue Sep 25, 2022 · 6 comments

Comments

@sudo-sand
Copy link

sudo-sand commented Sep 25, 2022

I have pretty much the same example as you. When I run checkInvoiceCompliance or reportInvoice I get Request failed with status code 400.

One more question, do I store PIH in a DB or how do you get it?

@sudo-sand sudo-sand changed the title Request failed with status code 400 Worked, How do I get PIH (previous invoice hash)? Sep 25, 2022
@wes4m
Copy link
Owner

wes4m commented Sep 25, 2022

I have pretty much the same example as you. When I run checkInvoiceCompliance or reportInvoice I get Request failed with status code 400.

The 400 Failure with reportInvoice is expected. ZATCA's sandbox report API is not fully ready yet. Currently they're returning a constant production cert that does not have the ability to sign Simplified Tax Invoices. Hopefully they fix that soon.

One more question, do I store PIH in a DB or how do you get it?

Yes, you will have to store the last invoice hash as a PIH somewhere whenever you create an invoice.

@sudo-sand
Copy link
Author

So, with the first phase, I have to store the xml invoices correct?

@wes4m
Copy link
Owner

wes4m commented Sep 25, 2022

So, with the first phase, I have to store the xml invoices correct?

ZATCA's first phase does not require you to store any XMLs. But yes, for the second phase you will need to store the invoices as a custom object and then generate an XML every time. Or just store the signed XML for each invoice.

@sudo-sand
Copy link
Author

Sorry for bothering you, in the first phase, what format does the invoice take?

@wes4m
Copy link
Owner

wes4m commented Sep 25, 2022

Sorry for bothering you, in the first phase, what format does the invoice take?

This package is intended for phase 2. Try something like @mrsool/zatca for phase 1.
Also read ZATCA Specs

@sudo-sand
Copy link
Author

Thanks @wes4m for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants