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

# Make Payment

> Process a payment transaction

Process a payment transaction using mobile money, cards, or hosted checkout.

## Authentication

All requests must include Basic Authentication header. See [Authentication](/authentication) for more details.

```bash theme={null}
Authorization: Basic YOUR_ENCODED_API_KEYS
```

## Example Request

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://mobiska-api.stimuluzdev.com/make_payment \
    -H "Authorization: Basic YOUR_ENCODED_API_KEYS" \
    -H "Content-Type: application/json" \
    -d '{
      "service_id": 2,
      "reference": "Payment on PasquoAI",
      "nickname": "PasquoAI",
      "transaction_id": "5",
      "trans_type": "CTM",
      "customer_number": "0541840988",
      "nw": "MTN",
      "amount": 1,
      "payment_option": "MOM",
      "callback_url": "https://your-callback-url.com/webhook",
      "currency_code": "GHS",
      "currency_val": 1,
      "request_time": "2025-01-30T16:31:56Z"
    }'
  ```

  ```php PHP theme={null}
  <?php

  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://mobiska-api.stimuluzdev.com/make_payment",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode([
      "service_id" => 2,
      "reference" => "Payment on PasquoAI",
      "nickname" => "PasquoAI",
      "transaction_id" => "5",
      "trans_type" => "CTM",
      "customer_number" => "0541840988",
      "nw" => "MTN",
      "amount" => 1,
      "payment_option" => "MOM",
      "callback_url" => "https://your-callback-url.com/webhook",
      "currency_code" => "GHS",
      "currency_val" => 1,
      "request_time" => "2025-01-30T16:31:56Z"
    ]),
    CURLOPT_HTTPHEADER => [
      "Authorization: Basic YOUR_ENCODED_API_KEYS",
      "Content-Type: application/json"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```

  ```python Python theme={null}
  import requests
  import base64

  # Your API credentials
  username = "YOUR_USERNAME"
  password = "YOUR_PASSWORD"

  # Create Basic Auth header
  credentials = base64.b64encode(f"{username}:{password}".encode()).decode()

  headers = {
      "Authorization": f"Basic {credentials}",
      "Content-Type": "application/json"
  }

  payload = {
      "service_id": 2,
      "reference": "Payment on PasquoAI",
      "nickname": "PasquoAI",
      "transaction_id": "5",
      "trans_type": "CTM",
      "customer_number": "0541840988",
      "nw": "MTN",
      "amount": 1,
      "payment_option": "MOM",
      "callback_url": "https://your-callback-url.com/webhook",
      "currency_code": "GHS",
      "currency_val": 1,
      "request_time": "2025-01-30T16:31:56Z"
  }

  response = requests.post(
      "https://mobiska-api.stimuluzdev.com/make_payment",
      headers=headers,
      json=payload
  )

  print(response.json())
  ```

  ```go Go theme={null}
  package main

  import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
  )

  func main() {
      url := "https://mobiska-api.stimuluzdev.com/make_payment"

      payload := `{
          "service_id": 2,
          "reference": "Payment on PasquoAI",
          "nickname": "PasquoAI",
          "transaction_id": "5",
          "trans_type": "CTM",
          "customer_number": "0541840988",
          "nw": "MTN",
          "amount": 1,
          "payment_option": "MOM",
          "callback_url": "https://your-callback-url.com/webhook",
          "currency_code": "GHS",
          "currency_val": 1,
          "request_time": "2025-01-30T16:31:56Z"
      }`

      req, _ := http.NewRequest("POST", url, strings.NewReader(payload))

      req.Header.Add("Authorization", "Basic YOUR_ENCODED_API_KEYS")
      req.Header.Add("Content-Type", "application/json")

      res, _ := http.DefaultClient.Do(req)
      defer res.Body.Close()
      
      body, _ := ioutil.ReadAll(res.Body)
      fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import com.mashape.unirest.http.HttpResponse;
  import com.mashape.unirest.http.Unirest;

  public class MakePayment {
      public static void main(String[] args) {
          try {
              HttpResponse<String> response = Unirest.post("https://mobiska-api.stimuluzdev.com/make_payment")
                  .header("Authorization", "Basic YOUR_ENCODED_API_KEYS")
                  .header("Content-Type", "application/json")
                  .body("{\n" +
                      "  \"service_id\": 2,\n" +
                      "  \"reference\": \"Payment on PasquoAI\",\n" +
                      "  \"nickname\": \"PasquoAI\",\n" +
                      "  \"transaction_id\": \"5\",\n" +
                      "  \"trans_type\": \"CTM\",\n" +
                      "  \"customer_number\": \"0541840988\",\n" +
                      "  \"nw\": \"MTN\",\n" +
                      "  \"amount\": 1,\n" +
                      "  \"payment_option\": \"MOM\",\n" +
                      "  \"callback_url\": \"https://your-callback-url.com/webhook\",\n" +
                      "  \"currency_code\": \"GHS\",\n" +
                      "  \"currency_val\": 1,\n" +
                      "  \"request_time\": \"2025-01-30T16:31:56Z\"\n" +
                      "}")
                  .asString();
              
              System.out.println(response.getBody());
          } catch(Exception e) {
              e.printStackTrace();
          }
      }
  }
  ```

  ```javascript JavaScript theme={null}
  const makePayment = async () => {
    // Your API credentials
    const username = 'YOUR_USERNAME';
    const password = 'YOUR_PASSWORD';
    
    // Create Basic Auth header
    const credentials = Buffer.from(`${username}:${password}`).toString('base64');

    const response = await fetch('https://mobiska-api.stimuluzdev.com/make_payment', {
      method: 'POST',
      headers: {
        'Authorization': `Basic ${credentials}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        service_id: 2,
        reference: "Payment on PasquoAI",
        nickname: "PasquoAI",
        transaction_id: "5",
        trans_type: "CTM",
        customer_number: "0541840988",
        nw: "MTN",
        amount: 1,
        payment_option: "MOM",
        callback_url: "https://your-callback-url.com/webhook",
        currency_code: "GHS",
        currency_val: 1,
        request_time: "2025-01-30T16:31:56Z"
      })
    });

    const data = await response.json();
    console.log(data);
  };
  ```
</CodeGroup>

## Request Body

<ParamField body="service_id" type="integer" required>
  Your service identifier
</ParamField>

<ParamField body="reference" type="string" required>
  Payment description or reference
</ParamField>

<ParamField body="nickname" type="string" required>
  Merchant name or identifier
</ParamField>

<ParamField body="transaction_id" type="string" required>
  Unique transaction identifier
</ParamField>

<ParamField body="trans_type" type="string" required>
  Transaction type (e.g., "CTM" for customer to merchant)
</ParamField>

<ParamField body="customer_number" type="string" required>
  Customer's phone number
</ParamField>

<ParamField body="nw" type="string" required>
  Network provider code:

  * MTN: MTN Mobile Money
  * VOD: Vodafone Cash
  * AIR: AirtelTigo Money
  * VIS: Visa Card
  * MAS: Mastercard
</ParamField>

<ParamField body="amount" type="number" required>
  Transaction amount
</ParamField>

<ParamField body="payment_option" type="string" required>
  Payment method:

  * MOM: Mobile Money
  * CRD: Bank Cards
  * CRM: Hosted Checkout (Mobile Money and Cards)
</ParamField>

<ParamField body="callback_url" type="string" required>
  URL to receive transaction status updates
</ParamField>

<ParamField body="currency_code" type="string" required>
  Three-letter currency code (e.g., "GHS")
</ParamField>

## Response

<ResponseField name="response_code" type="string">
  Status code of the request
</ResponseField>

<ResponseField name="response_message" type="string">
  Human-readable status message
</ResponseField>

```json theme={null}
{
  "response_message": "Request successfully received for processing",
  "response_code": "202"
}
```
