PayOrc
Manage Payment

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:

  1. Invoice upload — Attach a commercial invoice after capture (required for cross-border / export / PACB compliance).
  2. AWB upload — Attach an airway bill / shipment document reference against the same order.
  3. Order records — Keep merchant document references linked to the PayOrc transaction_id for 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).

MethodURL
POSThttps://api.payorc.com/orders/v1/transaction/documents

Please use the test credentials for sandbox testing.


Headers

FieldTypeRequiredDescription
merchant-keyStringYesYour merchant API key
merchant-secretStringYesYour merchant API secret
Content-TypeStringNoMultipart boundary is set automatically by the client; do not send application/json

Request Body

The request body must be sent as multipart/form-data.

FieldTypeRequiredDescription
transaction_idStringYesPayOrc transaction ID of a captured transaction (CAPTURE / PARTIALLY_CAPTURE / SALE)
document_typeStringYesINVOICE or AWB (case-insensitive; normalized to uppercase)
document_refStringYesMerchant invoice number or AWB reference. Min 3, max 100 characters.
fileFileYesDocument file (field name must be file)

Validations

RuleDetail
Ownershiptransaction_id must belong to the authenticated merchant
Transaction stateType ∈ CAPTURE, PARTIALLY_CAPTURE, SALE; status AUTHORISED; not voided
document_typeOnly INVOICE or AWB
document_refRequired; minimum 3, maximum 100 characters
File presencefile part is required
File types.pdf, .doc, .docx, .jpg, .jpeg only (PNG not allowed)
File sizeMaximum 2 MB
Invoice duplicateAt most one INVOICE per order
AWB duplicateSame document_ref cannot be uploaded twice as AWB for the same order
PayU PACBPayU 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"
    }
}
FieldDescription
statussuccess
code00 on success
messageHuman-readable outcome (e.g. Uploaded Successfully)
data.m_order_idMerchant order ID
data.p_order_idPayOrc order ID
data.transaction_idCaptured transaction ID used for upload
data.document_typeINVOICE or AWB
data.document_refMerchant document reference
data.pspPSP that processed the upload (e.g. PAYU)
data.file_nameStored 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:

MessageCause
Transaction id is not valid/not suppliedMissing / empty transaction_id
document_type must be INVOICE or AWBInvalid 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 requiredNo file part
Invalid transaction idUnknown 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 limitFile 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

CodeMessageWhen
00Uploaded SuccessfullyDocument accepted and stored
101Invalid FormatFile is not pdf/doc/docx/jpg/jpeg
102Invalid Transaction StatusTransaction is not in a captured eligible state
103Failed to UploadPSP / internal upload failure
104Invalid upload typedocument_type not INVOICE or AWB
105Not an PACB merchant, contact KAMPayU MID is not PACB
106Size exceeding 5 MBFile too large (PayOrc enforces 2 MB)
107Invalid PayU IDPSP payment reference missing / invalid
108Empty Invoice/AWB IDMissing document_ref
109Empty file nameMandatory file / fields missing
201Invoice already uploadedInvoice already exists for this order
202AWB already uploaded for this referenceSame AWB document_ref already exists
203Document upload not supported for this PSPNo driver for the order PSP
204Order not foundOrder / transaction could not be resolved
205Terminal credentials not foundMID 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
  1. Complete payment and ensure the transaction is captured (or SALE).
  2. Prepare the invoice or AWB file (≤ 2 MB; allowed types only).
  3. Call POST /orders/v1/transaction/documents with merchant credentials.
  4. 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_ref is required (invoice number or AWB id) and must be 3–100 characters.
  • One invoice per order; multiple AWB uploads are allowed if each document_ref is unique.
  • Do not hard-code merchant-secret in client-side apps.
  • Use sandbox credentials when testing.

  • Capture — Capture an authorization before uploading documents
  • Fetch Order — Confirm transaction state and IDs
  • Refund — Post-capture refunds (separate from document upload)

API Summary

AspectDetails
APITransaction Document Upload
MethodPOST
Content Typemultipart/form-data
Endpoint/orders/v1/transaction/documents
Authenticationmerchant-key + merchant-secret
Required Parameterstransaction_id, document_type, document_ref, file
Allowed document_typeINVOICE, AWB
Allowed file typesPDF, DOC, DOCX, JPG, JPEG
Max file size2 MB
Eligible txn typesCAPTURE, PARTIALLY_CAPTURE, SALE
Primary Use CaseAttach invoice / AWB to captured transactions

On this page