lipad/lipad-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lipad/lipad-sdk

最新稳定版本:v1.0.0

Composer 安装命令:

composer require lipad/lipad-sdk

包简介

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

README 文档

README

Introduction

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

Prerequisites

Before getting started, ensure you have the following:

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

Installation

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

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

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

    use Lipad\LipadSdk\Lipad;
    
    // Replace these values with your actual credentials
    $IVKey = 'your_iv_key';
    $consumerSecret = 'your_consumer_secret';
    $environment = 'sandbox';
    

Checkout Usage

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

    $lipad = new Lipad($IVKey, $consumerKey, $consumerSecret, $environment);
    
  2. Validate Payload

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

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

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

    try {
        $checkoutUrl =
        'https://checkout2.dev.lipad.io/?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 Lipad class, provide the $IVKey, $consumerSecret, and $environment parameters. The $environment should be one of the following: 'production' or 'sandbox'.

    $lipad = new Lipad($IVKey, $consumerSecret, $environment);
    
  2. Direct Charge

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

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

License

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

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-03