API Reference

Introduction:

In this first step of the integration process, you will need to send a request to our endpoint to retrieve the payment methods assigned to your account. The "getPaymentmethods" endpoint is a GET request that allows you to fetch all enabled Payment Methods associated with your portal account, along with the commission charges that customers may incur on the gateway.

Endpoint Details:
To retrieve the payment methods, please use the following endpoint:

Endpoint: https://staging.fawaterk.com/api/v2/getPaymentmethods

Sample Request and Response Codes:
To make the request, you can use the following code snippet as an example:

import axios from 'axios';

const apiUrl = 'https://staging.fawaterk.com/api/v2/getPaymentmethods';
const accessToken = 'd83a5d07aaeb8442dcbe259e6dae80a3f2e21a3a581e1a5acd';

const headers = {
  'Content-Type': 'application/json',
  Authorization: `Bearer ${accessToken}`,
};

axios
  .get(apiUrl, { headers })
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        String apiUrl = "https://staging.fawaterk.com/api/v2/getPaymentmethods";
        String accessToken = "d83a5d07aaeb8442dcbe259e6dae80a3f2e21a3a581e1a5acd";

        OkHttpClient client = new OkHttpClient();

        Request request = new Request.Builder()
                .url(apiUrl)
                .addHeader("Content-Type", "application/json")
                .addHeader("Authorization", "Bearer " + accessToken)
                .build();

        try {
            Response response = client.newCall(request).execute();
            if (response.isSuccessful()) {
                String responseData = response.body().string();
                System.out.println(responseData);
            } else {
                System.out.println("Request failed: " + response.code());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

import okhttp3.OkHttpClient
import okhttp3.Request

fun main() {
    val apiUrl = "https://staging.fawaterk.com/api/v2/getPaymentmethods"
    val accessToken = "d83a5d07aaeb8442dcbe259e6dae80a3f2e21a3a581e1a5acd"

    val client = OkHttpClient()

    val request = Request.Builder()
        .url(apiUrl)
        .addHeader("Content-Type", "application/json")
        .addHeader("Authorization", "Bearer $accessToken")
        .build()

    client.newCall(request).execute().use { response ->
        if (response.isSuccessful) {
            val responseData = response.body?.string()
            println(responseData)
        } else {
            println("Request failed: ${response.code}")
        }
    }
}

import Foundation

let apiUrl = "https://staging.fawaterk.com/api/v2/getPaymentmethods"
let accessToken = "d83a5d07aaeb8442dcbe259e6dae80a3f2e21a3a581e1a5acd"

if let url = URL(string: apiUrl) {
    var request = URLRequest(url: url)
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    request.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")

    let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
        if let error = error {
            print("Error: \(error)")
            return
        }

        if let data = data {
            let responseData = String(data: data, encoding: .utf8)
            print(responseData ?? "")
        }
    }

    task.resume()
}

import 'dart:convert';
import 'package:http/http.dart' as http;

void fetchPaymentMethods() async {
  final apiUrl = 'https://staging.fawaterk.com/api/v2/getPaymentmethods';
  final accessToken = 'd83a5d07aaeb8442dcbe259e6dae80a3f2e21a3a581e1a5acd';

  final headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer $accessToken',
  };

  try {
    final response = await http.get(Uri.parse(apiUrl), headers: headers);
    final responseData = json.decode(response.body);
    print(json.encode(responseData));
  } catch (error) {
    print(error);
  }
}

void main() {
  fetchPaymentMethods();
}

Response Body:
The response will be in JSON format and will include the following information:

{
  "status": "success",
  "data": [
    {
      "paymentId": 2,
      "name_en": "Visa-Mastercard",
      "name_ar": "فيزا -ماستر كارد",
      "redirect": "true",
      "logo": "https://app.fawaterak.xyz/clients/payment_options/mastercard-visa.png"
    },
    {
      "paymentId": 3,
      "name_en": "Fawry",
      "name_ar": "فوري",
      "redirect": "false",
      "logo": "https://app.fawaterak.xyz/clients/payment_options/fawry.png"
    },
    {
      "paymentId": 4,
      "name_en": "Meeza",
      "name_ar": "ميزا",
      "redirect": "false",
      "logo": "https://app.fawaterak.xyz/clients/payment_options/MeezaDigitalSmall.png"
    }
  ]
}

Important Notes:

If the "redirect" attribute is set to "true" for a specific payment method, you will receive a link that needs to be redirected to complete the payment process.
Please be aware that Meeza (Mobile wallets) has been thoroughly tested with real payments only.
Feel free to reach out if you have any questions or need further assistance with the integration process.