Payment Upload

Overview of how to upload a Payment file.

Payment Upload Overview

Payment Upload provides a way for Zylo users to upload payment uploads via CSV to Zylo.

1. Get File Source Type

Pre-requisites

  • You must have the "spend:read" permission for the Enterprise API.

Payment uploads can only be uploaded if a source type has been created that fits the CSV.

To see all available source types, call the "Get Payment Upload Source Types" GET request, like below:

curl --request GET \
     --url https://api.zylo.com/v2/payments/import/types \
     --header 'accept: application/json' \
     --header 'authorization: Bearer {token}'
📘

Important Note

A new source type can be added via "New-Source" in the UI in the "Payments Upload" page. Our team will then review the uploaded payment document.

2. Creating an Import Job

Pre-requisites

  • You must have "spend:write" permission for the Enterprise API.

To create an import job to start uploading data, you call the "Create Payment Upload Job" POST request, like below:

curl --request POST \
     --url https://api.zylo.com/v2/payments/import/job \
     --header 'Authorization: Bearer {token}' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "file_name": "example_file.csv",
  "source_type": {source_type}
}
'

The response includes a URL to upload your CSV and other parameters that are required when uploading the file. An example of the response is below, be sure to copy this response to use in the next step:

{
  "import_id": "52907745-7672-470e-a803-a2f8feb52944",
  "import_upload_url": "https://example-bucket.s3.region.amazonaws.com/",
  "import_metadata": {
    "policy": "<POLICY>",
    "signature": "<SIGNATURE>",
    "date": "<DATE>",
    "credential": "<CREDENTIAL>",
    "algorithm": "<ALGORITHM>",
    "key": "<UPLOAD KEY>",
    "securityToken": "<SECURITY TOKEN>"
  },
  "import_status_endpoint": "https://api.zylo.com/v2/usageConnect?id=52907745-7672-470e-a803-a2f8feb52944"
}

The credentials above expire in 5 minutes and the file size is limited to 3GB.

3. Upload CSV to Import Job

The CSV uploads requires a multipart/form-data request using the response metadata above to validate the import.

Below is an example using the response from Step 3 in a request to upload a CSV file:

curl --request POST \
     --url https://example-bucket.s3.amazonaws.com/ \
     --header 'accept: application/json' \
     --header 'content-type: multipart/form-data' \
     --form 'key=<UPLOAD KEY>' \
     --form 'X-Amz-Algorithm=<ALGORITHM>' \
     --form 'X-Amz-Credential=<CREDENTIAL>' \
     --form 'X-Amz-Date=<DATE>' \
     --form 'Policy=<POLICY>' \
     --form 'X-Amz-Signature=<SIGNATURE>' \
     --form 'Content-Type=text/csv' \
     --form 'X-Amz-Security-Token=<SECURITY TOKEN>' \
     --form 'file=@example_file.csv'