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": "https://sp-file-uploads-prod.s3.amazonaws.com/swipe/swipe-attachment/3115/2023/09/08/1694212690214_filename.jpg?x-amz-meta-user-id=3115&x-amz-meta-filename=filename.jpg&x-amz-meta-resource-id=%7B%22card_uuid%22%3A%2254e7a88f-5c8b-464b-abc5-fe9f20d7a436%22%2C%22swipe_id%22%3A%2248383e03-683e-448e-90ea-38df5ac5d0f6%22%7D&x-amz-meta-purpose=swipe%2Fswipe-attachment&x-amz-meta-index-prefix=&X-Amz-Security-Token=IQoJb3JpZ2luX2VjENb%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCIBxn72fJMspx8nrcvFm52JdHC6P3uUId7dn3ukCqu%2FEUAiAmORZKX7nP4ApygJ6lN8joXBvgbtnxQ4PH7%2BVWdZwYESrDBQiv%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAUaDDIyMzI0NDExODA0NyIM3jIqpO%2Bpl%2F8zBjgyKpcFQ1m1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ZR4ltq%2FJ9c9WH8AzlxSE6WIujOrEbisaq5xhBUKmSPSZjSKxcoQWUZZIYDrx9g%2B%2Bp1rzAPXwop6BYxsDSTQPab1%2FkqT9F8YlymJDc6c%2FeUhKq8wK1TM3VDtSRuFERCNBfCYRg%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230908T223810Z&X-Amz-SignedHeaders=host&X-Amz-Expires=299&X-Amz-Credential=ASIATH6TC5AP6I2FJGFP%2F20230908%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=b058d3ec71efcc0aca99a0a836e008f2e4f56e371277721add70f5ac606ccc48"
}

The upload URL is used in the next request.

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:

PUT https://sp-file-uploads-prod.s3.amazonaws.com/swipe/swipe-attachment/3115/2023/09/08/1694212690214_filename.jpg?x-amz-meta-user-id=3115&x-amz-meta-filename=filename.jpg&x-amz-meta-resource-id=%7B%22card_uuid%22%3A%2254e7a88f-5c8b-464b-abc5-fe9f20d7a436%22%2C%22swipe_id%22%3A%2248383e03-683e-448e-90ea-38df5ac5d0f6%22%7D&x-amz-meta-purpose=swipe%2Fswipe-attachment&x-amz-meta-index-prefix=&X-Amz-Security-Token=IQoJb3JpZ2luX2VjENb%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCIBxn72fJMspx8nrcvFm52JdHC6P3uUId7dn3ukCqu%2FEUAiAmORZKX7nP4ApygJ6lN8joXBvgbtnxQ4PH7%2BVWdZwYESrDBQiv%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAUaDDIyMzI0NDExODA0NyIM3jIqpO%2Bpl%2F8zBjgyKpcFQ1m1Ie3g21B42fQAks198WCT7EB0g8pJsb5msUyv3trQc6RjWGzu77e3dm3fN6eooRTjwvAPTtMfbUf6wIOJRAwqaB%2B5sqRSrNKt7Ss38T%2BX%2BojxnX8uTBN423MYBh5Mjbhx7jDy0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uFERCNBfCYRg%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230908T223810Z&X-Amz-SignedHeaders=host&X-Amz-Expires=299&X-Amz-Credential=ASIATH6TC5AP6I2FJGFP%2F20230908%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=b058d3ec71efcc0aca99a0a836e008f2e4f56e371277721add70f5ac606ccc48
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.
No headers are sent with this request.

This request does not require any headers. Additionally, please note that the upload URL will expire after five minutes.

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.