> For the complete documentation index, see [llms.txt](https://startbutton.gitbook.io/startbutton-product-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://startbutton.gitbook.io/startbutton-product-api/startbutton-api-doc/server-to-server-integration/s2s-integration-for-mobile-money/s2s-momo-tzs-and-ugx.md).

# S2S MoMo (TZS and UGX)

## Initiate S2S

<table><thead><tr><th width="224">Authorization</th><th>Set to Bearer PUBLIC_KEY</th></tr></thead><tbody><tr><td>Content-Type</td><td>Set value to <code>application/json</code></td></tr></tbody></table>

{% hint style="info" %}
The public key can be gotten from the 'Settings' page on your Startbutton dashboard.
{% endhint %}

Post a request to the URL below, where the base URL is determined by the environment you are in.

<details>

<summary>BaseUrl</summary>

Sandbox/PROD : <https://api.startbutton.tech&#x20>;

</details>

{% tabs %}
{% tab title="Endpoint" %}
POST  `{{baseurl}}/transaction/initialize/s2s/mobile_money`
{% endtab %}
{% endtabs %}

#### Here's a sample request below

{% hint style="info" %}
The next step after initiating the transaction is to verify the OTP using this [endpoint](/startbutton-product-api/startbutton-api-doc/server-to-server-integration/s2s-integration-for-mobile-money/s2s-momo-kes-and-ghs.md#otp-verify). Enter any 6-digit number as the OTP to complete the transaction.
{% endhint %}

{% hint style="info" %}
To test a success or failure scenario, find a test number [here](/startbutton-product-api/startbutton-api-doc/test-numbers/test-numbers-for-collections.md#use-the-numbers-below).
{% endhint %}

{% tabs %}
{% tab title="Required parameters (TZS)" %}

```
{
    "phone": "+255121212121",
    "email": "johndoe@startbutton.africa",
    "amount": 12000,
    "currency": "TZS"
}
```

{% endtab %}

{% tab title="Optional parameters included (TZS)" %}

```
{
    "phone": "+255121212121",
    "email": "johndoe@startbutton.africa",
    "amount": 12000,
    "currency": "TZS",
    "reference": "765jhgfyt6"
}
```

{% endtab %}

{% tab title="To mock a failed Scenario (TZS)" %}

```
{
    "phone": "+255750000020",
    "email": "johndoe@startbutton.africa",
    "amount": 12000,
    "currency": "TZS"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Required parameters (UGX)" %}

```postman_json
{
    "phone": "+256101010111",
    "email": "johndoe@startbutton.africa",
    "amount": 120000,
    "currency": "UGX"
}
```

{% endtab %}

{% tab title="Optional parameters included (UGX)" %}

```postman_json
{
    "phone": "+256101010111",
    "email": "johndoe@startbutton.africa",
    "amount": 120000,
    "currency": "UGX",
    "reference": "jhgfdew4567"
}
```

{% endtab %}

{% tab title="Failed Scenario (UGX)" %}

```
{
    "phone": "+256760000010",
    "email": "johndoe@startbutton.africa",
    "amount": 120000,
    "currency": "UGX"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The amount should be in fractional units.
{% endhint %}

| Currency | Minimum amount | Maximum amount |
| -------- | -------------- | -------------- |
| TZS      | `10000`        | `300000000`    |
| UGX      | `50000`        | `500000000`    |

Here's a sample response

{% tabs %}
{% tab title="Success (TZS)" %}

```json
{
    "success": true,
    "message": "Payment initiated successfully!",
    "data": {
        "reference": "ffeaf8d13f71",
        "nextStep": "PIN"
    }
```

{% endtab %}

{% tab title="Success (UGX)" %}

```
{
    "success": true,
    "message": "Payment initiated successfully!",
    "data": {
        "reference": "ccefb5efd193",
        "nextStep": "PIN"
    }
```

{% endtab %}

{% tab title="Failed" %}

```
{
    "success": false,
    "message": "unknown provider"
}
```

{% endtab %}
{% endtabs %}

The next step is always PIN for both TZS and UGX. Your users only need to enter their PIN on the prompt on their phone.
