Syntax

POST /api/payment-instructions/load/

    … with the payment instruction file for upload passed in. the request body.

The user performing this request must be authorized to upload Payment Instruction Files.

Example:

POST /api/payment-instructions/load/ HTTP/1.1
Host: sandbox.paymentworks.com
Authorization: Token 5e4eXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1ba
Content-Length: 221
Content-Type: multipart/form-data;
boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data;
name="payment-instructions";
filename="test-payment-instruction-file.txt"
Content-Type: text/plain

(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW--

See sections below for examples of how to make PIF upload API requests via Postman or cURL.

Request Headers and Body

The payment instruction file for upload must be provided in the request body under the key name payment-instructions.

To be able to provide a file here, the Content-Type must be set to multipart/form-data

This authorized user’s API token must also be included in the request header.

Request Parameters

This API does not take any parameters.

Success Codes

HTTP Status CodeExceptionDescription
200SuccessA successful PIF upload will return a 200 Status Code and JSON response body that indicates a success status and the name of the uploaded file.

Response

Returns a JSON object with information pertaining to the upload attempt.

Examples:

Successful Response

{
"status":"ok",
"file_name":"test_payment_instruction_file.txt",
"job_id":"2-2b9e41f0003d47d9aa1831a821e95274"
}

Errored Response

{
"status": "error",
"error": "User does not have permission to upload payment instruction files"
}

The important response fields include:

KeyTypeSample ValueDescription
statusStringok
error
Single word indication of PIF upload success/failure.
file_nameStringtest_payment_instruction_file.txt

test_encrypted_pif.pgp.decrypted

The name of the successfully uploaded file.
Encrypted PIFs will be decrypted on upload, so the returned filename will have the .decrypted suffix.
errorStringUser does not have permission to upload payment instruction files.A more specific error message indicating what went wrong, included in the response if the request did not succeed.

Error Codes

HTTP Status CodeExceptionDescription
400Bad RequestThe request could not be understood by the server due to incorrect syntax.
401UnauthenticatedThe request requires user authentication information. Your API token is missing or invalid.
403ForbiddenUnauthorized request. The client does not have access rights to the content. Unlike 401, the client’s identity is known to the server.
404Not FoundThe API that you requested does not exist on this server.
500
Service UnavailableThe server encountered an unexpected condition that prevented it from fulfilling the request.
503Service UnavailableThe request has failed due to a temporary failure of the server. You can try this request at a later time.

Calling the API