火星-iq/iqpay

伊拉克电子支付 PHP API,支持Providoor QiCard、aps、zaincash、amwal(PayTabs)、switch等多个支付网关,通过一个类实现

v1.1 2021-10-01 16:45 UTC

This package is auto-updated.

Last update: 2024-09-05 05:27:52 UTC


README

MarTeam/iq-epay

这段代码是用yanhad黑客马拉松编写的,目前处于测试阶段

用途

PHP OOP,Curl,Php HttpClint,JWT

问题

现在大多数应用程序都内置了电子支付工具,在编码过程中会遇到许多挑战。其中,各种支付网关的多样性可能在编码环境中难以实现,这是由于文档、链接和工作行为的多样性造成的。

目标

提供一个旨在克服电子支付挑战的特定包,通过构建一个单一的对象,然后调用一个单元函数及其参数,以实现在所有网关中的支付过程。

支付网关

1-APS (Validated)
2-QiCard (Validated)
3-Amwal(PayTabs) (Validated)
4-ZainCash (Validated)
5-Switch (Validated)
6-Tasdid (Beta)

解决方案

构建一组问题解决对象,协同工作,在每个特定网关中成功实现电子支付任务。

安装

使用composer管理依赖关系并下载mars-iq/iqpay(仅支持Composer版本2)

composer require mars-iq/iqpay:dev-master 
    

安装配置文件

现在您应该在项目的根目录中添加config.json文件,如下所示(所有这些配置都是由源代码提供的)

{
    "aps": {
        "username": "xxxxxxxxxx",
        "password": "xxxxxxxxxx",
        "urlapi": "http://api.example.com",
        "redirect": true
    },
    "qi": {
      
        "serverkey": "xxxxxxxxxx",
          "urlapi": "http://api.example.com"
    },
    "zaincash": {
        "Msisdn": "xxxxxxxxxx",
        "Merchant_Id": "xxxxxxxxxx",
        "Secret": "xxxxxxxxxx",
        "production_cred": false
    },
    "switch": {
        "tokenSwitch": "xxxxxxxxxx",
        "entityId": "xxxxxxxxxx",
        "urlapi": "http://api.example.com"

    },
    "tasdid": {
        "username": "xxxxxxxxxx",
        "password": "xxxxxxxxxx",
        "serviceId": "xxxxxxxxxx",
        "urlapi": "http://api.example.com"

    },
    "amwal": {
        "serverkey": "xxxxxxxxxx",
        "profileid": "xxxxxxxxxx",
        "urlapi": "http://api.example.com"

    }

}

使用对象

      use \iqpay\PayClass;
      use \iqpay\getWays;

示例

  
     $PayClass = new PayClass();
     $PayClass->amount = "10000";
     $PayClass->currency = "IQD";// or USD
     $PayClass->returnUrl = "http://example.com";
     $PayClass->failUrl = "http://example.com";
     $PayClass->language = "ar";// or "en"
     $PayClass->description = "xxxxxxx";
     $PayClass->ordernum = "xxxxxxx";
     $PayClass->nameCostumer = "xxxxxxx";
     $PayClass->phoneCostumer = "xxxxxxx";
     $PayClass->method =getWays::qi; //  or "getWays::qi" or "getWays::zaincash" or "getWays::aps"   or "getWays::amwal"
     $response=$PayClass->Pay();//to procces Pay  - response (transiction_id,url) status=>1 is succes or status=> 0 if have erorr and response=>xxxx
     //array(transiction_id,url)  url use for redirect to the payment getway examlpe: header('location: http://paygate.com')
     //transiction_id to save in your database

示例:Switch MasterCard

    $PayClass = new PayClass();
    $PayClass->method=getWays::switch;
    $PayClass->amount="90";
    $PayClass->cardNumber="xxxxxxxxxxxxxxx";
    $PayClass->cardHolder="xxxxxxxxxxxxxxx";
    $PayClass->currency="IQD"; // or USD
    $PayClass->Mounth="xxx";
    $PayClass->Year="xxx";
    $PayClass->Cvv="xxx";

    $response=$PayClass->PaySwitch();//to procces Pay  - response (transiction_id) and status=>1 success or status=>0 if have erorr
    //transiction_id to save in your database

示例:检查进程成功(APS,QiCard)

   $orderId = "xxxxxxxxxxxxxxxxxxxx";
   $transiction_id = "xxxxxxxxxxxxxxxxxxxx";
   $PayClass = new PayClass();
   $PayClass->method = getWays::aps;// or getWays::qi
   $res = $PayClass->checkOrder($orderId,$transiction_id); // return -1 not supported  or 'status'=> 1 succes or 'status'=> 2 error and response

示例:取消订单(QiCard)

   $orderId = "xxxxxxxxxxxxxxxxxxxx";
   $transiction_id = "xxxxxxxxxxxxxxxxxxxx";
   $PayClass = new PayClass();
   $PayClass->method = getWays::qi;
   $res = $PayClass->QiVoidOrder($orderId,$transiction_id); // return -1 not supported  or 'status'=> 1 succes or 'status'=> 2 error and response

   PayClass     Payment interfaces interconnection 
   MainClass    Configuration Payments Gate	 
   ApsClass     Aps Payment Gate 
   QiClass     QiCard Payment Gate 
   AmwalClass 	Amwal(PayTabs) Payment Gate	
   ZainCash	    ZainCash Payment Gate		
   SwitchClass	Switch Payment Gate	
   TasdidClass	Tasdid Payment Gate