3.4. /api/v2/documents/add-document
Introduction
Add document is initiated through HTTPS POST request by using URL and the parameters specified below. OAuth HMAC-SHA1 is used for authentication (two-legged mode).
API URLs
Integration Base URL |
Production Base URL |
---|---|
https://sandbox.payneteasy.eu/paynet/api/v2/documents/add-document/ENDPOINTID/ORDERID |
https://gate.payneteasy.eu/paynet/api/v2/documents/add-document/ENDPOINTID/ORDERID |
Request Headers
Content-Type |
The request must contain this header with the following value: binary/octet-stream. |
Content-Length |
This header specifies correct file size in bytes. |
Authorization |
OAuth HMAC-SHA1 is used for authentication (two-legged mode). |
Request Parameters
Note
Request parameters |
Description |
Value |
---|---|---|
endpoint id |
Endpoint of the order. This parameter is passed in request URL. |
Necessity : RequiredType : NumericLength : 10 |
order id |
Transaction order identifier assigned by Payment Gateway. This parameter is passed in request URL. |
Necessity : RequiredType : StringLength : 128 |
consumer key |
Connecting Party’s login name. This parameter is used to calculate signature and is passed in Authorization request header as oauth_consumer_key. |
Necessity : RequiredType : StringLength : 20 |
consumer secret |
Connecting Party’s control key. This parameter is used to calculate signature as a part of Encryption key for OAuth HMAC-SHA1. |
Necessity : RequiredType : StringLength : 40 |
file name |
Name of the file to upload, e.g. filename.txt. This parameter is passed in the request body as file and in a query part of request URL as fileName. |
Necessity : RequiredType : StringLength : 255 |
comment. |
Adds a comment to attached file, accessible via pointing cursor on file in order details page. This parameter is passed in a query part of request URL. |
Necessity : OptionalType : StringLength : 255 |
file content |
Field for the contents of the file. Used to calculate only txt files via bytes per symbol. Use either file content or a combination of file sha1 and file size, not both. Mandatory, if file sha1 and file size fields are empty. This parameter is passed in the request body as a string. |
Necessity : ConditionalType : StringLength : 255 |
file sha1 |
Calculate sha1 of the file and insert here. Use either file content or a combination of file sha1 and file size, not both. Mandatory, if file content field is empty. This parameter is passed in base part of request URL, after order id parameter. |
Necessity : ConditionalType : StringLength : 255 |
file size |
Field for file size in bytes. Use either file content or a combination of file sha1 and file size, not both. Mandatory, if file content field is empty. This parameter is passed in Content-Length request header. |
Necessity : ConditionalType : StringLength : 255 |
Response Parameters
Note
Response Parameters |
Description |
---|---|
status |
May have values such as: success or error. Success means that document attached to order successfully. Error provides error-message. |
error-message |
If status is error this parameter contains the reason for decline or error details. |
Request Example
POST /paynet/api/v2/documents/add-document/6655/1852755/561d839dde5ae8deeced73c14902e04dc746bfc2?fileName=test5.txt&comment=no%20comments HTTP/1.1
Host: sandbox.payneteasy.eu
User-Agent: curl/7.83.0
Accept: */*
Content-Type: binary/octet-stream
Content-Length: 7
Authorization: OAuth realm="",oauth_signature_method="HMAC-SHA1",oauth_signature="ItDxdBQtPRqLiKTAOdy%2BAtDB5cI%3D"
Connection: close
Success Response Example
HTTP/1.1 200
Server: server
Date: Tue, 18 Jul 2023 06:10:27 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 14
Connection: close
X-XSS-Protection: 1
Strict-Transport-Security: max-age=31536000
Content-Language: en-US
Strict-Transport-Security: max-age=31536000
status=success
Fail Response Example
HTTP/1.1 200
Server: server
Date: Tue, 18 Jul 2023 07:37:34 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 46
Connection: close
X-XSS-Protection: 1
Strict-Transport-Security: max-age=31536000
Content-Language: en-US
Strict-Transport-Security: max-age=31536000
status=error
&error-message=File+hash+mismatch
Request Builder
signature base string |
---|
signature |
---|
authorization header |
---|
|