FuturaPay Gateway SDK Implementation in Core PHP
Installation
To install the FuturaPay SDK, run the following command:
composer require futurapay/sdk
Core PHP Implementation
Setup: make the index.php
file Include the autoload file and create an instance of the FuturaPay
class.
<?php
// Include the Composer autoload file
require "vendor/autoload.php";
// Use the FuturaPay SDK
use Futurapay\Sdk\Gateway\FuturaPay;
// Merchant credentials
$merchant_key = "YOUR_MERCHANT_KEY"; // Replace with your merchant key
$site_id = "YOUR_SITE_ID"; // Replace with your site ID
$api_key = "YOUR_API_KEY"; // Replace with your API key
// Transaction details
$transaction_data = array(
"currency" => "CURRENCY_CODE", // Currency code (e.g., EUR, USD)
"amount" => "TRANSACTION_AMOUNT", // Transaction amount (e.g., 500)
"customer_transaction_id" => rand(10000000, 99999999), // Unique transaction ID
"country_code" => "COUNTRY_CODE", // Customer country code (e.g., DE, US)
"customer_first_name" => "FIRST_NAME", // Customer's first name
"customer_last_name" => "LAST_NAME", // Customer's last name
"customer_phone" => "PHONE_NUMBER", // Customer's phone number
"customer_email" => "EMAIL_ADDRESS", // Customer's email address
);
// Initialize FuturaPay gateway
$gateway = new FuturaPay($merchant_key, $api_key, $site_id);
$gateway->setEnv("sandbox") //when you have go in live update thie parameter with "live"
$gateway->setType("deposit") // you change the parameter according the requirement lke "deposit" or "withdraw"
$gateway->initialize($transaction_data);
Process Payment: After initializing the gateway with transaction details, you can proceed with payment processing. Ensure to handle any responses or exceptions as per your application's requirements.
Complete Example
Here is a complete implementation of the FuturaPay gateway in a basic Core PHP application:
<?php
require "vendor/autoload.php";
use Futurapay\Sdk\Gateway\FuturaPay;
$merchant_key = "TMXXXXXXXXXXXXXXXX"; // Replace with your merchant key
$site_id = "831206409"; // Replace with your site ID
$api_key = "apiKey66a33e22470a2"; // Replace with your API key
// Transaction details
$transaction_data = array(
"currency" => "EUR",
"amount" => "500",
"customer_transaction_id" => rand(10000000, 99999999),
"country_code" => "DE",
"customer_first_name" => "Tanmoy",
"customer_last_name" => "Sharma",
"customer_phone" => "8617821668",
"customer_email" => "tanmoy.biswas.techexactly@gmail.com",
);
// Initialize FuturaPay gateway
$gateway = new FuturaPay($merchant_key, $api_key, $site_id);
$gateway->setEnv("sandbox") //when you have go in live update thie parameter with "live"
$gateway->setType("deposit") // you change the parameter according the requirement lke "deposit" or "withdraw"
$gateway->initialize($transaction_data);
Notes
- Make sure to replace the placeholder values (
YOUR_MERCHANT_KEY
,YOUR_SITE_ID
,YOUR_API_KEY
,CURRENCY_CODE
,TRANSACTION_AMOUNT
,COUNTRY_CODE
,FIRST_NAME
,LAST_NAME
,PHONE_NUMBER
,EMAIL_ADDRESS
) with your actual merchant credentials and transaction details before deploying your application. - Additional error handling and response management should be implemented based on your application's requirements.
- Always test your implementation in a safe environment before going live.
This documentation provides a clear and structured approach to implementing the FuturaPay gateway SDK in Core PHP. If you need further modifications or additional information, feel free to ask!
FuturaPay Gateway SDK Implementation in Laravel
Installation
To install the FuturaPay SDK, run the following command:
composer require futurapay/sdk
Laravel Implementation
Setup: Include the package in your Laravel controller.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Futurapay\Sdk\Gateway\FuturaPay;
class PaymentController extends Controller
{
public function processPayment(Request $request)
{
// Merchant credentials
$merchant_key = "YOUR_MERCHANT_KEY"; // Replace with your merchant key
$site_id = "YOUR_SITE_ID"; // Replace with your site ID
$api_key = "YOUR_API_KEY"; // Replace with your API key
// Transaction details
$transaction_data = array(
"currency" => "CURRENCY_CODE", // Currency code (e.g., EUR, USD)
"amount" => "TRANSACTION_AMOUNT", // Transaction amount (e.g., 500)
"customer_transaction_id" => rand(10000000, 99999999), // Unique transaction ID
"country_code" => "COUNTRY_CODE", // Customer country code (e.g., DE, US)
"customer_first_name" => "FIRST_NAME", // Customer's first name
"customer_last_name" => "LAST_NAME", // Customer's last name
"customer_phone" => "PHONE_NUMBER", // Customer's phone number
"customer_email" => "EMAIL_ADDRESS", // Customer's email address
);
// Initialize FuturaPay gateway
$gateway = new FuturaPay($merchant_key, $api_key, $site_id);
$gateway->setEnv("sandbox") //when you have go in live update thie parameter with "live"
$gateway->setType("deposit") // you change the parameter according the requirement lke "deposit" or "withdraw"
$gateway->initialize($transaction_data);
}
}
Route Setup: Add a route in routes/web.php
for payment processing.
use App\Http\Controllers\PaymentController;
Route::post('/process-payment', [PaymentController::class, 'processPayment']);
Complete Example
Here is a complete implementation of the FuturaPay gateway in a Laravel application:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Futurapay\Sdk\Gateway\FuturaPay;
class PaymentController extends Controller
{
public function processPayment(Request $request)
{
// Merchant credentials
$merchant_key = "TMXXXXXXXXXXXXXXXX"; // Replace with your merchant key
$site_id = "831206409"; // Replace with your site ID
$api_key = "apiKey66a33e22470a2"; // Replace with your API key
// Transaction details
$transaction_data = array(
"currency" => "EUR",
"amount" => "500",
"customer_transaction_id" => rand(10000000, 99999999),
"country_code" => "DE",
"customer_first_name" => "Tanmoy",
"customer_last_name" => "Sharma",
"customer_phone" => "8617821668",
"customer_email" => "tanmoy.biswas.techexactly@gmail.com",
);
// Initialize FuturaPay gateway
$gateway = new FuturaPay($merchant_key, $api_key, $site_id);
$gateway->setEnv("sandbox") //when you have go in live update thie parameter with "live"
$gateway->setType("deposit") // you change the parameter according the requirement lke "deposit" or "withdraw"
$gateway->initialize($transaction_data);
}
}
Notes
- Make sure to replace the placeholder values (
YOUR_MERCHANT_KEY
,YOUR_SITE_ID
,YOUR_API_KEY
,CURRENCY_CODE
,TRANSACTION_AMOUNT
,COUNTRY_CODE
,FIRST_NAME
,LAST_NAME
,PHONE_NUMBER
,EMAIL_ADDRESS
) with your actual merchant credentials and transaction details before deploying your application. - Additional error handling and response management should be implemented based on your application's requirements.
- Always test your implementation in a safe environment before going live.
FuturaPay Gateway SDK Implementation in CodeIgniter 4
Installation
To install the FuturaPay SDK, run the following command:
composer require futurapay/sdk
CodeIgniter 4 Implementation
Setup Controller: Create a new controller for payment processing, e.g., PaymentController.php
.
<?php
namespace App\Controllers;
use CodeIgniter\HTTP\RequestInterface;
use Futurapay\Sdk\Gateway\FuturaPay;
class PaymentController extends BaseController
{
public function processPayment()
{
// Merchant credentials
$merchant_key = "YOUR_MERCHANT_KEY"; // Replace with your merchant key
$site_id = "YOUR_SITE_ID"; // Replace with your site ID
$api_key = "YOUR_API_KEY"; // Replace with your API key
// Transaction details
$transaction_data = array(
"currency" => "CURRENCY_CODE", // Currency code (e.g., EUR, USD)
"amount" => "TRANSACTION_AMOUNT", // Transaction amount (e.g., 500)
"customer_transaction_id" => rand(10000000, 99999999), // Unique transaction ID
"country_code" => "COUNTRY_CODE", // Customer country code (e.g., DE, US)
"customer_first_name" => "FIRST_NAME", // Customer's first name
"customer_last_name" => "LAST_NAME", // Customer's last name
"customer_phone" => "PHONE_NUMBER", // Customer's phone number
"customer_email" => "EMAIL_ADDRESS", // Customer's email address
);
// Initialize FuturaPay gateway
$gateway = new FuturaPay($merchant_key, $api_key, $site_id);
$gateway->setEnv("sandbox") //when you have go in live update thie parameter with "live"
$gateway->setType("deposit") // you change the parameter according the requirement lke "deposit" or "withdraw"
$gateway->initialize($transaction_data);
}
}
Route Setup: Add a route for payment processing in app/Config/Routes.php
.
$routes->post('/process-payment', 'PaymentController::processPayment');
Calling the Payment Process: You can trigger the payment process by making a POST request to the /process-payment
route from your front-end form or client application.
Complete Example
Here is a complete implementation of the FuturaPay gateway in a CodeIgniter 4 application:
<?php
namespace App\Controllers;
use CodeIgniter\HTTP\RequestInterface;
use Futurapay\Sdk\Gateway\FuturaPay;
class PaymentController extends BaseController
{
public function processPayment()
{
// Merchant credentials
$merchant_key = "TMXXXXXXXXXXXXXXXX"; // Replace with your merchant key
$site_id = "831206409"; // Replace with your site ID
$api_key = "apiKey66a33e22470a2"; // Replace with your API key
// Transaction details
$transaction_data = array(
"currency" => "EUR",
"amount" => "500",
"customer_transaction_id" => rand(10000000, 99999999),
"country_code" => "DE",
"customer_first_name" => "Tanmoy",
"customer_last_name" => "Sharma",
"customer_phone" => "8617821668",
"customer_email" => "tanmoy.biswas.techexactly@gmail.com",
);
// Initialize FuturaPay gateway
$gateway = new FuturaPay($merchant_key, $api_key, $site_id);
$gateway->setEnv("sandbox") //when you have go in live update thie parameter with "live"
$gateway->setType("deposit") // you change the parameter according the requirement lke "deposit" or "withdraw"
$gateway->initialize($transaction_data);
}
}
Notes
- Make sure to replace the placeholder values (
YOUR_MERCHANT_KEY
,YOUR_SITE_ID
,YOUR_API_KEY
,CURRENCY_CODE
,TRANSACTION_AMOUNT
,COUNTRY_CODE
,FIRST_NAME
,LAST_NAME
,PHONE_NUMBER
,EMAIL_ADDRESS
) with your actual merchant credentials and transaction details before deploying your application. - Additional error handling and response management should be implemented based on your application's requirements.
- Always test your implementation in a safe environment before going live.
This documentation provides a clear and structured approach to implementing the FuturaPay gateway SDK in CodeIgniter 4. Let me know if you need further modifications or additional information!