PHP code example of buqiu / invoice
1. Go to this page and download the library: Download buqiu/invoice library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
buqiu / invoice example snippets shell script
php artisan vendor:publish
return [
// 开放平台appKey
'app_key' => '',
// 开放平台appSecret
'app_secret' => '',
// 临时授权码
'code' => '',
// 授权商户税号
'tax_num' => '',
// 授权回调地址
'redirect_uri' => '',
// 环境 沙箱环境https://sandbox.nuonuocs.cn/open/v1/services 正式环境https://sdk.nuonuo.com/open/v1/services
'url' => '',
// 开票回调地址
'call_back_url' => '',
// 销方电话
'saler_tel' => '',
// 销方地址
'saler_address' => '',
// 销方银行开户行及账号(二手车销售统一发票时必填)
'saler_account' => '',
// 复核人
'checker' => '',
// 收款人
'payee' => '',
// 部门门店id(诺诺系统中的id)
'department_id' => '',
// 开票员id
'clerk_id' => '',
// 开票员(全电发票时需要传入和开票登录账号对应的开票员姓名)
'clerk' => '',
// 是否机动车销售统一发票
'is_vehicle' => '0',
// 开具二手车销售统一发票才需要传
'is_second_hand_car' => '0',
];
public function api()
{
$invoiceSdk = new InvoiceSDK(config('invoice'));
$token = $invoiceSdk->getMerchantToken();// 访问令牌
// API方法名 :
// nuonuo.ElectronInvoice.requestBillingNew 开具发票
// nuonuo.ElectronInvoice.queryInvoiceResult 获取发票结果
$method = "nuonuo.ElectronInvoice.queryInvoiceResult";
$body = $invoiceSdk->getBody($params,$method); // 获取过滤参数
$senid = "唯一标识,32位随机码";
$res = $invoiceSdk->sendPostSyncRequest($senid, $token->access_token, $method, $body);
return $res;
}