Integration

Welcome to the SmartpayGenie Developer Documentation. This documentation is designed to help developers integrate with the SmartpayGenie payment gateway platform.

Supported languages

SmartpayGenie offers a flexible API that can be integrated into your application using various programming languages, including:

Languages
Description
JavaScript
Use Node.js to simplify API interactions.
TypeScript
Integrate directly with our API using TypeScript
Python
Leverage Python to streamlined API interactions.
Go
Utilize Go for efficient integration.
PHP
Employ PHP library to simplify API calls.

API integration

To integrate SmartpayGenie into your application, you can use the following methods:

1. Server-Side Integration:

  • Make HTTP Requests: Use your preferred language's HTTP libraries (e.g., in JavaScript, in Python, in Go) to send requests to our API endpoints.
  • Authentication: Include your API keys in the request headers to authenticate your requests.
  • Handle Responses: Parse the JSON response from the API to process payment information, handle errors, and redirect users to the payment gateway.
  • 2. Client-Side Integration:

  • Make AJAX Requests: Use JavaScript's API or a library like Axios to make AJAX requests to our API.
  • Handle Responses: Process the API response and redirect the user to the payment gateway.
  • note:Be cautious when using client-side integration, as it exposes your API keys. Consider implementing security measures to protect sensitive information.

    API endpoints

    Refer to our API Referencefor a detailed list of endpoints and their corresponding request and response formats. Here are some key endpoints:

  • Create Payment:Initiates a payment and returns a payment URL.
  • Retrieve Payment:Fetches information about a specific payment.
  • Webhook Notifications: Receives notifications about payment statuses and events.
  • javascript
    
        const myHeaders = new Headers();
    myHeaders.append("token", "TlAWiePV51isvfuRZEHuCOW1ZDBeDHep2rnosIXHRVGvMwyFTMJZUVCeIneQJJ0h");
    myHeaders.append("Content-Type", "application/json");
    
    const raw = JSON.stringify({
      "customerId": "49438567-bc45-494c-b57d-80b41f193de7",
      "currency": "kes",
      "channel": "fiat"
    });
    
    const requestOptions = {
      method: "POST",
      headers: myHeaders,
      body: raw,
      redirect: "follow"
    };
    
    fetch("https://api.switch.tulupay.com/customer/add-account", requestOptions)
      .then((response) => response.text())
      .then((result) => console.log(result))
      .catch((error) => console.error(error));
    
        }

    For more detailed information and code examples, please refer to the API Reference section of this documentation.