> For the complete documentation index, see [llms.txt](https://moonie.gitbook.io/mooniepay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moonie.gitbook.io/mooniepay/payouts/account-holder-details.md).

# Account holder details

Look up a customer's mobile money account details directly from the payment provider. Use this endpoint to display the account holder's name before initiating a payment — giving customers confidence they are paying to/from the right account.

***

### Endpoint

```
GET https://api.pay.movemoonie.com/v1/payouts/{paymentMethodCode}/account-holder/details
```

***

### Path Parameter

| Parameter           | Description                                                                        |
| ------------------- | ---------------------------------------------------------------------------------- |
| `paymentMethodCode` | The payment method to look up against. One of: `momo_cm`, `om_cm`,`mooniepay_demo` |

### Query Parameters

| Parameter      | Type     | Required | Description                                                    |
| -------------- | -------- | -------- | -------------------------------------------------------------- |
| `phone_number` | `string` | ✅        | The customer's phone number to look up (e.g. `+237620000001`). |

***

### Supported Methods

| Method Code      | Supported | Notes                                  |
| ---------------- | --------- | -------------------------------------- |
| `momo_cm`        | ✅         | Available in sandbox and live          |
| `om_cm`          | ✅         | Live only                              |
| `mooniepay_demo` | ✅         | Returns a mock account name in sandbox |

***

### Code Examples

{% tabs %}
{% tab title="PHP" %}

```php
<?php

$publicKey         = 'pk_sandbox_payment_xxxxxxxxxxxx';
$secretKey         = 'your_secret_key_here';
$environment       = 'sandbox';
$timestamp         = time();
$paymentMethodCode = 'mooniepay_demo';
$phoneNumber       = '+237620000001';

$method  = 'GET';
$path    = "/v1/payments/{$paymentMethodCode}/account-holder/details";
$payload = "phone_number={$phoneNumber}"; // query string is the payload for GET

$stringToSign = "{$publicKey}.{$timestamp}.{$method}.{$path}.{$payload}";
$signature    = hash_hmac('sha256', $stringToSign, $secretKey);

$ch = curl_init("https://api.pay.movemoonie.com{$path}?phone_number=" . urlencode($phoneNumber));
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        "Authorization: {$publicKey}",
        "X-TTUM-Timestamp: {$timestamp}",
        "X-TTUM-Signature: {$signature}",
        "X-TTUM-Environment: {$environment}",
    ],
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);

// Display name to the customer for confirmation
echo $response['data']['name']; // "Jane Doe"
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const crypto = require('crypto');
const https  = require('https');

const publicKey         = 'pk_sandbox_payment_xxxxxxxxxxxx';
const secretKey         = 'your_secret_key_here';
const environment       = 'sandbox';
const timestamp         = Math.floor(Date.now() / 1000);
const paymentMethodCode = 'mooniepay_demo';
const phoneNumber       = '+237620000001';

const method  = 'GET';
const path    = `/v1/payments/${paymentMethodCode}/account-holder/details`;
const payload = `phone_number=${encodeURIComponent(phoneNumber)}`;

const stringToSign = `${publicKey}.${timestamp}.${method}.${path}.${payload}`;
const signature    = crypto.createHmac('sha256', secretKey).update(stringToSign).digest('hex');

https.get({
  hostname: 'api.pay.movemoonie.com',
  path: `${path}?${payload}`,
  headers: {
    'Authorization': publicKey, 'X-TTUM-Timestamp': timestamp.toString(),
    'X-TTUM-Signature': signature, 'X-TTUM-Environment': environment,
  },
}, (res) => {
  let data = '';
  res.on('data', chunk => data += chunk);
  res.on('end', () => {
    const json = JSON.parse(data);
    console.log('Account name:', json.data?.name);
  });
});
```

{% endtab %}

{% tab title="Python" %}

```python
import hmac, hashlib, time, requests
from urllib.parse import urlencode

public_key          = 'pk_sandbox_payment_xxxxxxxxxxxx'
secret_key          = 'your_secret_key_here'
environment         = 'sandbox'
timestamp           = int(time.time())
payment_method_code = 'mooniepay_demo'
phone_number        = '+237620000001'

method      = 'GET'
path        = f'/v1/payments/{payment_method_code}/account-holder/details'
query       = urlencode({'phone_number': phone_number})
payload     = query  # query string is the payload for GET requests

string_to_sign = f"{public_key}.{timestamp}.{method}.{path}.{payload}"
signature = hmac.new(secret_key.encode(), string_to_sign.encode(), hashlib.sha256).hexdigest()

response = requests.get(
    f'https://api.pay.movemoonie.com{path}',
    params={'phone_number': phone_number},
    headers={
        'Authorization': public_key, 'X-TTUM-Timestamp': str(timestamp),
        'X-TTUM-Signature': signature, 'X-TTUM-Environment': environment,
    }
).json()

print('Account name:', response['data']['name'])
```

{% endtab %}

{% tab title="cURL" %}

```shellscript
PUBLIC_KEY="pk_sandbox_payment_xxxxxxxxxxxx"
SECRET_KEY="your_secret_key_here"
ENVIRONMENT="sandbox"
TIMESTAMP=$(date +%s)
METHOD="GET"
PAYMENT_METHOD="mooniepay_demo"
PHONE="+237620000001"
PATH="/v1/payments/${PAYMENT_METHOD}/account-holder/details"
PAYLOAD="phone_number=${PHONE}"

STRING_TO_SIGN="${PUBLIC_KEY}.${TIMESTAMP}.${METHOD}.${PATH}.${PAYLOAD}"
SIGNATURE=$(echo -n "$STRING_TO_SIGN" | openssl dgst -sha256 -hmac "$SECRET_KEY" | awk '{print $2}')

curl "https://api.pay.movemoonie.com${PATH}?${PAYLOAD}" \
  -H "Authorization: $PUBLIC_KEY" \
  -H "X-TTUM-Timestamp: $TIMESTAMP" \
  -H "X-TTUM-Signature: $SIGNATURE" \
  -H "X-TTUM-Environment: $ENVIRONMENT"
```

{% endtab %}
{% endtabs %}

***

### Response

#### Success — `200 OK`

```json
{
  "success": true,
  "data": {
    "name": "Jane Doe",
    "phone_number": "237620000001"
  }
}
```

| Field          | Type     | Description                                           |
| -------------- | -------- | ----------------------------------------------------- |
| `name`         | `string` | The full name registered on the mobile money account. |
| `phone_number` | `string` | The normalized phone number (without `+` prefix).     |

#### Error Responses

| HTTP  | Code / Message                   | Reason                                                        |
| ----- | -------------------------------- | ------------------------------------------------------------- |
| `404` | `Account not found`              | No account found for the given phone number on this provider. |
| `422` | `APP_PAYMENT_METHOD_NOT_ENABLED` | The method is not enabled for your application.               |

> 💡 **UX tip:** Call this endpoint when the customer enters their phone number on your checkout page, before they confirm. Display the returned `name` so they can verify they are paying from the correct account.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://moonie.gitbook.io/mooniepay/payouts/account-holder-details.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
