paymentsdk/payment-sdk

Secure and user-friendly checkout and direct charge API SDK for PHP applications for PaymentSDK Transactions.

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/paymentsdk/payment-sdk

v1.0.0 2025-08-08 14:11 UTC

This package is auto-updated.

Last update: 2026-01-08 15:08:36 UTC


README

Introduction

The PaymentSDK for PHP facilitates the integration of Payment SDK's payment and checkout features into your PHP applications. This comprehensive guide will assist you in the setup and utilization of the PaymentSDK.

Prerequisites

Before getting started, ensure you have the following:

  • PHP installed on your server or development environment.
  • Payment SDK API credentials, including the IV Key, Consumer Secret, Consumer Key.

Installation

  1. Download the Payment SDK: Download the Payment SDK and include it in your project.

    # Example using Composer
    composer require paymentsdk/payment-sdk
    
  2. Include the Composer autoloader in your PHP file:

    require_once 'vendor/autoload.php';
    
  3. Instantiate the PaymentSDK class with your credentials:

    use PaymentSDK\PaymentSDK\PaymentSDK;
    
    // Replace these values with your actual credentials
    $IVKey = 'your_iv_key';
    $consumerSecret = 'your_consumer_secret';
    $environment = 'sandbox';
    $rootDomain = 'example.com'
    

Checkout Usage

  1. To initialize the PaymentSDK class, provide the $IVKey, $consumerKey, $consumerSecret, $rootDomain, and $environment parameters. The $environment should be one of the following: 'production' or 'sandbox'.

    $PaymentSDK = new PaymentSDK($IVKey, $consumerKey, $consumerSecret, $rootDomain, $environment);
    
  2. Validate Payload

    try {
    $PaymentSDK->validateCheckoutPayload($payload);
    } catch (Exception $error) {
    echo 'Error: ' . $error->getMessage() . "\n";
    }
    
  3. Encrypt Payload

    $encryptedPayload = $PaymentSDK->encrypt($payload);
    
  4. Get Checkout Status

    try {
    $PaymentSDK->getCheckoutStatus($payload["merchant_transaction_id"]);
    } catch (Exception $error) {
    echo 'Error: ' . $error->getMessage() . "\n";
    }
    
  5. Build Checkout URL

    try {
        $checkoutUrl =
        'https://sandbox.checkout.{{rootDomain}}/?access_key=' .
        urlencode($accessKey) .
        '&payload=' .
        urlencode($encryptedPayload);
         echo 'Checkout URL: ' . $checkoutUrl . "\n";
       } catch (Exception $error) {
         echo 'Error: ' . $error->getMessage() . "\n";
       }
    

Direct API Usage

  1. To initialize the PaymentSDK class, provide the $IVKey, $consumerSecret, $rootDomain, and $environment parameters. The $environment should be one of the following: 'production' or 'sandbox'.

    $PaymentSDK = new PaymentSDK($IVKey, $consumerSecret, $rootDomain, $environment);
    
  2. Direct Charge

    try {
    $PaymentSDK->DirectCharge($payload);
    } catch (Exception $error) {
     echo 'Error: ' . $error->getMessage() . "\n";
    }
    
  3. Get Charge Request Status

    try {
    $PaymentSDK->getChargeRequestStatus($chargeRequestId);
    } catch (Exception $error) {
    echo 'Error: ' . $error->getMessage() . PHP_EOL;
    }
    

License

This SDK is open-source and available under the MIT License.