Logo Lanfrica

Paymint-Africa/paymint-php

Domaine:

digital infrastructure

Type de record:

software
Créateur:
Pay
Hôte:
# PayMint Africa PHP SDK The official PHP SDK for PayMint Africa. This SDK allows you to easily integrate PayMint's powerful virtual accounts and secure webhooks into any core PHP application. ## Installation Install the package via Composer: ```bash composer require paymint/paymint-php ``` ## Requirements - PHP 8.1 or higher - Composer ## Usage Initialize the `PayMintClient` with your PayMint Secret Key. ```php require 'vendor/autoload.php'; use PayMint\PayMintClient; // 1. Initialize the SDK $paymint = new PayMintClient('sk_live_your_secret_key'); // 2. Create a Virtual Account $response = $paymint->virtualAccounts()->create([ 'name' => 'John Doe', 'email' => 'john@example.com', 'phone' => '08012345678', 'bvn' => '12345678901' // Optional depending on your strict compliance settings ]); print_r($response); ``` ### Webhook Signature Verification When receiving webhooks (like when a customer transfers money to a virtual account), you must verify the signature to ensure the request actually came from PayMint and wasn't spoofed by a hacker. The SDK makes this effortless: ```php $payload = file_get_contents('php://input'); $signature = $_SERVER['HTTP_X_PAYMINT_SIGNATURE'] ?? ''; // Verify the signature securely if (!$paymint->webhooks()->verifySignature($payload, $signature)) { http_response_code(401); die('Invalid signature detected.'); } // Process webhook safely! echo "Webhook verified successfully!"; ``` ## License MIT License