EnAccess / EnAccess/micropowermanager

[Feature Request]: Vodacom Mozambique (M-Pesa) Generic C2B Integration

Open
#489 6 comments 1 reaction 1 assignee Claimed by @dmohns View on GitHub
enhancement Payments and CRM UX/UI
Dominant language
PHP
Stars
27
Forks
19
Avg merge
1d 18h
Merged PRs (30d)
27

Description

### Preflight Checklist

- [x] I have read the [Contributing Guidelines](https://github.com/EnAccess/micropowermanager/blob/main/CONTRIBUTING.md) for this project, if it exists.
- [x] I agree to follow the [Code of Conduct](https://github.com/EnAccess/micropowermanager/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [x] I have searched the [issue tracker](https://github.com/EnAccess/micropowermanager/issues) for a feature request that matches the one I want to file, without success.

### Problem Description

Implement the Vodacom Transaction API integration based on the provided specifications. The API consists of three main endpoints: validation, processing, and enquiry. All requests must be authenticated using a JWT token that includes expiresAt and companyId in the payload.

### Proposed Solution

Authentication
All requests must include a JWT token in the Authorization header as Bearer .
The JWT payload should contain:
expiresAt
companyId

Endpoints

1. Validation

- Request Type: POST
- Endpoint: /api/vodacom/transactions/validation
- Content-Type: application/json
- Request Body:

```
{
"serialNumber": "string", // Required
"amount": 0.0, // Required (double)
"payerPhoneNumber": "string", // Required
"referenceId": "string" // Required (Unique Id)
}
```

Response:

- Status: 200 OK
- Response Body:

```
{
"data": {},
"success": true
}
```

2. Process Transaction

- Request Type: POST
- Endpoint: /api/vodacom/transactions/process
- Content-Type: application/json

```
{
"referenceId": "string", // Same as validation request (Required)
"transactionId": "string" // ID of Vodacom transaction (Required)
}
```

Response:

- Status: 200 OK
- Response Body:

```
{
"data": {
"success": true
}
}
```

3. Enquiry
(Vodacom should continue hitting this endpoint until the status is either Failed or Succeed.)
- Request Type: POST
- Endpoint: /api/vodacom/transactions/enquiry
- Content-Type: application/json

```
{
"referenceId": "string" // Same as validation request (Required)
}

```
Response:

- Status: 200 OK
- Response Body:

```
{
"data": {
"success": true,
"status": ["Failed", "Succeed", "Pending"]
}
}
```

Error Response:

- Status: 400 Bad Request

```
{
"data": {
"success": false,
"message": "string"
}
}
```

### Alternatives Considered

-

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.