Skip to main content

Affiliated Payments

This section covers the API endpoints for managing affiliated payments in the admin panel.

List Affiliated Payments

GET /v1/admin/customers/{id}/affiliated-payments

Returns a list of affiliated payments for a specific affiliate marketer.

Query Parameters

ParameterTypeDescriptionValidation Rules
search_textstringSearch in payment numberOptional
per_pageintegerNumber of items per pageOptional, default: 10

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://192.168.0.139:8080/v1/admin/customers/915438f8-dd7a-41de-9c94-d7539c3098dd/affiliated-payments?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://192.168.0.139:8080/v1/admin/customers/915438f8-dd7a-41de-9c94-d7539c3098dd/affiliated-payments?page=1",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/customers/915438f8-dd7a-41de-9c94-d7539c3098dd/affiliated-payments?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "التالي »",
"active": false
}
],
"next_page_url": null,
"path": "http://192.168.0.139:8080/v1/admin/customers/915438f8-dd7a-41de-9c94-d7539c3098dd/affiliated-payments",
"per_page": 10,
"prev_page_url": null,
"to": 2,
"total": 2,
"affiliated_payments": [
{
"id": "427b56c0-0586-11f0-b2a8-cbec67fc84d3",
"number": 2503000029,
"amount": "420.00",
"receipts": [
"http://192.168.0.139:8080/storage/28999/Screenshot-from-2025-02-24-13-39-01.png"
],
"first_receipts": "/storage/28999/Screenshot-from-2025-02-24-13-39-01.png",
"notes": "عجيب",
"created_at": "20/03/2025"
},
{
"id": "9ce8cd30-9cfe-11ef-92cf-57f20957d76f",
"number": 2411000022,
"amount": "3815.34",
"receipts": [
"http://192.168.0.139:8080/storage/26522/ريم-عبدالله.jpg"
],
"first_receipts": "http://192.168.0.139:8080/storage/26522/ريم-عبدالله.jpg",
"notes": null,
"created_at": "07/11/2024"
}
]
},
"status_code": 200
}

Get Payment Statistics

GET /v1/admin/statistics/affiliated-payments

Returns payment statistics for a specific affiliate marketer.

Query Parameters

ParameterTypeDescriptionValidation Rules
customer_idstringID of the affiliate marketerRequired

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"total_earnings": 6514.26,
"total_paid": 3815.34,
"total_unpaid": 2698.92
},
"status_code": 200
}

Create Affiliated Payment

POST /v1/admin/affiliated-payments

Creates a new affiliated payment for a specific affiliate marketer.

Request Body

ParameterTypeDescriptionValidation Rules
customer_idstringID of the affiliate marketerRequired
amountnumberPayment amountRequired
numberstringPayment reference numberRequired
receiptsarrayArray of receipt filesRequired

Response

{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "427b56c0-0586-11f0-b2a8-cbec67fc84d3",
"number": "2503000029",
"amount": "420",
"receipts": [
"http://192.168.0.139:8080/storage/28999/Screenshot-from-2025-02-24-13-39-01.png"
],
"first_receipts": "/storage/28999/Screenshot-from-2025-02-24-13-39-01.png",
"notes": "عجيب",
"created_at": "20/03/2025"
},
"status_code": 200
}

Get Affiliated Payment Details

GET /v1/admin/affiliated-payments/{id}

Returns details of a specific affiliated payment.

Response

{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "427b56c0-0586-11f0-b2a8-cbec67fc84d3",
"number": 2503000029,
"amount": "420.00",
"receipts": [
"http://192.168.0.139:8080/storage/28999/Screenshot-from-2025-02-24-13-39-01.png"
],
"first_receipts": "/storage/28999/Screenshot-from-2025-02-24-13-39-01.png",
"notes": "عجيب",
"created_at": "20/03/2025"
},
"status_code": 200
}

Export Affiliated Payments

GET /v1/admin/customers/{id}/export-affiliated-payments

Exports affiliated payments for a specific affiliate marketer to an Excel file.

Response

Downloads an Excel file named MarkterAffiliatePaymentExport-{full_name}.xlsx containing the payment details.

Notes

  • The list endpoint supports pagination and search functionality
  • Results are sorted by creation date in descending order by default
  • Only users with the 'affiliate_marketer' role can access their payment data
  • Payment amount cannot exceed the unpaid earnings amount
  • The system automatically updates the marketer's total sales and unpaid amounts after each payment