创建 SwissQR 账单 API
此端点的作用
PDF4me 创建 SwissQR 账单 瑞士人 QR 符合瑞士规定的付款单 QR-账单标准(瑞士支付标准, SPS)通过单个 REST 拨打电话。发送 债权人和最终债务人的详细信息 IBAN金额、货币、参考类型、语言、分隔符样式和输出格式(可选)包含源文档 Base64,blob ID,或 URL 将滑移层覆盖在现有滑移层上 PDF。 这 API 返回 PDF, PNG, JPEG, 或者 TIFF 根据 格式类型。
验证您的身份 API 要求
每一个 PDF4me REST API 通话必须包含您的 API 关键在于 Authorization 标题。从开发者控制面板创建或选择一个密钥,并妥善保管。
端点
/api/v2/CreateSwissQrBill您不容错过的重要事实
他们要走了 必须从 CH 后面跟着19位数字。无效密码。 IBAN 返回错误。crAddressType 和 udAddressType 到 S 因此,街道、门牌号、邮政编码和城市分别存储。大多数瑞士银行自动对账系统都要求采用这种布局。 K (合并)仅当无法拆分地址分量时才使用。非 对于没有结构化参考信息的付款。 QRR 用于瑞士国内纸币上的 27 位数字参考编号。 得分 为了 ISO 11649 债权人证明。请提供。 参考 使用时在体内 QRR 或者 SCOR。REST API 端点
方法: 邮政
网址: https://api.pdf4me.com/api/v2/CreateSwissQrBill
放 IsAsync 到 真的 (PascalCase) 为了 202 Accepted 并进行民意调查 地点 URL 和 GET 直到你收到 200 以及该文件 JSON。 使用 错误的 对于同步 200 回复。
Postman 请求设置
| 环境 | 价值 |
|---|---|
| Method | POST |
| URL | https://api.pdf4me.com/api/v2/CreateSwissQrBill |
| Headers | Content-Type: application/json |
| Authorization | Basic Auth with your API key, or header Authorization: Basic YOUR_API_KEY |
| Async | If the response is 202, poll the URL in the Location header (GET) until you get 200 and the file bytes (or JSON with document fields, depending on API version). |
参数
始终需要: 他们要走了, crName, crAddressType, crStreetOrAddressLine1, crStreetOrAddressLine2, crPostalCode, crCity, 数量, 货币, udName, udAddressType, udStreetOrAddressLine1, udStreetOrAddressLine2, udPostalCode, udCity, 参考类型, 语言类型, 分隔线, 格式类型, 和 IsAsync。
条件: 文档内容 和 文档名称 在 PDF 上叠加时; 参考 什么时候 参考类型 是 QRR 或者 得分; 分页选项 和 页码 什么时候 格式类型 是 pdf。
选修的: 非结构化消息, 账单信息, av1, av2, 简介。
| 范围 | 必需的 | 适用于 | 它的作用 | 例子 |
|---|---|---|---|---|
docContent | Conditional | Overlay on existing PDF | Omit or empty string = standalone QR slip only. Otherwise Base64 PDF/image bytes (no data: prefix), blob id from POST /api/v2/UploadBlob, or HTTPS URL to the source file. | "" |
docName | Conditional | With docContent | File name for input/output context. Omit or empty when no source document. | invoice.pdf |
iban | Yes | Every request | Creditor Swiss IBAN. | CH0200700110003765824 |
crName | Yes | Every request | Creditor name or company as registered with the bank. | Test AG |
crAddressType | Yes | Every request | S = structured (street + building) or K = combined address lines. | S |
crStreetOrAddressLine1 | Yes | Every request | If S: street name (max ~70 chars). If K: first address line. | Test Strasse |
crStreetOrAddressLine2 | Yes | Every request | If S: house number (max ~16). If K: second address line. | 1 |
crPostalCode | Yes | Every request | Creditor postal code (max ~16). | 8000 |
crCity | Yes | Every request | Creditor city (max ~35). | Zurich |
amount | Yes | Every request | Payment amount without leading zeros (string). Example: "1000" = 1000.00. | 1000 |
currency | Yes | Every request | CHF or EUR. | CHF |
udName | Yes | Every request | Ultimate debtor name or company (required by API; may be empty strings if unused). | Test Debt AG |
udAddressType | Yes | Every request | S or K; same rules as crAddressType. | S |
udStreetOrAddressLine1 | Yes | Every request | Debtor street or address line 1. | Test Deb Strasse |
udStreetOrAddressLine2 | Yes | Every request | Debtor street number or address line 2. | 2 |
udPostalCode | Yes | Every request | Debtor postal code. | 8000 |
udCity | Yes | Every request | Debtor city. | Zurich |
referenceType | Yes | Every request | NON = no reference, QRR = QR reference, SCOR = creditor reference. | NON |
reference | Conditional | referenceType = QRR or SCOR | Required for QRR or SCOR; max 27 characters. Omit for NON. | 21000000000313947143000017 |
languageType | Yes | Every request | English, German, French, or Italian. | English |
seperatorLine | Yes | Every request | API spelling is seperatorLine (one a). LineWithScissor, DottedLine, or SolidLine. | LineWithScissor |
formatType | Yes | Every request | Output format: pdf, png, jpeg, tiff, or null (default PDF behavior). | pdf |
pagingOptions | Conditional | formatType = pdf | first, last, AddPageAtEnd, or custom. Omit or null for non-PDF formats. | first |
pageNumber | Conditional | pagingOptions = custom | Integer >= 1; single page index when pagingOptions is custom. | 1 |
unstructuredMessage | No | Optional | Free-form payment note. Max 140 characters. | Thank you for your business |
billingInfo | No | Optional | Customer billing information. | Invoice for services rendered |
av1 | No | Optional | Alternative scheme parameter 1. | |
av2 | No | Optional | Alternative scheme parameter 2. | |
profiles | No | Optional | Custom API profile JSON string. See API documentation for profile options. | { "someOption": true } |
IsAsync | Yes | Every request | PascalCase IsAsync. true = HTTP 202 and poll Location. false = synchronous HTTP 200. | true |
地址类型选项
适用于 crAddressType 和 udAddressType。
S(结构化)推荐用于自动对账K(综合)两条自由格式地址线分隔线选项(seperatorLine)
用剪刀画线虚线实线参考类型选项
非没有结构化参考非结构化消息 改为自由格式笔记,而不是 参考。QRR27 位二维码参考参考 以 27 位数字字符串的形式。得分ISO 11649 债权人参考参考 在 ISO 11649 格式(以……开头) RF)。输出格式(formatType) 和 PDF 分页
什么时候 格式类型 是 pdf, 放 分页选项 控制位置 QR 放置滑片。对于图像输出,请省略。 分页选项 或者将其设置为 无效的。
formatType: pdfpagingOptions: firstformatType: pdfpagingOptions: lastformatType: pdfpagingOptions: AddPageAtEndformatType: pdfpagingOptions: custom + pageNumberformatType: png | jpeg | tiffpagingOptions: null输出字段
| 场地 | 类型 | 它包含什么 |
|---|---|---|
docName | String | Output file name. |
docContent | Base64 | Generated file (PDF or image per formatType). Decode before saving or streaming. |
请求示例
示例 A:独立式 QR 账单(无输入) PDF)
省略 文档内容 或者发送一个空字符串,仅生成 QR 付款单。
{
"docContent": "",
"docName": "",
"iban": "CH0200700110003765824",
"crName": "Test AG",
"crAddressType": "S",
"crStreetOrAddressLine1": "Test Strasse",
"crStreetOrAddressLine2": "1",
"crPostalCode": "8000",
"crCity": "Zurich",
"amount": "1000",
"currency": "CHF",
"udName": "Test Debt AG",
"udAddressType": "S",
"udStreetOrAddressLine1": "Test Deb Strasse",
"udStreetOrAddressLine2": "2",
"udPostalCode": "8000",
"udCity": "Zurich",
"referenceType": "NON",
"languageType": "English",
"seperatorLine": "LineWithScissor",
"formatType": "pdf",
"pagingOptions": "first",
"IsAsync": true
}
示例 B:叠加 QR 在现有基础上 PDF (Base64)
代替 文档内容 你的 PDF 作为 Base64 (不 数据: 前缀)。
{
"docContent": "JVBERi0xLjQKJeLjz9MKMy...",
"docName": "invoice.pdf",
"iban": "CH0200700110003765824",
"crName": "Test AG",
"crAddressType": "S",
"crStreetOrAddressLine1": "Test Strasse",
"crStreetOrAddressLine2": "1",
"crPostalCode": "8000",
"crCity": "Zurich",
"amount": "1000",
"currency": "CHF",
"udName": "Test Debt AG",
"udAddressType": "S",
"udStreetOrAddressLine1": "Test Deb Strasse",
"udStreetOrAddressLine2": "2",
"udPostalCode": "8000",
"udCity": "Zurich",
"referenceType": "NON",
"languageType": "English",
"seperatorLine": "LineWithScissor",
"formatType": "pdf",
"pagingOptions": "custom",
"pageNumber": 1,
"IsAsync": true
}
示例 C:复制粘贴有效 JSON
{
"docContent": "",
"docName": "",
"iban": "CH0200700110003765824",
"crName": "Test AG",
"crAddressType": "S",
"crStreetOrAddressLine1": "Test Strasse",
"crStreetOrAddressLine2": "1",
"crPostalCode": "8000",
"crCity": "Zurich",
"amount": "1000",
"currency": "CHF",
"udName": "Test Debt AG",
"udAddressType": "S",
"udStreetOrAddressLine1": "Test Deb Strasse",
"udStreetOrAddressLine2": "2",
"udPostalCode": "8000",
"udCity": "Zurich",
"referenceType": "NON",
"languageType": "English",
"seperatorLine": "LineWithScissor",
"formatType": "pdf",
"pagingOptions": "first",
"IsAsync": true
}
引用类型有效载荷
无参考文献(非):
{ "referenceType": "NON" }
QR参考码(QRR):
{
"referenceType": "QRR",
"reference": "21000000000313947143000017"
}
债权人参考编号(SCOR,ISO 11649):
{
"referenceType": "SCOR",
"reference": "RF18539007547034"
}
formatType 和 pageingOptions 代码片段
{ "formatType": "png", "pagingOptions": null }
{ "formatType": "pdf", "pagingOptions": "last" }
{ "formatType": "pdf", "pagingOptions": "AddPageAtEnd" }
{ "formatType": "pdf", "pagingOptions": "custom", "pageNumber": 1 }
代码示例
集成示例
常见的 REST 集成模式Typical ways developers call Create SwissQR Bill.
- 您的ERP系统会导出发票数据和PDF文件。
- 将 PDF 文件进行 Base64 编码
文档内容。 - POST 付款字段
参考类型QRR 和 27 位数字参考。 - 解码
文档内容从回复中获取并存储或通过电子邮件发送二维码账单 PDF 文件。
- 仅需撕取式收据,请附上空白收据并邮寄。
文档内容和格式类型pdf 或 png 格式。 - 对于通过 webhook 发送的发票,将 PDF 文件进行 Base64 编码。
文档内容, 放分页选项到最后的或者风俗以及 POST 付款字段。 - 解读回应
文档内容并上传到对象存储或附加到电子邮件 API。