Skip to content

Partner Payments API

API endpoints for the Partner Payments module. All endpoints require JWT authentication (token_admin) and are prefixed with /partner-payments.

Authentication

All endpoints require a valid admin JWT:

Authorization: Bearer <token>

Access is restricted by permission (see Auth column per endpoint).

Endpoints Summary

MethodPathDescriptionAuth
GET/partner-paymentsList partner payments with filters and paginationview-partner-payments
GET/partner-payments/{payment}/detailsGet payment detail rows (e.g. by shipment)view-partner-payments
PUT/partner-payments/{id}/payExecute commission payment (EcartPay)pay-partners-payments
PUT/partner-payments/{id}/rejectReject commission paymentpay-partners-payments
GET/partner-payments/{paymentId}/documentsGet documents for a paymentview-partner-payments
PATCH/partner-payments/{paymentId}/documents/{documentId}/approveApprove a documentview-partner-payments
PATCH/partner-payments/{paymentId}/documents/{documentId}/rejectReject a documentpay-partners-payments
PATCH/partner-payments/{id}/mark-as-paidMark payment as paid with datepartners-payments-mark-as-a-paid
PATCH/partner-payments/{id}/send-to-internal-reviewSend payment to internal reviewpay-partners-payments

Payment Status Values

Valid payment_status values used in filters and responses:

  • generated
  • payment_requested
  • documents_rejected
  • approved_for_payment
  • under_review
  • payment_rejected
  • paid
  • manually-paid

GET /partner-payments

List partner payments with optional filters and pagination. Response shape is determined by the backend (typically paginated list with payment and partner fields).

Query Parameters

ParamTypeRequiredDescription
startnumberNoPagination offset (default: 0)
lengthnumberNoPage size (default: 100)
sortBystringNoSort field
sortTypestringNoasc or desc
reportbooleanNoIf true, stream full dataset (start=0, length=1000)
partner_idnumberNoFilter by partner ID
startDatestringNoFilter by period start
endDatestringNoFilter by period end
idnumberNoFilter by payment ID
statusstringNoFilter by status
payment_statusstringNoOne of the payment status values above
referencestringNoFilter by reference
company_idnumberNoFilter by company ID
userIdnumberNoFilter by user ID
namestringNoFilter by user name (LIKE)

Response (200)

Structure is backend-defined; typically includes data (array of payment objects with partner/user/company fields), pagination/draw fields, and optional streaming when report=true.

Errors

CodeDescription
400Validation failed (query params)
401Missing or invalid JWT
403Insufficient permissions

GET /partner-payments/{payment}/details

Returns detail rows for a given payment (e.g. shipment-level breakdown).

Path Parameters

ParamTypeDescription
paymentnumberPayment ID

Query Parameters

ParamTypeRequiredDescription
startnumberNoPagination offset
lengthnumberNoPage size
sortBystringNoSort field
sortTypestringNoSort direction
reportbooleanNoIf true, stream full dataset
partner_idnumberNoFilter by partner ID
carrierstringNoFilter by carrier (LIKE)
idnumberNoFilter by detail ID

Response (200)

Backend-defined; typically an array of detail records (e.g. shipments, amounts) for the payment.


PUT /partner-payments/{id}/pay

Executes the commission payment flow (EcartPay) for a payment in approved_for_payment status. Required documents must be approved.

Path Parameters

ParamTypeDescription
idnumberPayment ID

Request Body

json
{}

Or with optional field:

json
{
    "comments": "Optional (reserved / future use)"
}
FieldTypeRequiredDescription
commentsstringNoOptional string

Response (200)

{ "success": true } on success.

Errors

CodeDescription
400Invalid payload or state
401Missing or invalid JWT
403Insufficient permissions
404Payment not found

PUT /partner-payments/{id}/reject

Rejects the commission payment after approved_for_payment. Sets payment_status to documents_rejected, clears approved_for_payment_at, stores comments, and resets all partner_payment_documents rows for that payment that were approved or rejected back to pending (clears rejection_reason, reviewed_by, reviewed_at) so the document validation flow can run again. Same eligibility rules as pay (approved_for_payment, partner account, cutoff date).

Path Parameters

ParamTypeDescription
idnumberPayment ID

Request Body

json
{
    "comments": "Optional rejection comments"
}
FieldTypeRequiredDescription
commentsstringNoShown to the partner

Response (200)

{ "success": true } on success. A Slack message is sent to SLACK_ALERT_CHANNEL (same block layout as “approved for payment”, plus rejection reason); mentions use SLACK_PARTNER_PAYMENT_MENTIONS.commissionPaymentRejected per environment (backend/constants/partnerPayments.js).

Errors

CodeDescription
400Invalid payload or state
401Missing or invalid JWT
403Insufficient permissions
404Payment not found

GET /partner-payments/{paymentId}/documents

Get the list of documents associated with a partner payment.

Path Parameters

ParamTypeDescription
paymentIdnumberPayment ID (integer)

Response (200)

Backend-defined list of document records (e.g. id, type, status, file reference).


PATCH /partner-payments/{paymentId}/documents/{documentId}/approve

Approve a document for the given payment.

Allowed only when the payment’s payment_status is one of: payment_requested, documents_rejected, under_review, payment_rejected.

Path Parameters

ParamTypeDescription
paymentIdnumberPayment ID (integer)
documentIdnumberDocument ID (integer)

Response (200)

Backend-defined success payload. Slack notification may be sent when the payment reaches an approved state.


PATCH /partner-payments/{paymentId}/documents/{documentId}/reject

Reject a document. Requires a rejection reason. Same allowed payment_status values as document approve (including payment_rejected).

Path Parameters

ParamTypeDescription
paymentIdnumberPayment ID (integer)
documentIdnumberDocument ID (integer)

Request Body

json
{
    "rejection_reason": "Required reason text"
}
FieldTypeRequiredDescription
rejection_reasonstringYesReason for rejection

Response (200)

Backend-defined success payload. An email is sent to the partner user (default template) with the document type name and rejection_reason. Translation keys: partners.mail.documentRejected.* (see documentation/translations/partner-mail-document-rejected-keys.md).

Errors

CodeDescription
400Missing or invalid rejection_reason
401Missing or invalid JWT
403Insufficient permissions
404Payment or document not found

PATCH /partner-payments/{id}/mark-as-paid

Mark a partner payment as paid and set the paid date. Used when payment was made outside the system.

Path Parameters

ParamTypeDescription
idnumberPayment ID (integer)

Request Body

json
{
    "paid_at": "2026-03-15T12:00:00Z"
}
FieldTypeRequiredDescription
paid_atstringYesISO date/time when the payment was made

Response (200)

Backend-defined success payload. A Slack “commissions paid” notification may be sent.

Errors

CodeDescription
400Invalid or missing paid_at
401Missing or invalid JWT
403Insufficient permissions
404Payment not found

PATCH /partner-payments/{id}/send-to-internal-review

Send a payment to internal review. Requires comments.

Path Parameters

ParamTypeDescription
idnumberPayment ID (integer)

Request Body

json
{
    "comments": "Reason or notes for internal review"
}
FieldTypeRequiredDescription
commentsstringYesComments for the internal review

Response (200)

Backend-defined success payload.

Errors

CodeDescription
400Missing or invalid comments
401Missing or invalid JWT
403Insufficient permissions
404Payment not found

Common Error Responses

Errors follow the Boom format:

json
{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "Descriptive error message"
}
StatusWhen
400Validation failed (Joi) or business rule
401Missing or invalid JWT
403User lacks required permission
404Payment or document not found

Envia Admin