Getting 401 for production invoice clearance

This solution worked for me.

It would be good if such details are highlighted in the documentation.

This error may appear for the following reasons:
You receive four keys:

CCSIDBinaryToken
CCSIDSecret
PCSIDBinaryToken
PCSIDSecret
The first two keys (CCSIDBinaryToken and CCSIDSecret) are used only for compliance checking. These keys are required to sign the XML invoice for compliance verification.

If the compliance check passes, you must then use the third and fourth keys (PCSIDBinaryToken and PCSIDSecret) to sign the same XML invoice data for reporting and clearance.

The Compliance API requires “Basic Auth” authentication using the first and second keys.
The Reporting and Clearance APIs require “Basic Auth” authentication using the third and fourth keys.