Skip to content

User - Payments

Base URL: https://your-domain.com

Admin endpoints for managing payments. All endpoints require admin/staff authentication.


Fetch All Payments

Retrieve a paginated list of all payment transactions. Returns payment data with action by user, user data, and subscriber with salesperson information.

PropertyValue
EndpointFetch All Payments
MethodGET
URL/api/v1/payments
AuthenticationBearer Token

Request Headers:

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

Query Parameters:

Required Parameters

ParameterTypeRequiredDescription
isp_idintegerYesISP ID
branch_idintegerYesBranch ID

Pagination Parameters

ParameterTypeRequiredDescription
offsetintegerNoPagination offset (default: 0)
limitintegerNoResults per page (default: 100)

Filter Parameters

ParameterTypeRequiredDescription
profile_typeintegerNoFilter by profile type (1=User, 2=Subscriber)
payer_idintegerNoFilter by payer ID (requires profile_type)
payment_typeintegerNoFilter by payment method

Request Body: None

Success Response (200 OK):

json
{
    "success": true,
    "data": {
        "payments": [
            {
                "id": 1,
                "subscriber_id": 1,
                "subscriber_name": "John Doe",
                "amount": 1000,
                "payment_method": "Cash",
                "invoice_id": 123,
                "received_by": "Admin User",
                "created_at": "2024-01-15 10:30:00"
            }
        ],
        "total": 50
    }
}

Error Response (401 Unauthorized):

json
{
    "success": false,
    "message": "Unauthenticated"
}

cURL Example:

bash
curl -X GET "https://your-domain.com/api/v1/payments?isp_id=1&branch_id=1&offset=0&limit=100" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer your-auth-token"

Payment Receipt

Get payment receipt data including payment details and ISP information with area data.

PropertyValue
EndpointPayment Receipt
MethodGET
URL/api/v1/payments/receipt
AuthenticationBearer Token

Path Parameters:

ParameterTypeRequiredDescription
idintegerYesPayment ID

Query Parameters:

ParameterTypeRequiredDescription
isp_idintegerYesISP ID
branch_idintegerYesBranch ID
user_idintegerYesUser ID

Success Response (200 OK):

json
{
    "success": true,
    "data": {
        "receipt_number": "RCP-2024-0001",
        "subscriber_name": "John Doe",
        "amount": 1000,
        "payment_method": "Cash",
        "invoice_number": "INV-2024-0123",
        "received_by": "Admin User",
        "isp_name": "Your ISP Name",
        "isp_address": "123 ISP Street",
        "payment_date": "2024-01-15 10:30:00"
    }
}

Error Response (404 Not Found):

json
{
    "success": false,
    "message": "Payment not found"
}

cURL Example:

bash
curl -X GET "https://your-domain.com/api/v1/payments/receipt?id=1&isp_id=1&branch_id=1" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer your-auth-token"

Add Subscriber Balance

Add balance to a subscriber account. Creates a payment record and updates subscriber balance. Rate limited to prevent duplicate payments within 60 seconds.

PropertyValue
EndpointAdd Subscriber Balance
MethodPOST
URL/api/v1/payments/add-subscriber-balance
AuthenticationBearer Token

Request Headers:

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

Request Body:

json
{
    "isp_id": 1,
    "branch_id": 1,
    "user_id": 1,
    "subscriber_id": 1,
    "amount": 500,
    "payment_method": 1,
    "notes": "Balance top-up"
}
ParameterTypeRequiredDescription
isp_idintegerYesISP ID
branch_idintegerYesBranch ID
user_idintegerYesAdmin user ID
subscriber_idintegerYesSubscriber ID
amountdecimalYesAmount to add
payment_methodintegerNoPayment method ID
notesstringNoTransaction notes

Success Response (200 OK):

json
{
    "success": true,
    "message": "Balance added successfully",
    "data": {
        "new_balance": 1500,
        "transaction_id": 456
    }
}

Error Response (404 Not Found):

json
{
    "success": false,
    "message": "Subscriber not found"
}

Error Response (422 Validation Error):

json
{
    "success": false,
    "message": "Validation failed",
    "errors": {
        "amount": ["The amount must be greater than 0."]
    }
}

cURL Example:

bash
curl -X POST "https://your-domain.com/api/v1/payments/add-subscriber-balance" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer your-auth-token" \
  -d '{
    "subscriber_id": 1,
    "payment_amount": 500
  }'

www.onezeroart.com