Upload a supporting document
curl --request POST \
--url https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/ \
--header 'Content-Type: multipart/form-data' \
--header 'X-Client-ID: <api-key>' \
--header 'X-Client-Secret: <api-key>' \
--header 'X-Merchant-ID: <api-key>' \
--form file=@example-file \
--form type=offer_letterimport requests
url = "https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "type": "offer_letter" }
headers = {
"X-Client-ID": "<api-key>",
"X-Client-Secret": "<api-key>",
"X-Merchant-ID": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('type', 'offer_letter');
const options = {
method: 'POST',
headers: {
'X-Client-ID': '<api-key>',
'X-Client-Secret': '<api-key>',
'X-Merchant-ID': '<api-key>'
}
};
options.body = form;
fetch('https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\noffer_letter\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-Client-ID: <api-key>",
"X-Client-Secret: <api-key>",
"X-Merchant-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\noffer_letter\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-Client-Secret", "<api-key>")
req.Header.Add("X-Merchant-ID", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/")
.header("X-Client-ID", "<api-key>")
.header("X-Client-Secret", "<api-key>")
.header("X-Merchant-ID", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\noffer_letter\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-ID"] = '<api-key>'
request["X-Client-Secret"] = '<api-key>'
request["X-Merchant-ID"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\noffer_letter\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Document uploaded",
"data": {
"ref": "8207383264",
"type": "offer_letter"
}
}B2B Services
Upload Document
Upload a B2B services file — the commercial invoice, or a delivery proof — and get back a ref.
POST
/
pg
/
payments
/
{payment_id}
/
documents
/
Upload a supporting document
curl --request POST \
--url https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/ \
--header 'Content-Type: multipart/form-data' \
--header 'X-Client-ID: <api-key>' \
--header 'X-Client-Secret: <api-key>' \
--header 'X-Merchant-ID: <api-key>' \
--form file=@example-file \
--form type=offer_letterimport requests
url = "https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "type": "offer_letter" }
headers = {
"X-Client-ID": "<api-key>",
"X-Client-Secret": "<api-key>",
"X-Merchant-ID": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('type', 'offer_letter');
const options = {
method: 'POST',
headers: {
'X-Client-ID': '<api-key>',
'X-Client-Secret': '<api-key>',
'X-Merchant-ID': '<api-key>'
}
};
options.body = form;
fetch('https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\noffer_letter\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"X-Client-ID: <api-key>",
"X-Client-Secret: <api-key>",
"X-Merchant-ID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\noffer_letter\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-ID", "<api-key>")
req.Header.Add("X-Client-Secret", "<api-key>")
req.Header.Add("X-Merchant-ID", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/")
.header("X-Client-ID", "<api-key>")
.header("X-Client-Secret", "<api-key>")
.header("X-Merchant-ID", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\noffer_letter\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-pacb-uat.eximpe.com/pg/payments/{payment_id}/documents/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-ID"] = '<api-key>'
request["X-Client-Secret"] = '<api-key>'
request["X-Merchant-ID"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\noffer_letter\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Document uploaded",
"data": {
"ref": "8207383264",
"type": "offer_letter"
}
}Overview
Uploads one file for a B2B services payment and answers with aref. What you do with that ref depends on which of the two document steps you are in:
| You uploaded | You then | With |
|---|---|---|
| the commercial invoice | send the ref under its checklist code | Submit Verification Details |
| a delivery proof | send the ref in the settlement submission | Submit Settlement Documents |
{ "documents": [{ "code": "invoice", "ref": "8207383264" }] }
Two calls, not one. Uploading stores the file and returns its
ref. Send that ref under invoice on Submit Verification Details. Get Verification Requirements shows invoice satisfied as soon as an invoice is uploaded, unless EximPe rejected it.Classify the payment first
Thetype you may send depends on which flow the payment is in, so the payment has to be in one. A VBA credit arrives unclassified, and until you have sent its business_model and purpose_code through Submit Verification Details an upload is refused:
{
"success": false,
"error": {
"code": 40359,
"message": "Invalid verification request.",
"details": "Invalid verification request. This payment has no verification checklist, so there is no set of document types to accept; send the order's business model and purpose code first."
}
}
The message names no flow, because there is not one yet. Every other refusal on a classified services payment reads
Invalid B2B services request. This one cannot: the classification is exactly what is missing, so naming a flow would be a guess. The code is 40359 either way.The request
multipart/form-data, two parts:
| Part | |
|---|---|
file | The document itself. |
type | What kind of document it is — one of the two codes below. |
The settling merchant is derived from the payment, exactly as on the verification endpoints — the sub-merchant named on the order, not the credential that uploaded the file.
Document types
B2B services uses two, and takes no others:type | Where it goes | |
|---|---|---|
invoice | Commercial invoice | The verification checklist |
delivery_proof | Evidence the service was delivered — a signed acceptance note, a milestone sign-off, a delivery confirmation, a timesheet | The post-settlement document set |
type decides where the file is stored, so it also decides which call can cite the resulting ref: an invoice ref is citable on Submit Verification Details, a delivery_proof ref in refs on Submit Settlement Documents. Cite one on the other call and it reads as unknown — ERR_B2B_SETTLEMENT_001 on the settlement submit, Unknown document ref. on the verification one.
A type outside these two — including document codes other flows define, such as passport — is refused:
{
"success": false,
"error": {
"code": 40359,
"message": "Invalid B2B services request.",
"details": { "type": "Unknown document type for this payment's flow; send one of: delivery_proof, invoice." }
}
}
delivery_proof is not a checklist item. It never appears in Get Verification Requirements, because it is owed after settlement rather than before it. Do not go looking for it there.The file
Validated on upload, so a bad file fails here rather than at submit time.| Extensions | pdf · png · jpg · jpeg · docx · xlsx · csv |
| Maximum size | 10 MB |
| Maximum file name | 100 characters, extension included |
| Encrypted PDFs | Rejected — a password-protected file cannot be read by anyone who has to review it |
400 reading Uploaded file is not a supported type or exceeds the allowed size.:
| Cause | code |
|---|---|
| The file’s extension or content is not an accepted type, or the PDF is encrypted. | ERR_B2B_SERVICES_007 for an invoice, ERR_B2B_SETTLEMENT_006 for a delivery_proof |
The response
201, with the ref:
{
"success": true,
"message": "Document uploaded",
"data": {
"ref": "8207383264",
"type": "invoice"
}
}
The stored document’s identifier. Send it as
documents[].ref on the verification submit, or in refs on the settlement submit.The file is stored against the payment in the path, so the ref is only citable from that payment. A ref from one of your other payments reads as unknown, exactly as a made-up one does — the answer never distinguishes the two.Uploading more than one
Both types accumulate. Every upload adds its own row and returns its ownref; nothing supersedes anything, and an earlier ref stays valid.
Invoices. A payment may carry several — an amended invoice beside the original, or a job billed across two. You only cite the invoice code once on Submit Verification Details; the citation names the code, so every invoice on the payment is filed when the set completes. A second invoice needs no citation of its own.
There is no way to remove an invoice you uploaded by mistake. It stays on the payment and is filed with the rest. Upload only what you want ops to see.
refs on that call is the whole set — a proof you would rather not file is one you leave out, and it is dropped. That is the settlement step’s way of undoing an upload; the verification step has no equivalent.
Once the settlement set is submitted it is locked. A further delivery_proof upload is refused with ERR_B2B_SETTLEMENT_002.
No waivers on this flow
Some checklists let a document be discharged with awaiver_reason instead of a file. The B2B services checklist has no waivable item — the commercial invoice is required, and there is nothing to waive. A waiver_reason sent on this flow is a 400.
Related
Get Verification Requirements
What this payment actually needs.
Submit Verification Details
Where the
ref is bound to a checklist code.Submit Settlement Documents
Where
delivery_proof refs are filed, after settlement.B2B Services Verification
The whole flow, in order.
Authorizations
Headers
Body
multipart/form-data
Document type — one of the codes the checklists ask for, so the value you upload under is the value you submit under. Read the ones this payment actually needs from Get Verification Requirements rather than mapping this list into your code: it is the complete set any checklist can ask for, and it grows as the regulatory matrix is revised. delivery_proof is the one type here that no checklist asks for: it is a post-settlement compliance document, uploaded through this endpoint and then filed by ref through Submit post-settlement documents.
Available options:
offer_letter, passport, student_id_or_visa, student_id, fee_invoice, invoice, relationship_declaration, delivery_proof Example:
"offer_letter"