Upload swipe attachment

Introduction

Swipe attachments are file uploads that are associated with swipes. This allows either the issuer or you as the lender to pair contextual files with a swipe. Multiple attachments can be associated with a single swipe.

This process requires two requests: one to generate a URL, and one to upload a file to the URL. This page explains how to send the two necessary requests to upload an attachment to a swipe.

1. Generate a File Upload URL

First, send the following request to generate an upload URL:

POST https://securepayments.loanpro.io/api/v2/upload-file
{
    "purpose": "swipe/swipe-attachment",
    "resource_id": {
         "card_uuid": "54e7a88f-5c8b-464b-abc5-fe9f20d7a436",
         "swipe_id": "48383e03-683e-448e-90ea-38df5ac5d0f6"
    },
    "filename": "filename.jpg"
}
Authorization: {token}
Secret: {secret}

Payload Details

Field NameDescriptionData TypeRequired?
purposeThe type of file upload. In the context of uploading a swipe attachment, only one option is available.

"swipe/swipe-attachment"
enum
resource_idAn object containing both the card UUID and the swipe ID.
filenameThe name of the file that will be uploaded to the swipe.

The following filetypes are currently accepted:
.jpg
.png
.pdf
string

Response

The response from a successful request will include the upload URL:

{
    "presigned_url": "{url}"
}

The upload URL is used in the next request. Please note that the upload URL will expire after five minutes.

2. Upload File

Next, upload the file to the URL generated in the previous request. To do so, send a PUT request to the URL with no payload or headers.

If you're testing this process with Postman, set the Body format to 'binary' and click 'Select File' to upload the file from your device.