Overview
A Document is a written, printed, or electronic matter that provides information or evidence or that serves as an official record.
Documents may sometimes be requested to complete underwriting and finalize Payment fulfillment. Examples of Document requests typically involve an invoice detailing the goods and services rendered by a Recipient, a photo of a Payer's government-issued ID, etc.
Plastiq Connect will request Documents via webhook events. More specifically, a Payment webhook will notify you when a Document request has been issued, the requested Document type
, and the associated Payment identifiers linked to a customer's transaction.
Here is an example of a Document request:
{
"id": "dee9427c-3e33-490b-a9f1-9fd16b75a14f",
"event": "document.request",
"data": {
"id": "fc3d3ad3-52ae-45d7-bae0-501d112547ef",
"object": "PAYMENT",
"type": "GOVERNMENT_ISSUED_ID",
"timestamp": 1620080776056
}
}
Once the webhook event is acknowledged, a Document request can be satisfied by calling the POST Documents endpoint.
Here are some examples of different Document request types
:
Type | Description |
---|---|
SUPPLIER_INVOICE_OR_PURCHASE_ORDER | Plastiq needs to understand what goods and/or services are being paid for (usually provided by the vendor/recipient). Plastiq uses the invoice or purchase order to gain an understanding, and verifies that the payment complies with our Terms of Services and the network policies mandated by the card brands (Visa, Mastercard, Amex, etc). |
GOVERNMENT_ISSUED_ID | Plastiq must verify a user's identity for our KYC process and compliance protocols. Plastiq must also confirm that the owner of the credit card is the same person making the transaction. |
CARD_OR_BANK_STATEMENT | Plastiq must verify a user's identity for our KYC process and compliance protocols. Plastiq must also confirm that the owner of the funding method is the same person making the transaction. |
BENEFICIAL_OWNER | Plastiq must obtain the beneficial owner information for all international vendors per payment processor regulations. This information is provided by the payor to Plastiq, and is oftentimes given to the payor by the vendor/recipient. |
EMPLOYEE_PAY_OR_CONTRACT | Plastiq must verify that the payment is not a peer to peer payment, which is not allowed Plastiq's Terms of Service. Plastiq looks at these documents to confirm that the payment is for payroll, contractor services, etc. |
LEGAL_AGREEMENT | Plastiq needs to understand what goods and/or services are being paid for. Plastiq reads the legal agreement to gain insights, and verifies that the payment complies with our Terms of Services and the network policies mandated by various card brands. In the case of nuanced or complex payments, Plastiq will use the legal agreement to gain an understanding of the nature and/or relationship between the payment, payor, and payee. |
LEASE_AGREEMENT | Plastiq is required by some card networks to verify all peer to peer rent transactions, and per payment processor requirements must keep the lease agreement on file. |
CERTIFICATE_OF_GOODS | Plastiq does not allow payments for goods or services whose delivery or completion has not yet been confirmed. Plastiq must verify that the goods or services provided by the vendor/recipient were rendered to the payor's satisfaction. By providing a certificate of goods, the payor is confirming that no future chargebacks, disputes or claims will be made regarding insufficient or unexpected quality or untimely delivery of the goods and services. |
NON_P2P_DOCUMENT | Plastiq must verify that the payment is not a peer to peer payment, which is not allowed per Plastiq's Terms of Service. Plastiq needs to ensure that a good and/or service is being rendered and is requesting a document, of the payor's choosing, to demonstrate that the nature of the transaction is related to a good or service rendered. |
ESCROW_AGREEMENT | Plastiq needs to verify that an escrow agreement is in place between the payor and payee, prior to disbursing funds to a recipient. |
W9_FORM | Plastiq must verify that the payment is not a peer to peer payment, which is not allowed Plastiq's Terms of Service. Plastiq will review the w9 form as a means to ensure the payment is for a good or service rendered by an industry professional. |
Try it out
Sample POST Documents response
{
"uploadURL": "https://s3.us-west-2.amazonaws.com/artemis-qa-documents-us-west-2",
"metadata": {
"Key": "34df7540-3c27-4d8d-8b27-0ca235252e62/e830c9c0-8705-48ff-bbdb-9cf05bc24c0d/0e/0e123696-c209-48ab-bfbf-8b5ed00f2134.jpg",
"success_action_status": "201",
"bucket": "artemis-qa-documents-us-west-2",
"X-Amz-Algorithm": "AWS4-HMAC-SHA256",
"X-Amz-Credential": "ASIAZXQMQOZ3NS4CFNG4/20220124/us-west-2/s3/aws4_request",
"X-Amz-Date": "20220124T235319Z",
"X-Amz-Security-Token": "IQoJb3JpZ2luX2VjEFQaCXVzLXdlc3QtMiJHMEUCICgJtDvFyk07sOLbPkag4X818r7CMHwUFGv5We/38kZMAiEAgupTUiyamYLtUHv+h2XuI8xKLH+lIlsEWHnd1EeUVdIqgQQIfRACGgw2Njg5Njc0MDEwNzgiDAiaLoynlBqp7mdjhireA7ah5Jd81Ac76CZgB97Sx1ObFG8kuZevWE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NvV1hIZldZbmd0NVFMQkV1QTByS05yRGYrb2h0TGcvNElVNmRvNmRNVktCeldpdUZ0MzdjTUJaWjBxVDQzRUcwOHVKOTFaWnFaSVVOUktocHc0bnczTVNwNVBXN2N5MzJDT2dhbllndWlWRFFvNEFzS1h1NlhxWFRWYnRrcFlveEFnVU85MDZRZitWZnUrVnVKRmlrenpjbEZDWXNGcWJvOVZVcGpWM0RMcllqV1dFYmpsQXBkNTI1THUrWEJKTXV6NHk1N1lyU2ZmcUgxcFh0YmFVenozVU95L21DekgvbTBFcU50dmVxamVKa0dPa29TcU5ZL3Y3b2RKSTZ2dk5zZU9aS2FFbXROcHNEWi81eGZINVVoYzRQMy9Kay9aVUlUdjE2QytPNkZlNDJNRE5tNUZKejEvelYxVVZEK09FZTlDaEtrb0Y2ZHU4dzE1Qzhqd1k2cFFGRzZNRS8rY1NxQnIvb0paem8xNXVhd0NZNVQxVTNZNldRQlpFWmpZOTZnc2hMTXNWS1FZS1N6U2ZVQU50M0tYNXJqVUhOMGFBSWtjYXlncGJmSjcxQVdYVWE4R0tRbGN4bDF4Ry9xb2RUUHdsbE5hYWtlV2pTK21XbFRVR25Hc2JFM3ZiSUhsUUxhMTFnT2xjNHFuYVRyK1pFQnJXNVJaMGRtT29rK01SZCtrOTZBWDA5MUpJeW9PTHAwYlRraEluVkdscmtwSkdlTGtsSUtsY3VzSjN6enh5cjQxWT0ifV19",
"X-Amz-Signature": "6395b80bcfd03730c078697e58a11302941ac39df4e545bfe372c60d05d0e228"
}
}
The uploadURL
is a pre-signed URL (S3 bucket) to be used in a multipart request when uploading assets. These pre-signed URLs expire after 15 minutes from creation.
Upload your file
- Create a
POST
request to theuploadURL
provided from thePOST /documents
response (as shown above). - Add all fields from the
metadata
object from thePOST /documents
response asform-data
. - Add the file you would like to upload with the key
file
as the last record inform-data
.
var formdata = new FormData();
formdata.append("Key", "34df7540-3c27-4d8d-8b27-0ca235252e62/e830c9c0-8705-48ff-bbdb-9cf05bc24c0d/0e/0e123696-c209-48ab-bfbf-8b5ed00f2134.jpg");
formdata.append("success_action_status", "201");
formdata.append("bucket", "artemis-qa-documents-us-west-2");
formdata.append("X-Amz-Algorithm", "AWS4-HMAC-SHA256");
formdata.append("X-Amz-Credential", "ASIAZXQMQOZ3NS4CFNG4/20220124/us-west-2/s3/aws4_request");
formdata.append("X-Amz-Date", "20220124T235319Z");
formdata.append("X-Amz-Security-Token", "IQoJb3JpZ2luX2VjEFQaCXVzLXdlc3QtMiJHMEUCICgJtDvFyk07sOLbPkag4X818r7CMHwUFGv5We/38kZMAiEAgupTUiyamYLtUHv+h2XuI8xKLH+lIlsEWHnd1EeUVdIqgQQIfRACGgw2Njg5Njc0MDEwNzgiDAiaLoynlBqp7mdjhireA7ah5Jd81Ac76CZgB97Sx1ObFG8kuZevWEQ07hcEmXxoNkNn90poVoJBX5koDsfGuE+HIz57W+35xg6D51BnT5Vr4yblKYPfXgmRuY+Z6EYMaXj2sH5piAOUNF1AbCDDJ+ltgN8sjc3NpBj4j2bgh33iOdauyCwn2rqJmpuirJUCqtQUFLpjMtXevAt1xRQhu6t6/4hL9hPOklyOqEsEWh4B3a7fl5zZTHOEkB8iYwQEyNG8/D0/W8QfYge64sBIS9jqYzI3bL/GhaNnUO6RWTIBf8Z3UlKGLqbb7UoPlcxLjm0ZZp7coWXHfWYngt5QLBEuA0rKNrDf+ohtLg/4IU6do6dMVKBzWiuFt37cMBZZ0qT43EG08uJ91ZZqZIUNRKhpw4nw3MSp5PW7cy32COganYguiVDQo4AsKXu6XqXTVbtkpYoxAgUO906Qf+Vfu+VuJFikzzclFCYsFqbo9VUpjV3DLrYjWWEbjlApd525Lu+XBJMuz4y57YrSffqH1pXtbaUzz3UOy/mCzH/m0EqNtveqjeJkGOkoSqNY/v7odJI6vvNseOZKaEmtNpsDZ/5xfH5Uhc4P3/Jk/ZUITv16C+O6Fe42MDNm5FJz1/zV1UVD+OEe9ChKkoF6du8w15C8jwY6pQFG6ME/+cSqBr/oJZzo15uaw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ZiSUhsUUxhMTFnT2xjNHFuYVRyK1pFQnJXNVJaMGRtT29rK01SZCtrOTZBWDA5MUpJeW9PTHAwYlRraEluVkdscmtwSkdlTGtsSUtsY3VzSjN6enh5cjQxWT0ifV19");
formdata.append("X-Amz-Signature", "6395b80bcfd03730c078697e58a11302941ac39df4e545bfe372c60d05d0e228");
formdata.append("file", fileInput.files[0], "documents.jpg");
var requestOptions = {
method: 'POST',
body: formdata,
redirect: 'follow'
};
fetch("https://s3.us-west-2.amazonaws.com/artemis-qa-documents-us-west-2", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import mimetypes
from codecs import encode
conn = http.client.HTTPSConnection("s3.us-west-2.amazonaws.com")
dataList = []
boundary = 'wL36Yn8afVp8Ag7AmP8qZ0SA4n1v9T'
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=Key;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("34df7540-3c27-4d8d-8b27-0ca235252e62/e830c9c0-8705-48ff-bbdb-9cf05bc24c0d/0e/0e123696-c209-48ab-bfbf-8b5ed00f2134.jpg"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=success_action_status;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("201"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=bucket;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("artemis-qa-documents-us-west-2"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=X-Amz-Algorithm;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("AWS4-HMAC-SHA256"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=X-Amz-Credential;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("ASIAZXQMQOZ3NS4CFNG4/20220124/us-west-2/s3/aws4_request"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=X-Amz-Date;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("20220124T235319Z"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=X-Amz-Security-Token;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("IQoJb3JpZ2luX2VjEFQaCXVzLXdlc3QtMiJHMEUCICgJtDvFyk07sOLbPkag4X818r7CMHwUFGv5We/38kZMAiEAgupTUiyamYLtUHv+h2XuI8xKLH+lIlsEWHnd1EeUVdIqgQQIfRACGgw2Njg5Njc0MDEwNzgiDAiaLoynlBqp7mdjhireA7ah5Jd81Ac76CZgB97Sx1ObFG8kuZevWEQ07hcEmXxoNkNn90poVoJBX5koDsfGuE+HIz57W+35xg6D51BnT5Vr4yblKYPfXgmRuY+Z6EYMaXj2sH5piAOUNF1AbCDDJ+ltgN8sjc3NpBj4j2bgh33iOdauyCwn2rqJmpuirJUCqtQUFLpjMtXevAt1xRQhu6t6/4hL9hPOklyOqEsEWh4B3a7fl5zZTHOEkB8iYwQEyNG8/D0/W8QfYge64sBIS9jqYzI3bL/GhaNnUO6RWTIBf8Z3UlKGLqbb7UoPlcxLjm0ZZp7coWXHfWYngt5QLBEuA0rKNrDf+ohtLg/4IU6do6dMVKBzWiuFt37cMBZZ0qT43EG08uJ91ZZqZIUNRKhpw4nw3MSp5PW7cy32COganYguiVDQo4AsKXu6XqXTVbtkpYoxAgUO906Qf+Vfu+VuJFikzzclFCYsFqbo9VUpjV3DLrYjWWEbjlApd525Lu+XBJMuz4y57YrSffqH1pXtbaUzz3UOy/mCzH/m0EqNtveqjeJkGOkoSqNY/v7odJI6vvNseOZKaEmtNpsDZ/5xfH5Uhc4P3/Jk/ZUITv16C+O6Fe42MDNm5FJz1/zV1UVD+OEe9ChKkoF6du8w15C8jwY6pQFG6ME/+cSqBr/oJZzo15uawCY5T1U3Y6WQBZEZjY96gshLMsVKQYKSzSfUANt3KX5rjUHN0aAIkcaygpbfJ71AWXUa8GKQlcxl1xG/qodTPwllNaakeWjS+mWlTUGnGsbE3vbIHlQLa11gOlc4qnaTr+ZEBrW5RZ0dmOok+MRd+k96AX091JIyoOLp0bTkhInVGlrkpJGeLklIKlcusJ3zzxyr41Y="))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=Policy;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("eyJleHBpcmF0aW9uIjoiMjAyMi0wMS0yNFQyMzo1ODoxOVoiLCJjb25kaXRpb25zIjpbWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMCw1MDAwMDAwMF0seyJLZXkiOiIzNGRmNzU0MC0zYzI3LTRkOGQtOGIyNy0wY2EyMzUyNTJlNjIvZTgzMGM5YzAtODcwNS00OGZmLWJiZGItOWNmMDViYzI0YzBkLzBlLzBlMTIzNjk2LWMyMDktNDhhYi1iZmJmLThiNWVkMDBmMjEzNC5qcGcifSx7InN1Y2Nlc3NfYWN0aW9uX3N0YXR1cyI6IjIwMSJ9LHsiYnVja2V0IjoiYXJ0ZW1pcy1xYS1kb2N1bWVudHMtdXMtd2VzdC0yIn0seyJYLUFtei1BbGdvcml0aG0iOiJBV1M0LUhNQUMtU0hBMjU2In0seyJYLUFtei1DcmVkZW50aWFsIjoiQVNJQVpYUU1RT1ozTlM0Q0ZORzQvMjAyMjAxMjQvdXMtd2VzdC0yL3MzL2F3czRfcmVxdWVzdCJ9LHsiWC1BbXotRGF0ZSI6IjIwMjIwMTI0VDIzNTMxOVoifSx7IlgtQW16LVNlY3VyaXR5LVRva2VuIjoiSVFvSmIzSnBaMmx1WDJWakVGUWFDWFZ6TFhkbGMzUXRNaUpITUVVQ0lDZ0p0RHZG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b0paem8xNXVhd0NZNVQxVTNZNldRQlpFWmpZOTZnc2hMTXNWS1FZS1N6U2ZVQU50M0tYNXJqVUhOMGFBSWtjYXlncGJmSjcxQVdYVWE4R0tRbGN4bDF4Ry9xb2RUUHdsbE5hYWtlV2pTK21XbFRVR25Hc2JFM3ZiSUhsUUxhMTFnT2xjNHFuYVRyK1pFQnJXNVJaMGRtT29rK01SZCtrOTZBWDA5MUpJeW9PTHAwYlRraEluVkdscmtwSkdlTGtsSUtsY3VzSjN6enh5cjQxWT0ifV19"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=X-Amz-Signature;'))
dataList.append(encode('Content-Type: {}'.format('text/plain')))
dataList.append(encode(''))
dataList.append(encode("6395b80bcfd03730c078697e58a11302941ac39df4e545bfe372c60d05d0e228"))
dataList.append(encode('--' + boundary))
dataList.append(encode('Content-Disposition: form-data; name=file; filename={0}'.format('documents.jpg')))
fileType = mimetypes.guess_type('~/documents.jpg')[0] or 'application/octet-stream'
dataList.append(encode('Content-Type: {}'.format(fileType)))
dataList.append(encode(''))
with open('~/documents.jpg', 'rb') as f:
dataList.append(f.read())
dataList.append(encode('--'+boundary+'--'))
dataList.append(encode(''))
body = b'\r\n'.join(dataList)
payload = body
headers = {
'Content-type': 'multipart/form-data; boundary={}'.format(boundary)
}
conn.request("POST", "/artemis-qa-documents-us-west-2", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Sample success response from S3
<?xml version="1.0" encoding="UTF-8"?>
<PostResponse>
<Location>https://s3.us-west-2.amazonaws.com/artemis-qa-documents-us-west-2/34df7540-3c27-4d8d-8b27-0ca235252e62/e830c9c0-8705-48ff-bbdb-9cf05bc24c0d/0e/0e123696-c209-48ab-bfbf-8b5ed00f2134.jpg</Location>
<Bucket>artemis-qa-documents-us-west-2</Bucket>
<Key>34df7540-3c27-4d8d-8b27-0ca235252e62/e830c9c0-8705-48ff-bbdb-9cf05bc24c0d/0e/0e123696-c209-48ab-bfbf-8b5ed00f2134.jpg</Key>
<ETag>"f9092a7d80a82e18da7e2cb894a49676"</ETag>
</PostResponse>
Updated over 2 years ago