> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nexapay.ng/llms.txt
> Use this file to discover all available pages before exploring further.

# Payments

# Payments

## Process Payment (API Key)

`POST /business/payment/process`

### Request Body

```json theme={null}
{
  "businessId": "664b...",
  "amount": 5000,
  "serviceType": "SUBSCRIPTION",
  "description": "March invoice",
  "externalPayerName": "Jane Smith",
  "externalPayerEmail": "jane@example.com",
  "externalPayerPhone": "08055555555"
}
```

### Curl Example (Production)

```bash theme={null}
curl -X POST "https://api.nexapay.ng/api/v1/business/payment/process" \
  -H "Content-Type: application/json" \
  -H "x-api-key: nexa-prod-..." \
  -d '{
    "businessId":"664b...",
    "amount":5000,
    "serviceType":"SUBSCRIPTION",
    "description":"March invoice",
    "externalPayerName":"Jane Smith",
    "externalPayerEmail":"jane@example.com",
    "externalPayerPhone":"08055555555"
  }'
```

### Response (Production)

```json theme={null}
{
  "success": true,
  "msg": "✅ Payment recorded for Nexa Stores from Jane Smith",
  "transaction": {
    "transactionId": "NEXA-...",
    "amount": 5000,
    "businessName": "Nexa Stores",
    "commission": 250,
    "netAmount": 4750,
    "status": "COMPLETED",
    "environment": "prod",
    "simulated": false
  }
}
```

### Response (Test Key)

```json theme={null}
{
  "success": true,
  "msg": "Test payment recorded for Nexa Stores from Jane Smith",
  "transaction": {
    "transactionId": "NEXA-...",
    "amount": 5000,
    "businessName": "Nexa Stores",
    "commission": 250,
    "netAmount": 4750,
    "status": "COMPLETED",
    "environment": "test",
    "simulated": true
  }
}
```

### Notes

* Production-key payments credit the live merchant wallet.
* Test-key payments credit only the sandbox merchant wallet.

### Error Response

```json theme={null}
{
  "success": false,
  "msg": "Invalid payment details"
}
```

## Process External Payment (API Key)

`POST /business/payment/process/external`

Same body as `/process`.

```bash theme={null}
curl -X POST "https://api.nexapay.ng/api/v1/business/payment/process/external" \
  -H "Content-Type: application/json" \
  -H "x-api-key: nexa-prod-..." \
  -d '{
    "businessId":"664b...",
    "amount":5000,
    "externalPayerName":"Jane Smith"
  }'
```

### Response

```json theme={null}
{
  "success": true,
  "transaction": {
    "transactionId": "NEXA-...",
    "amount": 5000,
    "status": "COMPLETED",
    "environment": "prod"
  }
}
```

### Error Response

```json theme={null}
{
  "success": false,
  "msg": "Payer information required"
}
```
