### Install React Native EdfaPay SoftPos SDK Source: https://docs.edfapay.com/reference/react-native Installs or updates the EdfaPay SoftPos SDK for React Native using npm. This command fetches the latest version from the npm registry. ```javascript npm install react-native-edfapay-softpos-sdk ``` ```javascript npm update react-native-edfapay-softpos-sdk ``` -------------------------------- ### Refund API Request Example (Bash) Source: https://docs.edfapay.com/reference/post_payment-post-1-1-1-1 This example demonstrates how to make a refund request using cURL. It specifies the content type and provides the necessary data parameters for the refund operation, including client key, transaction ID, amount, action, and hash. ```bash curl --location 'https://apidev.edfapay.com/payment/post' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'client_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \ --data-urlencode 'trans_id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' \ --data-urlencode 'amount=X.XX' \ --data-urlencode 'action=CREDITVOID' \ --data-urlencode 'hash=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ``` -------------------------------- ### Recurring Payment API Source: https://docs.edfapay.com/reference/edfapay-s2s Test recurring payment setup and execution in the sandbox environment. This endpoint allows you to simulate initial setup and subsequent recurring charges. ```APIDOC ## POST /recurring ### Description Handles the setup and execution of recurring payments. This endpoint can be used to initiate the first payment in a recurring series and to test subsequent scheduled payments. ### Method POST ### Endpoint `https://apidev.edfapay.com/recurring` ### Parameters #### Request Body - **merchant_id** (string) - Required - The unique identifier for the merchant. - **subscription_id** (string) - Required - A unique identifier for the recurring payment subscription. - **transaction_id** (string) - Required - A unique ID for the initial transaction (or the current recurring transaction). - **amount** (number) - Required - The amount for the recurring payment. - **currency** (string) - Required - The currency code for the transaction. - **schedule** (object) - Required - Details about the recurring schedule. - **interval** (string) - Required - The interval of the recurrence (e.g., 'MONTHLY', 'WEEKLY'). - **interval_count** (integer) - Required - The number of intervals between recurrences. - **start_date** (string) - Required - The date when the recurring payment starts (YYYY-MM-DD). - **end_date** (string) - Optional - The date when the recurring payment ends (YYYY-MM-DD). - **card_details** (object) - Required - Contains the card information for the payment. - **card_number** (string) - Required - The credit or debit card number. - **expiry_month** (string) - Required - The card expiry month (MM). - **expiry_year** (string) - Required - The card expiry year (YYYY). - **cvv** (string) - Required - The Card Verification Value. ### Request Example ```json { "merchant_id": "MERCHANT123", "subscription_id": "SUB98765", "transaction_id": "TXN112233", "amount": 25.00, "currency": "USD", "schedule": { "interval": "MONTHLY", "interval_count": 1, "start_date": "2023-10-27" }, "card_details": { "card_number": "4111111111111111", "expiry_month": "12", "expiry_year": "2025", "cvv": "123" } } ``` ### Response #### Success Response (200) - **subscription_id** (string) - The unique ID for the recurring subscription. - **transaction_id** (string) - The unique ID for the processed transaction. - **status** (string) - The status of the recurring payment operation (e.g., 'SUCCESS', 'PENDING', 'FAILED'). - **message** (string) - A message describing the result of the operation. #### Response Example ```json { "subscription_id": "SUB98765", "transaction_id": "TXN112233", "status": "SUCCESS", "message": "Recurring payment initiated successfully." } ``` ``` -------------------------------- ### Recurring API Source: https://docs.edfapay.com/reference/default Tests recurring payment setup and execution. ```APIDOC ## POST /payment/recurring ### Description Tests the setup and execution of recurring payments. ### Method POST ### Endpoint https://apidev.edfapay.com/payment/recurring ### Parameters #### Query Parameters None #### Request Body - **customer_id** (string) - Required - Identifier for the customer. - **plan_id** (string) - Required - Identifier for the recurring payment plan. - **payment_details** (object) - Required - Details for the initial payment or tokenization. - **amount** (number) - Required - The amount for the recurring payment. - **currency** (string) - Required - The currency of the payment. - **start_date** (string) - Optional - The date when the recurring payments should start (YYYY-MM-DD). ### Request Example ```json { "customer_id": "CUST-XYZ", "plan_id": "PLAN-RECUR-001", "payment_details": { "amount": 25.00, "currency": "EUR" }, "start_date": "2024-01-01" } ``` ### Response #### Success Response (200) - **subscription_id** (string) - The unique identifier for the recurring payment subscription. - **status** (string) - The status of the subscription setup. - **next_payment_date** (string) - The date of the next scheduled payment. #### Response Example ```json { "subscription_id": "sub_def456", "status": "active", "next_payment_date": "2024-02-01" } ``` ``` -------------------------------- ### Initiate API Source: https://docs.edfapay.com/reference/default Creates a new payment request. This endpoint is used to start a payment process. ```APIDOC ## POST /payment/initiate ### Description Creates a new payment request to initiate a transaction. ### Method POST ### Endpoint https://apidev.edfapay.com/payment/initiate ### Parameters #### Query Parameters None #### Request Body - **amount** (number) - Required - The amount to be charged. - **currency** (string) - Required - The currency of the transaction (e.g., 'USD', 'EUR'). - **order_id** (string) - Required - A unique identifier for the order. - **customer_id** (string) - Optional - Identifier for the customer. - **payment_method** (string) - Optional - The desired payment method. ### Request Example ```json { "amount": 100.50, "currency": "USD", "order_id": "ORD-12345", "customer_id": "CUST-XYZ", "payment_method": "card" } ``` ### Response #### Success Response (200) - **transaction_id** (string) - The unique identifier for the created transaction. - **status** (string) - The initial status of the transaction. - **payment_url** (string) - A URL to redirect the user for payment completion. #### Response Example ```json { "transaction_id": "txn_abc123", "status": "pending", "payment_url": "https://sandbox.edfapay.com/pay/txn_abc123" } ``` ``` -------------------------------- ### Configure Gradle Repositories for EdfaPay SDK Source: https://docs.edfapay.com/reference/flutter-1 Configures Gradle to use JitPack and Gradle Plugin Portal repositories with authorization for the EdfaPay SDK. This setup is crucial for downloading the EdfaPay plugin and native dependencies. It provides configurations for both `settings.gradle` and `build.gradle` files, supporting different project build setups. ```groovy pluginManagement { repositories { // Add below at same gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() // Add below at same maven { url "https://jitpack.io" credentials { username "jp_dtett6nt05eqiekvc4hp4og128" } } } } ``` ```kotlin pluginManagement { val flutterSdkPath = run { val properties = java.util.Properties() file("local.properties").inputStream().use { properties.load(it) } val flutterSdkPath = properties.getProperty("flutter.sdk") require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } flutterSdkPath } includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) repositories { google() mavenCentral() maven { url = uri("https://jitpack.io") credentials { username = "jp_dtett6nt05eqiekvc4hp4og128" } } } } ``` ```groovy allprojects { repositories { // Add below at same gradlePluginPortal() maven{ url "https://jitpack.io" credentials{ username "jp_dtett6nt05eqiekvc4hp4og128" } } } } ``` ```kotlin allprojects { repositories { google() mavenCentral() maven { url = uri("https://jitpack.io") credentials { username = "jp_i9ed2av1lj1kjnqpgobpeh0e7k" } } } } ``` -------------------------------- ### Get Role Details by RoleId using Python Source: https://docs.edfapay.com/reference/roles Python script to retrieve role details via a GET request. This example uses the 'requests' library, which simplifies HTTP requests. ```Python import requests def get_role_details(role_id): url = f"https://revamp-api.edfapay.com/api/v1/roles/role/{role_id}" headers = { 'accept': '*/*' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) return response.json() except requests.exceptions.RequestException as e: print(f"Error fetching role details: {e}") return None # Usage: # role_id = 'your_role_id_here' # role_data = get_role_details(role_id) # if role_data: # print(role_data) ``` -------------------------------- ### Example cURL Request for Payment Source: https://docs.edfapay.com/reference/sale This cURL command illustrates a sample request to initiate a payment through the EdfaPay API. It includes all necessary form data such as client key, order details, amount, card information, payer details, and transaction parameters. Ensure all fields are populated correctly according to the API documentation. ```bash curl --location 'https://api.edfapay.com/payment/post' \ --form 'client_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' \ --form 'order_id="TEST-XXXXXXXXXXX"' \ --form 'hash="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' \ --form 'order_amount="0.11"' \ --form 'card_number="XXXXXXXXXXXXXXXX"' \ --form 'card_exp_month="XX"' \ --form 'card_exp_year="XXXX"' \ --form 'card_cvv2="XXX"' \ --form 'payer_phone="+XXXXXXXXXXX"' \ --form 'payer_country="SA"' \ --form 'payer_address="XXXXXX@domain.com"' \ --form 'action="SALE"' \ --form 'payer_zip="XXXXXX"' \ --form 'payer_ip="XXX.XX.XX.XXX"' \ --form 'order_currency="SAR"' \ --form 'payer_first_name="XXXXXX"' \ --form 'payer_city="XXXXXX"' \ --form 'auth="N"' \ --form 'payer_last_name="XXXXXX"' \ --form 'order_description="Test Order"' \ --form 'payer_email="XXXXXX@domain.com"' \ --form 'term_url_3ds="https://google.com/"' \ --form 'recurring_init="N"' \ --form 'req_token="N"' ``` -------------------------------- ### Get Role Details by RoleId using PHP Source: https://docs.edfapay.com/reference/roles Example code for making a GET request to fetch role details in PHP. This can be achieved using cURL functions or stream contexts. ```PHP ``` -------------------------------- ### Initiate Payment with cURL Source: https://docs.edfapay.com/reference/post_payment-initiate This cURL request demonstrates how to initiate a payment transaction with EDFApay. It includes all necessary parameters for a sale, such as merchant ID, order details, payer information, and authentication hash. ```bash curl --location 'https://apidev.edfapay.com/payment/initiate' \ --form 'action="SALE"' \ --form 'edfa_merchant_id="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"' \ --form 'order_id="Test-Number"' \ --form 'order_amount="0.11"' \ --form 'order_currency="SAR"' \ --form 'order_description="Test order"' \ --form 'req_token="N"' \ --form 'payer_first_name="First"' \ --form 'payer_last_name="Last"' \ --form 'payer_address="Riyad"' \ --form 'payer_country="SA"' \ --form 'payer_city="Riyadh"' \ --form 'payer_zip="12221"' \ --form 'payer_email="example@gmail.com"' \ --form 'payer_phone="966565555555"' \ --form 'payer_ip="176.44.76.222"' \ --form 'term_url_3ds="https://www.google.com/"' \ --form 'auth="N"' \ --form 'recurring_init="N"' \ --form 'hash="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' ``` -------------------------------- ### Get Role Details by RoleId (Node.js) Source: https://docs.edfapay.com/reference/api-docs Example demonstrating how to fetch role details using Node.js. This snippet shows how to make an HTTP GET request to the EdfaPay API. ```javascript const url = 'https://revamp-api.edfapay.com/api/v1/roles/role/roleId'; fetch(url, { method: 'GET', headers: { 'accept': '*/*' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Initiate API Source: https://docs.edfapay.com/reference/hosted-checkout-integration The Initiate API is the primary entry point for processing new payment transactions. It allows merchants to start payments, provide order and customer details, and facilitate 3D Secure authentication, tokenization, and alternative payment methods. ```APIDOC ## POST /initiate ### Description This endpoint initiates a new payment transaction. It handles essential details for the order and customer, supports secure hash authentication, tokenization, and integrates with alternative payment methods like Apple Pay and BNPL options. ### Method POST ### Endpoint /initiate ### Parameters #### Query Parameters - **secure_hash** (string) - Required - The hash used for secure authentication. #### Request Body - **order_id** (string) - Required - Unique identifier for the order. - **amount** (number) - Required - The transaction amount. - **currency** (string) - Required - The currency of the transaction (e.g., USD). - **customer_details** (object) - Required - Information about the customer. - **email** (string) - Required - Customer's email address. - **phone** (string) - Optional - Customer's phone number. - **first_name** (string) - Optional - Customer's first name. - **last_name** (string) - Optional - Customer's last name. - **payment_methods** (array) - Optional - Specifies available payment methods (e.g., ["CARD", "APPLE_PAY", "TAMARA"]). - **return_url** (string) - Required - The URL to redirect the customer to after payment. - **card_token** (string) - Optional - Token for a previously saved card for recurring payments. ### Request Example ```json { "order_id": "ORD12345", "amount": 100.50, "currency": "USD", "customer_details": { "email": "customer@example.com", "first_name": "John", "last_name": "Doe" }, "payment_methods": ["CARD", "APPLE_PAY"], "return_url": "https://your-site.com/payment/callback" } ``` ### Response #### Success Response (200) - **transaction_id** (string) - The unique ID for the transaction. - **status** (string) - The current status of the transaction (e.g., "PENDING", "REQUIRES_3DS"). - **redirect_url** (string) - URL for 3D Secure authentication or payment completion. #### Response Example ```json { "transaction_id": "TXN98765", "status": "REQUIRES_3DS", "redirect_url": "https://secure.edfapay.com/auth?token=..." } ``` ``` -------------------------------- ### Get Role Details by RoleId (PHP) Source: https://docs.edfapay.com/reference/api-docs Example demonstrating how to fetch role details using PHP. This code uses cURL to send an HTTP GET request to the EdfaPay API. ```php ``` -------------------------------- ### Example cURL Payment Request Source: https://docs.edfapay.com/reference/post_payment-post-1 Demonstrates a sample cURL command for initiating a payment transaction via the EdfaPay API. This includes essential parameters such as client key, order ID, amount, card details, and customer information. Ensure all fields are populated correctly according to your transaction requirements. ```bash curl --location 'https://apidev.edfapay.com/payment/post' \ --form 'client_key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' \ --form 'order_id="TEST-XXXXXXXXXXX"' \ --form 'hash="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' \ --form 'order_amount="0.11"' \ --form 'card_number="XXXXXXXXXXXXXXXX"' \ --form 'card_exp_month="XX"' \ --form 'card_exp_year="XXXX"' \ --form 'card_cvv2="XXX"' \ --form 'payer_phone="+XXXXXXXXXXX"' \ --form 'payer_country="SA"' \ --form 'payer_address="XXXXXX@domain.com"' \ --form 'action="SALE"' \ --form 'payer_zip="XXXXXX"' \ --form 'payer_ip="XXX.XX.XX.XXX"' \ --form 'order_currency="SAR"' \ --form 'payer_first_name="XXXXXX"' \ --form 'payer_city="XXXXXX"' \ --form 'auth="N"' \ --form 'payer_last_name="XXXXXX"' \ --form 'order_description="Test Order"' \ --form 'payer_email="XXXXXX@domain.com"' \ --form 'term_url_3ds="https://google.com/"' \ --form 'recurring_init="N"' \ --form 'req_token="N"' ``` -------------------------------- ### Get Role Details by RoleId (Ruby) Source: https://docs.edfapay.com/reference/api-docs Example showcasing how to retrieve role details using Ruby. This code snippet illustrates making an HTTP GET request to the EdfaPay API. ```ruby require 'net/http' require 'uri' uri = URI.parse('https://revamp-api.edfapay.com/api/v1/roles/role/roleId') response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http| request = Net::HTTP::Get.new(uri) request['accept'] = '*/*' http.request(request) end puts response.body ``` -------------------------------- ### Import and Initialize EdfaPay SoftPos SDK in React Native Source: https://docs.edfapay.com/reference/react-native Demonstrates how to import the EdfaPay SoftPos SDK and initialize it with an authentication code and environment. Includes basic error handling for initialization failure. ```javascript import * as EdfaPayPlugin from 'react-native-edfapay-softpos-sdk'; const authCode = "Your_Sdk_Login_Auth_Code"; // Replace with your actual SDK Login Auth Code EdfaPayPlugin.initiate(authCode, EdfaPayPlugin.Env.UAT).then(async (value) => { if (value === false) { // Handle initialization failure (e.g., inform the developer/user) console.error("EdfaPay SDK initialization failed."); } else { // SDK initialized successfully, allow user to proceed with payment console.log("EdfaPay SDK initialized successfully."); } }); ``` -------------------------------- ### Initialize EdfaPay Plugin (Kotlin, Java) Source: https://docs.edfapay.com/reference/mobile-sdks Initializes the EdfaPay plugin with provided credentials and context. Includes success and error callback handlers for SDK initialization status. The `onSuccess` callback provides the plugin instance and a session ID, while `onError` logs the exception and displays an error message. ```kotlin EdfaPayPlugin.initiate( context = this, credentials = credentials, onSuccess ={ plugin, sessionId - > Toast.makeText(requireContext(),"SDK Initialized Successfully", Toast.LENGTH_SHORT).show() } ){err - > err.printStackTrace() Toast.makeText(requireContext(),"Error Initializing : ${err.message}", Toast.LENGTH_SHORT).show() } ``` ```java EdfaPayPlugin.initiate( this, credentials, new EdfaPayPlugin.OnSuccessCallback() { @Override public void onSuccess(EdfaPayPlugin plugin, String sessionId) { Toast.makeText( getApplicationContext(), "SDK Initialized Successfully", Toast.LENGTH_SHORT ).show(); } }, new EdfaPayPlugin.OnErrorCallBack() { @Override public void onError(Throwable err) { err.printStackTrace(); Toast.makeText( getApplicationContext(), "Error Initializing: " + err.getMessage(), Toast.LENGTH_SHORT ).show(); } } ); ``` -------------------------------- ### Get Role Details by RoleId (Python) Source: https://docs.edfapay.com/reference/api-docs Example showing how to retrieve role details using Python. This snippet utilizes the 'requests' library to perform an HTTP GET request to the EdfaPay API. ```python import requests url = "https://revamp-api.edfapay.com/api/v1/roles/role/roleId" headers = { 'accept': '*/*' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Role Details by RoleId (cURL) Source: https://docs.edfapay.com/reference/api-docs Example of how to retrieve role details using the cURL command-line tool. This request utilizes the GET method to fetch data from the specified API endpoint. ```shell curl --request GET \ --url https://revamp-api.edfapay.com/api/v1/roles/role/roleId \ --header 'accept: */*' ``` -------------------------------- ### Initiate Payment POST Request - Java Example Source: https://docs.edfapay.com/reference/get_new-endpoint This snippet demonstrates how to initiate a hosted checkout payment using the EDFAPay API with Java. It assumes the necessary SDK or HTTP client libraries are configured. The input is typically a JSON payload containing payment details, and the output is a JSON response indicating a redirect URL for the user or an error message. ```java /* * Example Java code for initiating a hosted checkout payment. * This is a conceptual representation and requires a full HTTP client implementation. */ public class EdfaPayClient { private static final String API_URL = "https://api.edfapay.com/payment/initiate"; public String initiatePayment(String apiKey, String merchantId, double amount, String currency, String orderId) { // Construct the JSON request body String requestBody = String.format( "{\"client_key\": \"%s\", \"edfapay_merchant_id\": \"%s\", \"amount\": %.2f, \"currency\": \"%s\", \"order_id\": \"%s\"}", apiKey, merchantId, amount, currency, orderId ); // In a real application, you would use an HTTP client (like Apache HttpClient, OkHttp, etc.) // to send a POST request to API_URL with the requestBody and appropriate headers. // Example headers might include 'Content-Type: application/json'. // For demonstration, we'll simulate a successful response. System.out.println("Sending request to: " + API_URL); System.out.println("Request Body: " + requestBody); // Simulate a successful response from the API String simulatedResponse = "{\"redirect_url\": \"https://pay.edfapay.com/merchant/checkout/10023333246/b1efc42a-67d3-4bdc-8382-7059bb665036\"}"; System.out.println("Simulated API Response: " + simulatedResponse); // In a real scenario, you would parse the response to extract redirect_url or error details. return simulatedResponse; } public static void main(String[] args) { EdfaPayClient client = new EdfaPayClient(); // Replace with actual credentials and details String apiKey = "YOUR_API_KEY"; String merchantId = "YOUR_MERCHANT_ID"; double amount = 100.50; String currency = "USD"; String orderId = "ORDER12345"; String response = client.initiatePayment(apiKey, merchantId, amount, currency, orderId); // Process the response object here } } ``` -------------------------------- ### Get Role Details by RoleId using Node.js Source: https://docs.edfapay.com/reference/roles Example code for fetching role details using Node.js. This snippet would typically use a library like 'axios' or the built-in 'https' module to make the GET request to the specified API endpoint. ```Node.js // Example using axios (install with: npm install axios) const axios = require('axios'); async function getRoleDetails(roleId) { try { const response = await axios.get(`https://revamp-api.edfapay.com/api/v1/roles/role/${roleId}`); return response.data; } catch (error) { console.error('Error fetching role details:', error); throw error; } } // Usage: // const roleId = 'your_role_id_here'; // getRoleDetails(roleId).then(data => console.log(data)).catch(err => console.error(err)); ``` -------------------------------- ### Get Partner Details API Request (Python) Source: https://docs.edfapay.com/reference/partner-2 This Python code example shows how to retrieve partner details via the EDFAPay API. It uses the `requests` library to make a GET request to the partner details endpoint, passing the `partnerId`. The response body is expected to be JSON. ```python import requests partner_id = 'your_partner_id' url = f"https://revamp-api.edfapay.com/api/v1/partner/{partner_id}" headers = { 'accept': '*/*' } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Get Partner Details API Request (Ruby) Source: https://docs.edfapay.com/reference/partner-2 This Ruby code example demonstrates how to retrieve partner details from the EDFAPay API. It uses the `Net::HTTP` library to perform a GET request to the partner details endpoint, passing the `partnerId` as a path parameter. The expected response is a JSON object. ```ruby require 'net/http' require 'uri' partner_id = 'your_partner_id' uri = URI.parse("https://revamp-api.edfapay.com/api/v1/partner/#{partner_id}") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == 'https' request = Net::HTTP::Get.new(uri) request['accept'] = '*/*' response = http.request(request) puts response.body ``` -------------------------------- ### Search Transaction API Request (cURL) Source: https://docs.edfapay.com/reference/transaction This example demonstrates how to make a GET request to the Search Transaction API using cURL. It includes the base URL and required query parameters for filtering transactions. Ensure that 'pageProperties' and 'searchCriteria' are properly formatted JSON strings. ```Shell curl --request GET \ --url 'https://revamp-api.edfapay.com/api/v1/transactions/filterTransaction?pageProperties=&searchCriteria=' \ --header 'accept: */*' ``` -------------------------------- ### Initialize EdfaPay Plugin Source: https://docs.edfapay.com/reference/android-native Initializes the EdfaPay SDK plugin using provided credentials. This function requires a context, the credentials object, and callback functions for success and error handling. The success callback provides an initialized plugin instance and a session ID, while the error callback logs any exceptions encountered during initialization. ```kotlin EdfaPayPlugin.initiate( context = this, credentials = credentials, onSuccess ={plugin,sessionId - > Toast.makeText(requireContext(),"SDK Initialized Successfully", LENGTH_SHORT).show() } ){err - > err.printStackTrace() Toast.makeText(requireContext(),"Error Initializing : ${err.message}", LENGTH_SHORT).show() } ``` ```java EdfaPayPlugin.initiate( this, credentials, new EdfaPayPlugin.OnSuccessCallback() { @Override public void onSuccess(EdfaPayPlugin plugin, String sessionId) { Toast.makeText( getApplicationContext(), "SDK Initialized Successfully", Toast.LENGTH_SHORT ).show(); } }, new EdfaPayPlugin.OnErrorCallBack() { @Override public void onError(Throwable err) { err.printStackTrace(); Toast.makeText( getApplicationContext(), "Error Initializing: " + err.getMessage(), Toast.LENGTH_SHORT ).show(); } } ); ``` -------------------------------- ### Search Merchants using PHP Source: https://docs.edfapay.com/reference/merchant PHP code example for querying the EdfaPay API to search for merchants. It utilizes cURL to send a GET request, passing pagination and search criteria as URL parameters. The code includes basic error checking for the cURL request. ```php json_encode($pageProperties), 'searchCriteria' => json_encode($searchCriteria) ]); $url = $baseUrl . '?' . $queryParams; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: */*')); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); curl_close($ch); return false; } curl_close($ch); return json_decode($response, true); } // Example Usage: // $pageProps = ['page' => 0, 'size' => 10]; // $searchCrit = ['name' => 'Example Merchant']; // $data = searchMerchants($pageProps, $searchCrit); // if ($data) { // print_r($data); // } ?> ``` -------------------------------- ### Search Transaction API Request (Python) Source: https://docs.edfapay.com/reference/transaction This Python example uses the 'requests' library to send a GET request to the Search Transaction API. It formats the URL with query parameters and includes the 'accept' header. Ensure that 'pageProperties' and 'searchCriteria' are valid JSON strings before making the request. ```python import requests base_url = 'https://revamp-api.edfapay.com/api/v1/transactions/filterTransaction' page_properties = '' # Replace with actual page properties JSON string search_criteria = '' # Replace with actual search criteria JSON string params = { 'pageProperties': page_properties, 'searchCriteria': search_criteria } headers = { 'accept': '*/*' } response = requests.get(base_url, params=params, headers=headers) print(response.json()) ``` -------------------------------- ### Configure Android Repository for EdfaPay SDK Source: https://docs.edfapay.com/reference/react-native Adds necessary repositories (gradlePluginPortal and jitpack with authorization) to your project-level `build.gradle` file. This ensures Gradle can download the EdfaPay plugin and native dependencies. ```gradle allprojects { repositories { maven { url "https://jitpack.io" credentials { username "jp_i9ed2av1lj1kjnqpgobpeh0e7k" } } } } ``` -------------------------------- ### React Native EdfaPay SDK Initialization and Payment Source: https://docs.edfapay.com/reference/react-native This snippet shows how to initialize the EdfaPay SDK, set a merchant logo and theme, and handle payment initiation. It includes UI components for displaying information and a button to trigger the payment process. Dependencies include 'react', 'react-native', and 'react-native-edfapay-softpos-sdk'. Inputs are an authentication code and amount, with outputs being payment status alerts. ```javascript import * as React from 'react'; import { View, Text, Image, Button, StyleSheet, Dimensions, Alert } from 'react-native'; import { Transaction } from 'react-native-edfapay-softpos-sdk'; import * as EdfaPayPlugin from 'react-native-edfapay-softpos-sdk'; const logo = require('../assets/images/edfapay_text_logo.png'); const authCode = "Your_Sdk_Login_Auth_Code"; // Replace with your actual SDK Login Auth Code const amountToPay = "10.000"; // Simple dialog helper for the example class Dialog { alert(title: string, message: string) { Alert.alert( title, message, [ { text: 'OK', onPress: () => console.log('OK Pressed'), style: 'cancel' } ] ); } } const dialog = new Dialog(); // Strings for UI const Strings = { sdk: 'SDK', version: 'v0.1.2', message: "You\'re on your way to enabling your Android App to allow your customers to pay in a very easy and simple way just click the payment button and tap your payment card on NFC enabled Android phone." }; // Styles for UI const screen = Dimensions.get('window'); const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', }, content: { alignItems: 'center', }, logo: { width: screen.width / 1.5, resizeMode: 'contain', }, heading1: { fontSize: 65, fontWeight: "700", color: "#000", }, heading2: { fontSize: 30, fontWeight: "700", color: "#000", }, heading3: { marginHorizontal: 30, fontSize: 13, fontWeight: "400", color: "#787878", marginVertical: 100, }, buttonContainer: { position: 'absolute', bottom: 20, left: 0, right: 0, marginHorizontal: 20, borderRadius: 10, overflow: 'hidden', }, }); export default function App() { const [initResult, setInitResult] = React.useState(); React.useEffect(() => { initiateSdk(setInitResult); }, []); return ( {Strings.sdk} {Strings.version} {Strings.message}