Check invoice status transitions in archive#

Use this service to check an invoice status transitions in archive for your processed document.

Service steps#

  1. Get a token from your credentials by calling the service Account/getToken;

  2. Get an invoice status transitions in archive calling the service OutboundFinancialDocument/statusTransitions/{documentId};

Response structure from server#

When a request is well formed and the authentication data is correct the system responds with a message envelope as follows:

	"CorrelationId": "<GUID>", /* for correlation purposes */
	"IsValid": true,           /* false in case of erros */
	"Errors": [],              /* if empty is a good signal */
	"Data": "<Service Response Data>"   /* the data retuned ex: token, invoice status, dependent on the service called */

1. Get a token (Account/getToken)#

Credentials have be given to you, according to your registration at SANDBOX or Saphety Invoice Network:

  • For Test purposes, the user and password defined at SANDBOX registration

  • For Production, the user and password defined at Saphety Invoice Network registration

Use those credentials to get a token at:

# SANDBOX - Test Environment
server_base_adress = ""

# Saphety Invoice Network - Production Environment
#server_base_adress = ""
import requests
import json

# SIN account service url
service_url = "https://" + server_base_adress + "/api/Account/getToken"

# the username and password you registerd in SIN
username = ''
password = 'request_password'

# auhtentication data goes in payload as json
payload = {
      'Username': username,
      'Password': password
# payload goes in json, serialize the payloal object to json
# indicate in header that payload is json
headers = {
    'content-type': 'application/json'
# POST request to get a token
response = requests.request("POST", service_url, data=request_data, headers=headers)

* Note: the credentials (user and password) in this documentation were created by Saphety and can only be used in the SANDBOX environment. For tests we recommend that you use the credentials you obtained when registering with the SANDBOX.

# formating the response to json for visualization purposes only
json_response = json.loads(response.text)
print(json.dumps(json_response, indent=4))
    "CorrelationId": "6ff53b51-0d88-40f4-aa9c-c39a066b448a",
    "IsValid": true,
    "Errors": [],
    "Data": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiJzaW1hby5nb2RpbmhvQHNhcGhldHkuY29tIiwidW5pcXVlX25hbWUiOiJTaW3Do28gR29kaW5obyIsInN5c3RlbV9hZG1pbiI6IkZhbHNlIiwic2Vzc2lvbl9pZCI6ImIzM2E4MjNiLTkwYmMtNGQ2Zi04NWJhLTAzOTcyZjUxNWEwZiIsImNwIjoic2ltYW8uZ29kaW5ob0BzYXBoZXR5LmNvbSIsInJsIjoiRGV2ZWxvcGVyIiwibmJmIjoxNjM2NTQ4MTY5LCJleHAiOjE2NDI1NDgxMDksImlhdCI6MTYzNjU0ODEwOSwiaXNzIjoiaHR0cHM6Ly93d3cuc2FwaGV0eS5jb20vIiwiYXVkIjoiaHR0cHM6Ly93d3cuc2FwaGV0eS5jb20vRGNuU2FuZGJveCJ9.Ogeos7imLDOp92Oq60VuD1B2-8UlevvlTPXPYdZK1FI"
# your token is at:
token = json_response["Data"];
print (token)

2. Get a Document status transitions by DocumentId (OutboundFinancialDocument/statusTransitions/{documentId})#

Build the service endpoint url#

In the service url you need to supply the outboundfinancialdocumentId received

# SIN service url for retrieving inforfation on invoice previously sent
service_url = """{ServerBaseUrl}/api/OutboundFinancialDocument/statusTransitions/{OutboundFinancialDocumentId}""".format(
service_url = "https://" + service_url
print (service_url)

Call the service to get the document’s status transitions#

You will call the service endpoint url

# build the request
headers = {
    'Authorization': 'bearer ' + token
# POST request to send the invoice
response = requests.request("GET", service_url, headers=headers)

# formating the response to json for visualization purposes only
json_response = json.loads(response.text)
print(json.dumps(json_response["Data"], indent=4))
        "Id": "a6a82dfc-652b-4ac7-aaeb-0cb21058f0b9",
        "OutboundFinancialDocumentId": "fc5e547d-8537-4e05-97d5-1159c62efd6f",
        "IntegrationStatus": "Received",
        "PreviousStatus": "Sent",
        "StatusDate": "2021-11-04 11:54:51",
        "Reason": null
        "Id": "5710c37d-6594-4116-9b68-67e5e60da7cb",
        "OutboundFinancialDocumentId": "fc5e547d-8537-4e05-97d5-1159c62efd6f",
        "IntegrationStatus": "Sent",
        "PreviousStatus": "Not_Sent",
        "StatusDate": "2021-11-04 11:54:09",
        "Reason": null

This documents can be in the next status:

  • Sending: When the document is sending

  • Sent: When the document was sent

  • Paid: When the document is paid

  • Received: When the document is received

  • Error: When the document have errors

  • Not_Sent: When the document was not sent

  • NotIntegrated: When the document is not integrated

  • Rejected: When the document was rejected

  • Returned: When the document is returned