Payment

ayments are associated with each document in Space Invoices, and a single document can have multiple payments, even exceeding the invoice's total value. Payments are tracked in the document's currency.

You can also add payments during the same API call as creating the document, which is particularly useful when a payment has already been made at the time of the document's creation. To learn more about this, refer to the "payments" property in the "Create a Document" section of the documentation. This feature streamlines the payment recording process and ensures that payment information is accurately captured at the time of document creation.

Endpoints:

  • POST /v1/Organizations/:id/payments
  • GET /v1/Payments/:id
  • GET /v1/Organizations/:id/payments
  • GET /v1/Organizations/:id/payments/count
  • PUT /v1/Payments/:id
  • DELETE /v1/Payments/:id
  • POST /v1/Documents/:id/payments
  • GET /v1/Documents/:id/payments
  • GET /v1/Documents/:id/payments/count

The Payment object

Parameters

  • id string readonly

  • amount number

  • type string

  • date date

  • transactionId string

    Transaction id from payment gateway

  • Additional propertiesExpand all
    
      {
  "amount": 42,
  "type": "string",
  "tag": "string",
  "date": "2022-04-20T10:10:30+00:00Z",
  "note": "string",
  "transactionId": "string",
  "id": "string",
  "documentId": "string",
  "organizationId": "string",
  "deletedAt": "2022-04-20T10:10:30+00:00Z",
  "_isDeleted": false,
  "deletedId": "string",
  "createdAt": "2022-04-20T10:10:30+00:00Z",
  "updatedAt": "2022-04-20T10:10:30+00:00Z",
  "custom": {}
}    
  

Create Payment

POST /v1/Organizations/:id/payments

Parameters

Path
  • id string required

    Organization id

Properties

  • amount number required

  • type string required

  • date date required

  • transactionId string optional

    Transaction id from payment gateway

  • Additional propertiesExpand all
      
        const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/payments', {
  method: 'POST',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    amount: 42,
    type: 'string',
    tag: 'string',
    date: '2022-04-20T10:10:30+00:00Z',
    note: 'string',
    transactionId: 'string',
    custom: {}
  })
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X POST https://api.spaceinvoices.com/v1/Organizations/{id}/payments \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "amount": 42, \
    "type": "string", \
    "tag": "string", \
    "date": "2022-04-20T10:10:30+00:00Z", \
    "note": "string", \
    "transactionId": "string", \
    "custom": {}
  }'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/payments'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
params = {
  'amount': 42,
  'type': 'string',
  'tag': 'string',
  'date': '2022-04-20T10:10:30+00:00Z',
  'note': 'string',
  'transactionId': 'string',
  'custom': {}
}
response = requests.post(url, json=params, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "amount": 42,
  "type": "string",
  "tag": "string",
  "date": "2022-04-20T10:10:30+00:00Z",
  "note": "string",
  "transactionId": "string",
  "id": "string",
  "documentId": "string",
  "organizationId": "string",
  "deletedAt": "2022-04-20T10:10:30+00:00Z",
  "_isDeleted": false,
  "deletedId": "string",
  "createdAt": "2022-04-20T10:10:30+00:00Z",
  "updatedAt": "2022-04-20T10:10:30+00:00Z",
  "custom": {}
}    
  

Get Payment

GET /v1/Payments/:id

Parameters

Path
  • id string required

    Model id

Query
  • filter string optional

    Filter defining fields and include - must be a JSON-encoded string ({"something":"value"})

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Payments/{id}', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Payments/{id} \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Payments/{id}'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "amount": 42,
  "type": "string",
  "tag": "string",
  "date": "2022-04-20T10:10:30+00:00Z",
  "note": "string",
  "transactionId": "string",
  "id": "string",
  "documentId": "string",
  "organizationId": "string",
  "deletedAt": "2022-04-20T10:10:30+00:00Z",
  "_isDeleted": false,
  "deletedId": "string",
  "createdAt": "2022-04-20T10:10:30+00:00Z",
  "updatedAt": "2022-04-20T10:10:30+00:00Z",
  "custom": {}
}    
  

Find Payments

GET /v1/Organizations/:id/payments

Parameters

Path
  • id string required

    Organization id

Query
  • filter string optional

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/payments', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Organizations/{id}/payments \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/payments'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      [
  {
    "amount": 42,
    "type": "string",
    "tag": "string",
    "date": "2022-04-20T10:10:30+00:00Z",
    "note": "string",
    "transactionId": "string",
    "id": "string",
    "documentId": "string",
    "organizationId": "string",
    "deletedAt": "2022-04-20T10:10:30+00:00Z",
    "_isDeleted": false,
    "deletedId": "string",
    "createdAt": "2022-04-20T10:10:30+00:00Z",
    "updatedAt": "2022-04-20T10:10:30+00:00Z",
    "custom": {}
  }
]    
  

Count Payments

GET /v1/Organizations/:id/payments/count

Parameters

Path
  • id string required

    Organization id

Query
  • where string optional

    Criteria to match model instances

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/payments/count', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Organizations/{id}/payments/count \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/payments/count'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "count": 42
}    
  

Replace Payment

PUT /v1/Payments/:id

Parameters

Path
  • id string required

    Model id

Properties

  • amount number required

  • type string required

  • date date required

  • transactionId string optional

    Transaction id from payment gateway

  • Additional propertiesExpand all
      
        const response = await fetch('https://api.spaceinvoices.com/v1/Payments/{id}', {
  method: 'PUT',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    amount: 42,
    type: 'string',
    tag: 'string',
    date: '2022-04-20T10:10:30+00:00Z',
    note: 'string',
    transactionId: 'string',
    custom: {}
  })
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X PUT https://api.spaceinvoices.com/v1/Payments/{id} \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "amount": 42, \
    "type": "string", \
    "tag": "string", \
    "date": "2022-04-20T10:10:30+00:00Z", \
    "note": "string", \
    "transactionId": "string", \
    "custom": {}
  }'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Payments/{id}'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
params = {
  'amount': 42,
  'type': 'string',
  'tag': 'string',
  'date': '2022-04-20T10:10:30+00:00Z',
  'note': 'string',
  'transactionId': 'string',
  'custom': {}
}
response = requests.put(url, json=params, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "amount": 42,
  "type": "string",
  "tag": "string",
  "date": "2022-04-20T10:10:30+00:00Z",
  "note": "string",
  "transactionId": "string",
  "id": "string",
  "documentId": "string",
  "organizationId": "string",
  "deletedAt": "2022-04-20T10:10:30+00:00Z",
  "_isDeleted": false,
  "deletedId": "string",
  "createdAt": "2022-04-20T10:10:30+00:00Z",
  "updatedAt": "2022-04-20T10:10:30+00:00Z",
  "custom": {}
}    
  

Delete Payment

DELETE /v1/Payments/:id

Parameters

Path
  • id string required

    Model id

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Payments/{id}', {
  method: 'DELETE',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X DELETE https://api.spaceinvoices.com/v1/Payments/{id} \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Payments/{id}'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.delete(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "count": 1
}    
  

Create Payment for Document

POST /v1/Documents/:id/payments

Parameters

Path
  • id string required

    Document id

Properties

  • amount number required

  • type string required

  • date date required

  • transactionId string optional

    Transaction id from payment gateway

  • Additional propertiesExpand all
      
        const response = await fetch('https://api.spaceinvoices.com/v1/Documents/{id}/payments', {
  method: 'POST',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    amount: 42,
    type: 'string',
    tag: 'string',
    date: '2022-04-20T10:10:30+00:00Z',
    note: 'string',
    transactionId: 'string',
    custom: {}
  })
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X POST https://api.spaceinvoices.com/v1/Documents/{id}/payments \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "amount": 42, \
    "type": "string", \
    "tag": "string", \
    "date": "2022-04-20T10:10:30+00:00Z", \
    "note": "string", \
    "transactionId": "string", \
    "custom": {}
  }'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Documents/{id}/payments'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
params = {
  'amount': 42,
  'type': 'string',
  'tag': 'string',
  'date': '2022-04-20T10:10:30+00:00Z',
  'note': 'string',
  'transactionId': 'string',
  'custom': {}
}
response = requests.post(url, json=params, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "amount": 42,
  "type": "string",
  "tag": "string",
  "date": "2022-04-20T10:10:30+00:00Z",
  "note": "string",
  "transactionId": "string",
  "id": "string",
  "documentId": "string",
  "organizationId": "string",
  "deletedAt": "2022-04-20T10:10:30+00:00Z",
  "_isDeleted": false,
  "deletedId": "string",
  "createdAt": "2022-04-20T10:10:30+00:00Z",
  "updatedAt": "2022-04-20T10:10:30+00:00Z",
  "custom": {}
}    
  

Get Document Payments

GET /v1/Documents/:id/payments

Parameters

Path
  • id string required

    Document id

Query
  • filter string optional

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Documents/{id}/payments', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Documents/{id}/payments \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Documents/{id}/payments'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      [
  {
    "amount": 42,
    "type": "string",
    "tag": "string",
    "date": "2022-04-20T10:10:30+00:00Z",
    "note": "string",
    "transactionId": "string",
    "id": "string",
    "documentId": "string",
    "organizationId": "string",
    "deletedAt": "2022-04-20T10:10:30+00:00Z",
    "_isDeleted": false,
    "deletedId": "string",
    "createdAt": "2022-04-20T10:10:30+00:00Z",
    "updatedAt": "2022-04-20T10:10:30+00:00Z",
    "custom": {}
  }
]    
  

Count Document Payments

GET /v1/Documents/:id/payments/count

Parameters

Path
  • id string required

    Document id

Query
  • where string optional

    Criteria to match model instances

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Documents/{id}/payments/count', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Documents/{id}/payments/count \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Documents/{id}/payments/count'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "count": 42
}