Coder Social home page Coder Social logo

lakalasdk's Introduction

拉卡拉收银台SDK

文档地址

使用说明

收银台订单创建

$lakala = new \Linshaoneng\LakalaSdk\Lakala([
    'appid' => 'OP00000xxx',
    'merchantNo' => 'xxx',
    'mchSerialNo' => 'xxx',
    'merchantPrivateKeyPath' => '/lakala/key/xxx.pem',
    'lklCertificatePath' => '/lakala/key/xxx.cer',
    'notifyUrl' => 'http://127.0.0.1/notify',
    'callbackUrl' => 'http://127.0.0.1/callback',
]);

// 金额 分
$result = $lakala->orderCreate('订单标题', '订单号', '200');

收银台支付验签

$returnData = [
    "code" => "SUCCESS",
    "message" => "执行成功"
];

$authorization = $_SERVER['HTTP_AUTHORIZATION'];
$response = file_get_contents("php://input");

$lakala = new \Linshaoneng\LakalaSdk\Lakala([
    'appid' => 'OP00000xxx',
    'merchantNo' => 'xxx',
    'mchSerialNo' => 'xxx',
    'merchantPrivateKeyPath' => '/lakala/key/xxx.pem',
    'lklCertificatePath' => '/lakala/key/xxx.cer',
]);

if(!$lakala->signatureVerification($authorization, $response)) {
    //签名不通过
    $returnData = [
        "code" => "ERROR",
        "message" => "签名不通过"
    ];
}

return $returnData;

主扫交易接口

require __DIR__.'/vendor/autoload.php';


$lakala = new \Linshaoneng\LakalaSdk\Lakala([
    'appid' => 'OP00000003',
    'merchantNo' => '8221210594300JY',
    'mchSerialNo' => '00dfba8194c41b84cf',
    'merchantPrivateKeyPath'   => 'tests/tests/OP00000003_private_key.pem',
    'lklCertificatePath'       => 'tests/tests/OP00000003_cert.cer',
    'notifyUrl' => 'http://127.0.0.1/notify',
    'callbackUrl' => 'http://127.0.0.1/callback',
], 'test');

// 金额 分
$termNo = 'A0073841';
$locationInfo = ['request_ip'=>'123.72.62.189'];
$outOrderNo = time();
$totalAmount = 1;
$subject = '证件照001';
$accBusiFields = ['sub_appid'=>'wx9ef39b708f16694d', 'user_id'=>'oYOA95UOoDM9wXiM3TZ_OMGtQnPA'];
try {
    $result = $lakala->transPreorder($termNo, $locationInfo, $outOrderNo, $totalAmount, $subject, $accBusiFields);
    print_r($result['resp_data']['acc_resp_fields']);
    // echo json_encode($result['resp_data']['acc_resp_fields']);
} catch(\Throwable $e) {
    echo "\r\n";
    print_r($e->getMessage());
}

lakalasdk's People

Contributors

linshaoneng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.