Upload Invoice
Upload an invoice or AWB document against a captured PayOrc transaction via the Open API transaction documents endpoint.
Upload Invoice / AWB
Version: 3.0.0
Upload your invoice or shipment (AWB) document after a successful payment. This is required to verify your transaction and comply with government and RBI regulations for cross-border or export payments.
Prerequisite: Use a captured PayOrc transaction_id — transaction type must be CAPTURE, PARTIALLY_CAPTURE, or SALE with status AUTHORISED (not voided). Auth-only (AUTH) transactions are rejected. For PayU, the MID must be PACB-enabled.
When and Why to Use
Use the Transaction Document Upload API to attach supporting documents to a settled transaction:
- Invoice upload — Attach a commercial invoice after capture (required for cross-border / export / PACB compliance).
- AWB upload — Attach an airway bill / shipment document reference against the same order.
- Order records — Keep merchant document references linked to the PayOrc
transaction_idfor reconciliation and regulatory verification.
Capture first: Document upload is available only after funds are captured (or the order was a SALE). Do not call this API on a pure authorization.
Endpoint
Unlike Capture / Void / Refund, document upload uses a dedicated multipart endpoint (not action on /transaction).
| Method | URL |
|---|---|
| POST | https://api.payorc.com/orders/v1/transaction/documents |
Please use the test credentials for sandbox testing.
Headers
| Field | Type | Required | Description |
|---|---|---|---|
merchant-key | String | Yes | Your merchant API key |
merchant-secret | String | Yes | Your merchant API secret |
Content-Type | String | No | Multipart boundary is set automatically by the client; do not send application/json |
Request Body
The request body must be sent as multipart/form-data.
| Field | Type | Required | Description |
|---|---|---|---|
transaction_id | String | Yes | PayOrc transaction ID of a captured transaction (CAPTURE / PARTIALLY_CAPTURE / SALE) |
document_type | String | Yes | INVOICE or AWB (case-insensitive; normalized to uppercase) |
document_ref | String | Yes | Merchant invoice number or AWB reference. Min 3, max 100 characters. |
file | File | Yes | Document file (field name must be file) |
Validations
| Rule | Detail |
|---|---|
| Ownership | transaction_id must belong to the authenticated merchant |
| Transaction state | Type ∈ CAPTURE, PARTIALLY_CAPTURE, SALE; status AUTHORISED; not voided |
document_type | Only INVOICE or AWB |
document_ref | Required; minimum 3, maximum 100 characters |
| File presence | file part is required |
| File types | .pdf, .doc, .docx, .jpg, .jpeg only (PNG not allowed) |
| File size | Maximum 2 MB |
| Invoice duplicate | At most one INVOICE per order |
| AWB duplicate | Same document_ref cannot be uploaded twice as AWB for the same order |
| PayU PACB | PayU MIDs must have PACB enabled (is_pacb = 1) |
Code Examples
Example 1 — Upload Invoice
curl --location 'https://api.payorc.com/orders/v1/transaction/documents' \
--header 'merchant-key: {merchant-key}' \
--header 'merchant-secret: {merchant-secret}' \
--form 'transaction_id="1000063438"' \
--form 'document_type="INVOICE"' \
--form 'document_ref="INV-123456"' \
--form 'file=@"/path/to/invoice.pdf"'Example 2 — Upload AWB
curl --location 'https://api.payorc.com/orders/v1/transaction/documents' \
--header 'merchant-key: {merchant-key}' \
--header 'merchant-secret: {merchant-secret}' \
--form 'transaction_id="1000063438"' \
--form 'document_type="AWB"' \
--form 'document_ref="AWB-987654"' \
--form 'file=@"/path/to/awb.pdf"'File upload: Replace the local path with your invoice or AWB file. Allowed extensions: .pdf, .doc, .docx, .jpg, .jpeg.
Example 3 — Node.js
const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');
const form = new FormData();
form.append('transaction_id', '1000063438');
form.append('document_type', 'INVOICE');
form.append('document_ref', 'INV-123456');
form.append('file', fs.createReadStream('/path/to/invoice.pdf'));
axios({
method: 'post',
url: 'https://api.payorc.com/orders/v1/transaction/documents',
headers: {
'merchant-key': '{merchant-key}',
'merchant-secret': '{merchant-secret}',
...form.getHeaders()
},
data: form
})
.then(response => console.log(JSON.stringify(response.data)))
.catch(error => console.log(error.response?.data || error));Example 4 — Python
import requests
import json
url = 'https://api.payorc.com/orders/v1/transaction/documents'
headers = {
'merchant-key': '{merchant-key}',
'merchant-secret': '{merchant-secret}'
}
data = {
'transaction_id': '1000063438',
'document_type': 'INVOICE',
'document_ref': 'INV-123456'
}
with open('/path/to/invoice.pdf', 'rb') as f:
files = {'file': f}
response = requests.post(url, headers=headers, data=data, files=files)
print(json.dumps(response.json(), indent=2))Response — Success (200)
{
"status": "success",
"code": "00",
"message": "Uploaded Successfully",
"data": {
"m_order_id": "ORD-2024-001",
"p_order_id": 1000063400,
"transaction_id": "1000063438",
"document_type": "INVOICE",
"document_ref": "INV-123456",
"psp": "PAYU",
"file_name": "doc-1712345678-123456789.pdf"
}
}| Field | Description |
|---|---|
status | success |
code | 00 on success |
message | Human-readable outcome (e.g. Uploaded Successfully) |
data.m_order_id | Merchant order ID |
data.p_order_id | PayOrc order ID |
data.transaction_id | Captured transaction ID used for upload |
data.document_type | INVOICE or AWB |
data.document_ref | Merchant document reference |
data.psp | PSP that processed the upload (e.g. PAYU) |
data.file_name | Stored file name |
Response — Validation Error (400)
Returned by the Open API layer when request validation fails (before PSP upload).
{
"message": "Document upload requires a captured transaction_id (CAPTURE / PARTIALLY_CAPTURE / SALE). AUTH transactions are not allowed.",
"status": "fail",
"code": "E0044"
}Other common validation messages:
| Message | Cause |
|---|---|
Transaction id is not valid/not supplied | Missing / empty transaction_id |
document_type must be INVOICE or AWB | Invalid document_type |
document_ref is not valid/not supplied (min 3, max 100 characters) | Missing document_ref, shorter than 3, or longer than 100 characters |
File is required | No file part |
Invalid transaction id | Unknown or not owned by merchant |
Invalid file type. Only PDF, DOC, DOCX, JPG, and JPEG files are allowed. | Unsupported extension (e.g. PNG) |
File too large / multer limit | File exceeds 2 MB |
Response — Processing Error
Returned when the upload reaches connector processing (PSP / business rules). status is failed and code is the document-upload response code.
{
"status": "failed",
"code": "102",
"message": "Invalid Transaction Status",
"data": null
}Duplicate invoice example:
{
"status": "failed",
"code": "201",
"message": "Invoice already uploaded",
"data": {
"document_type": "INVOICE",
"document_ref": "INV-123456",
"p_order_id": 1000063400
}
}Response Codes
| Code | Message | When |
|---|---|---|
00 | Uploaded Successfully | Document accepted and stored |
101 | Invalid Format | File is not pdf/doc/docx/jpg/jpeg |
102 | Invalid Transaction Status | Transaction is not in a captured eligible state |
103 | Failed to Upload | PSP / internal upload failure |
104 | Invalid upload type | document_type not INVOICE or AWB |
105 | Not an PACB merchant, contact KAM | PayU MID is not PACB |
106 | Size exceeding 5 MB | File too large (PayOrc enforces 2 MB) |
107 | Invalid PayU ID | PSP payment reference missing / invalid |
108 | Empty Invoice/AWB ID | Missing document_ref |
109 | Empty file name | Mandatory file / fields missing |
201 | Invoice already uploaded | Invoice already exists for this order |
202 | AWB already uploaded for this reference | Same AWB document_ref already exists |
203 | Document upload not supported for this PSP | No driver for the order PSP |
204 | Order not found | Order / transaction could not be resolved |
205 | Terminal credentials not found | MID credentials missing for the terminal |
Document Upload Flow
CAPTURE / SALE completed
|
v
transaction_id (captured)
|
v
Prepare invoice or AWB file
|
v
POST /orders/v1/transaction/documents
(multipart: transaction_id, document_type, document_ref, file)
|
v
Open API validates merchant ownership + captured state
|
v
PayOrc stores document + forwards to PSP (e.g. PayU)
|
v
Success (00) or failed response code- Complete payment and ensure the transaction is captured (or
SALE). - Prepare the invoice or AWB file (≤ 2 MB; allowed types only).
- Call
POST /orders/v1/transaction/documentswith merchant credentials. - On success (
code: "00"), the document is associated with the order and available in console transaction details.
Important Notes
- Use
multipart/form-data— this is not the JSON Capture/Void/Refund body. document_refis required (invoice number or AWB id) and must be 3–100 characters.- One invoice per order; multiple AWB uploads are allowed if each
document_refis unique. - Do not hard-code
merchant-secretin client-side apps. - Use sandbox credentials when testing.
Related APIs
- Capture — Capture an authorization before uploading documents
- Fetch Order — Confirm transaction state and IDs
- Refund — Post-capture refunds (separate from document upload)
API Summary
| Aspect | Details |
|---|---|
| API | Transaction Document Upload |
| Method | POST |
| Content Type | multipart/form-data |
| Endpoint | /orders/v1/transaction/documents |
| Authentication | merchant-key + merchant-secret |
| Required Parameters | transaction_id, document_type, document_ref, file |
Allowed document_type | INVOICE, AWB |
| Allowed file types | PDF, DOC, DOCX, JPG, JPEG |
| Max file size | 2 MB |
| Eligible txn types | CAPTURE, PARTIALLY_CAPTURE, SALE |
| Primary Use Case | Attach invoice / AWB to captured transactions |