承接 dpsoft/saderat 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dpsoft/saderat

Composer 安装命令:

composer require dpsoft/saderat

包简介

Saderat bank payment

README 文档

README

License: GPL v2

Mabna Cart Aria is a iranian company work at bank payment and allow you to handle checkout in your website with iranian payment cart(Saderat Bank).

Why new version every year?!

بانک صادرات هر ساله ویرایش جدیدی از آستین بیرون میاره. فقط میشه گفت شرم‌آوره.

Installation

composer require dpsoft/saderat

Implementation

Attention: The Saderat Bank webservice just available with IP that allowed with Saderat Bank(by contract with Mabna cart company).

استفاده از درگاه بانک صادرات - مبنا - در زبان Php

Redirect customer with parameters to Saderat gateway

<?php use Dpsoft\Saderat\Saderat;

try{
    /**
    * @param int $terminalId The Saderat cart terminal id assign to you 
    */
    $request = new Saderat($terminalId);
	
    /**
     * @param string $callbackUrl The url that customer redirect to after payment
     * @param int $amount The amount that customer must pay
     * @param string $payload Optional addition data
	 *
	 * @method payRequest Return invoice id and you can save in your DB
	 *
     */
    $invoiceId = $request->request($callbackUrl, $amount, $payload);
	
    echo $request->getRedirectScript();
   
}catch (\Throwable $exception){
    echo $exception->getMessage();
}

Verify transaction or maybe rollback transaction in conditions

Customer redirect to callback url with all transaction data and you must verify or rollback transaction.
If you don't call verify(), after 30 min transaction rollback by system.

verify:

<?php
use Dpsoft\Saderat\Saderat;

try{
    /**
      * @var int $terminalId
      */
    $response = new Saderat($terminalId);
	
        /**
          * @method $verify return class of all response value and you can convert to array by toArray() method
          */
        $verifyData = $response->verify();
        /**
          * Check your amount with response amount
          */
        echo "Successful payment ...";
       
}catch (\Throwable $exception){
    echo $exception->getMessage();
}

Rollback transaction

Need access to rollback payment with Mabna Cart Company

<?php
use Dpsoft\Saderat\Saderat;

try{
    /**
      * @var int $terminalId
      */
    $response = new Saderat($terminalId);
	
    $response->rollbackPayment($digitalReceipt);
    	
    echo "Successful rollback transaction ...";
       
}catch (\Throwable $exception){
    echo $exception->getMessage();
}
Transaction data or response contains:
  • respcode: The code of transaction result, if this code equals 0, transaction is success and we can send verify or rollback request if this code equals -1 the customer cancelled payment
  • amount: Amount laid out of customer card(you must compare this amount with your amount for security reasons)
  • invoiceid: The invoice number of transaction
  • payload: The adition data we send with customer to Mabna cart gateway
  • terminalid: Terminal number
  • tracenumber: Tracking number of transaction
  • rrn: Bank document numer, this number generate by gateway and must save for tracking if it was needed
  • datepaid: Time of transaction
  • digitalreceipt: Digital Receipt for verify or rollback payment
  • issuerbank(string): The bank's name of customer cart
  • cardnumber: customer card number
  • respmsg: Message of transaction

  • You can access response data with get method of returned class and if you want access params by array you can call toArray() method.
    Get value by class object:

    $digitalReceipt = $verifyData->getDigitalReceipt();

    Get value by array:

    $verifyDataArray = $verifyData->toArray();
    $digitalReceipt = $verifyDataArray['digitalreceipt'];

    统计信息

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

    GitHub 信息

    • Stars: 5
    • Watchers: 2
    • Forks: 3
    • 开发语言: PHP

    其他信息

    • 授权协议: Unknown
    • 更新时间: 2018-02-24

    承接程序开发

    PHP开发

    VUE

    Vue开发

    前端开发

    小程序开发

    公众号开发

    系统定制

    数据库设计

    云部署

    网站建设

    安全加固