You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Quaderno发票账单地址与公司名称不显示问题

Quaderno发票未显示账单地址与公司名的修复方案

核心问题分析

你的代码存在两个关键的字段匹配错误,同时忽略了Quaderno模板配置的影响:

  • 商家公司名的字段传入方式不符合SDK要求
  • 客户账单地址的字段结构与Quaderno API规范不匹配

具体修复步骤

1. 修正商家公司名的传入逻辑

Quaderno不会读取根级的company_name字段来显示商家信息,你需要二选一:

  • 全局配置(推荐):直接在Quaderno后台的「账户设置」里完善商家名称、地址等信息,所有发票会自动继承这些内容
  • 单交易覆盖:如果需要为特定发票自定义商家信息,在transactionDetails中添加seller对象:
$transactionDetails['seller'] = [
    'name' => 'Your Business Name',
    'address_line_1' => 'Your Business Street',
    'city' => 'Your Business City',
    'postal_code' => 'Your ZIP Code',
    'country' => 'US'
];

2. 调整客户账单地址的字段结构

Quaderno的customer对象不支持嵌套的billing_address,需要把地址字段直接平级放在customer下:

if ($Customer) {
    $transactionDetails['customer'] = [
        'first_name' => $Customer->firstname,
        'last_name' => $Customer->lastname,
        'email' => $Customer->email,
        'address_line_1' => 'Street Name',
        'city' => 'City Name',
        'postal_code' => 'Postal Code',
        'country' => 'Country Code' // 确保是ISO 2位代码,比如US、GB
    ];
}

3. 验证模板配置

登录Quaderno后台,进入「模板」页面,检查你当前使用的发票模板:

  • 确认模板中已经添加了商家信息的占位符(比如{{seller.name}})
  • 确认客户地址的占位符(比如{{customer.address_line_1}}、{{customer.city}})已经包含在模板里

4. 调试请求数据

在调用$transaction->save()之前,打印完整的请求数据,确认字段结构完全符合要求:

public function createInvoice($transactionDetails, $items = [])
{
    // 添加调试代码
    var_dump($transactionDetails);
    exit;
    
    $transaction = new QuadernoTransaction($transactionDetails);
    // ... 原有代码
}

内容的提问来源于stack exchange,提问作者Ittefaq Technologies

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 11:23:13