### Saobei WAP Payment URL Construction Example Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rinsc3 An example demonstrating how to construct a URL for the Saobei WAP payment interface. This GET request includes various parameters required for initiating a WAP payment. ```http http://接口域名/open/wap/110/pay?auto_pay=0&merchant_no=¬ify_url=&其它参数=key_sign=签名验证串 ``` -------------------------------- ### Java SDK Example for Querying Refund Order Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rinsc3 This code snippet demonstrates how to use the Saobei Java SDK to query a refund order. It initializes the SaobeiApiClient with terminal credentials and then executes a `SaobeiTradeQueryRefundRequest` to retrieve the refund status. Ensure the `SaobeiApiClient` is correctly instantiated with your terminal token and secret. ```java SaobeiApiClient client = new DefaultSaobeiApiClient<>(terminalTokenSecret); SaobeiTradeQueryRefundRequest request = new SaobeiTradeQueryRefundRequest(); // Set request parameters like out_refund_no, terminal_trace, terminal_time, etc. SaobeiTradeQueryRefundResponse response = client.execute(request); // Process the response ``` -------------------------------- ### Apply for Electronic Receipt API Request Example Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/ua4c1l This snippet illustrates a JSON request to apply for an electronic receipt using the `/account/open/applyicreceipt` endpoint. It includes essential parameters like `api_ver`, `inst_no`, `trace_no`, `trade_type`, `out_trade_no`, and `key_sign`. ```json { "api_ver": "100", "inst_no": "YOUR_INST_NO", "trace_no": "YOUR_TRACE_NO", "account_no": "YOUR_ACCOUNT_NO", "trade_type": "1", "out_trade_no": "YOUR_OUT_TRADE_NO", "key_sign": "YOUR_KEY_SIGN" } ``` -------------------------------- ### Java SDK Refund Request Example Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rinsc3 This snippet demonstrates how to use the Saobei Java SDK to initiate a refund request. It requires a `SaobeiApiClient` configured with a terminal token and key. The `execute` method is used to send the `SaobeiTradeRefundRequest` and receive a `SaobeiTradeRefundResponse`. ```java SaobeiApiClient client = new DefaultSaobeiApiClient<>("terminal_token_key"); // Assuming SaobeiTradeRefundRequest and SaobeiTradeRefundResponse objects are properly instantiated and populated SaobeiTradeRefundResponse response = client.execute(refundRequest); // Process the refund response ``` -------------------------------- ### API POST Request for Refund Application Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rinsc3 This code example shows how to make a POST request to the `/pay/open/refund` endpoint to apply for a refund. It includes essential parameters like `pay_ver`, `pay_type`, `merchant_no`, `terminal_id`, `terminal_trace`, `terminal_time`, `refund_fee`, and `key_sign`. Depending on the refund method, `out_trade_no` or `pay_trace` and `pay_time` may also be required. ```bash POST /pay/open/refund HTTP/1.1 Host: example.com Content-Type: application/json { "pay_ver": "202", "pay_type": "000", "service_id": "030", "merchant_no": "your_merchant_no", "terminal_id": "your_terminal_id", "terminal_trace": "your_refund_trace_id", "terminal_time": "yyyyMMddHHmmss", "refund_fee": "1000", // Amount in cents "out_trade_no": "original_trade_no", // Optional, use if not using pay_trace/pay_time // OR // "pay_trace": "merchant_order_id_to_refund", // "pay_time": "payment_time_yyyyMMddHHmmss", "key_sign": "your_generated_key_sign" } ``` -------------------------------- ### Java SDK Maven 本地安装示例 Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rinsc3 展示如何使用Maven命令将本地下载的JAR包安装到本地仓库。安装后,可以通过Maven依赖进行引入。 ```bash //请自行根据电脑系统类型修改-Dfile指定的jar包所在路径格式,注意将命令中的-Dversion指定的jar包版本换成所下载的版本 mvn install:install-file -Dfile=D:\saobei-open-sdk-1.2.1.jar -DgroupId=com.lcsw.opensdk -DartifactId=saobei-open-sdk -Dversion=1.2.1 -Dpackaging=jar ``` -------------------------------- ### POST /pay/fenqi/queryrate - Installment Rate Query Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/dh995i This endpoint allows you to query the installment rates available for different payment periods. It returns a JSON array of available rates and their corresponding periods. ```APIDOC ## POST /pay/fenqi/queryrate ### Description Queries available installment rates for different payment periods. ### Method POST ### Endpoint `/pay/fenqi/queryrate` ### Parameters #### Request Body *Note: Request parameters can be empty for this endpoint.* ### Request Example ```json { } ``` ### Response #### Success Response (200) - **return_code** (String) - Response code: `01` success, `02` failure. This code only represents communication status, not business result. - **return_msg** (String) - Return message, indicates the reason for the error. - **result_code** (String) - Business result: `01` success, `02` failure. - **rate_list_json** (String) - JSON array string of installment rates. *Details for `rate_list_json`* - **periods** (String) - Number of installments, e.g., `3,6,12` periods. - **rate** (String) - Installment rate, in parts per thousand. #### Response Example ```json { "return_code": "01", "return_msg": "Success", "result_code": "01", "rate_list_json": "[{\"periods\": \"3,6,12\", \"rate\": \"2.5\"}, {\"periods\": \"24\", \"rate\": \"5.0\"}]" } ``` ``` -------------------------------- ### POST /invoice/quickFinishInvoice Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/di5i4o This endpoint allows for the creation of an invoice, specifying details about the goods, buyer, and payment. ```APIDOC ## POST /invoice/quickFinishInvoice ### Description Allows for the creation of an invoice, specifying details about the goods, buyer, and payment. Supports various invoice types and includes options for discount and tax handling. ### Method POST ### Endpoint `/invoice/quickFinishInvoice` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **api_ver** (String) - Required - Version number (default 200) - **merchant_no** (String) - Required - Merchant number - **terminal_id** (String) - Required - Terminal number - **trace_no** (String) - Required - Transaction serial number - **out_trade_no** (String) - Optional - Sweep pay order number. Cannot be empty simultaneously with issue_total_fee. (Note: If goods information is not empty, the total price including tax of goods cannot exceed the total order amount) - **issue_total_fee** (String) - Optional - Total invoice amount. (Note: If provided, the invoice amount will be equal to issue_total_fee, and the total price including tax of goods cannot exceed issue_total_fee) - **invoice_type** (String) - Required - Invoice type: 1: VAT special invoice, 2: VAT ordinary invoice, 3: VAT electronic invoice, 4: VAT special electronic invoice - **purchase_name** (String) - Required - Buyer's name - **purchase_no** (String) - Optional - Buyer's identification number. If not empty, must be 15-20 digits, numeric or uppercase letters. - **purchase_addressphone** (String) - Optional - Buyer's address and phone number - **purchase_cardinfo** (String) - Optional - Buyer's bank account information - **mobile_phone** (String) - Optional - Mobile phone number. Cannot be empty simultaneously with email. - **email** (String) - Optional - Email address. Cannot be empty simultaneously with mobile_phone. - **goodsList** (List) - Required - Goods information - **notify_url** (String) - Optional - URL to notify the caller upon successful invoice issuance. - **remarks** (String) - Optional - Invoice remarks - **key_sign** (String) - Required - MD5 encrypted signature after sorting parameters and appending token (access_token). #### Goods Information Object (goodsList) - **goods_name** (String) - Required - Goods name - **goods_code** (String) - Required - Goods code - **total_fee** (String) - Required - Total amount including tax (in cents) - **tax_rate** (String) - Required - Tax rate (up to 3 decimal places) - **tax_policy** (String) - Optional - Tax policy: '0' or empty for normal tax rate, '1' for tax exemption. - **model** (String) - Optional - Goods specifications - **num** (String) - Required - Quantity of goods (maximum 12 digits including decimal point) - **unit** (String) - Optional - Unit of measurement - **price** (String) - Required - Unit price (in cents) - **include_tax** (int) - Required - Amount includes tax: 0 for including tax, 1 for excluding tax. - **discount** (String) - Optional - Discount amount (in cents) ### Request Example ```json { "api_ver": "200", "merchant_no": "123456789012345", "terminal_id": "TERMINAL01", "trace_no": "TRACE123456789012345678901234567890", "out_trade_no": "ORDER987654321", "issue_total_fee": "117.00", "invoice_type": "3", "purchase_name": "Example Corp", "purchase_no": "987654321098765", "mobile_phone": "13800138000", "email": "buyer@example.com", "goodsList": [ { "goods_name": "Product A", "goods_code": "P001", "total_fee": "10000", "tax_rate": "0.13", "num": "1", "unit": "pcs", "price": "10000", "include_tax": 0 } ], "notify_url": "http://example.com/notify", "remarks": "Sample remark", "key_sign": "abcdef1234567890abcdef1234567890" } ``` ### Response #### Success Response (200) - **return_code** (String) - Response code: '01' for success. - **return_msg** (String) - Response message: e.g., "Invoice issued successfully." - **result_code** (String) - Business result: '01' for successful invoice issuance, '02' for failure. - **merchant_no** (String) - Merchant number. - **trace_no** (String) - Transaction serial number. - **invoice_serino** (String) - Invoice serial number. #### Response Example ```json { "return_code": "01", "return_msg": "Invoice issued successfully.", "result_code": "01", "merchant_no": "123456789012345", "trace_no": "TRACE123456789012345678901234567890", "invoice_serino": "INVSERINO1234567890" } ``` ``` -------------------------------- ### POST /coupon/open/querybestcoupons Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/yp6frh Queries and returns the optimal available coupons for a given user. ```APIDOC ## POST /coupon/open/querybestcoupons ### Description This endpoint allows you to query and retrieve the best available coupons for a user. It supports various user identification types and can optionally freeze the best coupon found for a specified duration. ### Method POST ### Endpoint /coupon/open/querybestcoupons ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **api_ver** (String) - Required - Version number, defaults to "100". - **trace_no** (String) - Required - Request serial number, a unique UUID without hyphens. - **merchant_no** (String) - Required - Merchant number. - **terminal_id** (String) - Required - Terminal ID. - **user_id_type** (String) - Required - User identifier type (e.g., PHONE, OPENID, USERID, UNIONID, PAYCODE, CARDNO). - **user_id** (String) - Required - User identifier corresponding to `user_id_type`. - **amount** (String) - Required - Amount for which coupons are to be considered (in cents). - **freeze_flag** (String) - Optional - Whether to freeze the best coupon found. 0: Do not freeze, 1: Freeze. If empty, no freeze. - **freeze_time** (String) - Optional - Duration for freezing in seconds. Required if `freeze_flag` is 1. Minimum 300 seconds. Defaults to 2 hours if not provided. - **key_sign** (String) - Required - Signature string generated by sorting non-empty parameters and appending the terminal token (access_token), then MD5 encrypted to 32 characters. ### Request Example ```json { "api_ver": "100", "trace_no": "a1b2c3d4e5f678901234567890abcdef", "merchant_no": "123456789012345", "terminal_id": "87654321", "user_id_type": "PHONE", "user_id": "13800138000", "amount": "10000", "freeze_flag": "1", "freeze_time": "7200", "key_sign": "generated_signature" } ``` ### Response #### Success Response (200) - **return_code** (String) - Response code (01: Success, 02: Failure). Indicates communication status. - **return_msg** (String) - Return message. - **key_sign** (String) - Signature string. - **result_code** (String) - Business result (01: Success, 02: Failure). Only returned if `return_code` is "01". - **trace_no** (String) - Original request serial number. - **merchant_no** (String) - Merchant number. - **terminal_id** (String) - Terminal ID. - **member_info** (String) - Member information (JSON string, requires escaping). Returned if `result_code` is "01". - **coupon** (String) - Coupon information (JSON string, requires escaping). Returned if `result_code` is "01". - **sence_no** (String) - Alipay request serial number. Returned if `result_code` is "01". #### Response Example ```json { "return_code": "01", "return_msg": "Success", "key_sign": "generated_response_signature", "result_code": "01", "trace_no": "a1b2c3d4e5f678901234567890abcdef", "merchant_no": "123456789012345", "terminal_id": "87654321", "member_info": "{\"nick_name\": \"User123\", \"phone\": \"13800138000\", \"card_no\": \"ABC123XYZ789\"}", "coupon": "{\"coupon_credential\": \"CREDENTIAL123\", \"channel_type\": \"LC\", \"coupon_no\": \"COUPON456\", \"coupon_name\": \"10% Off\", \"apply_scope\": \"0\", \"coupon_type\": \"1\", \"get_time\": \"2023-10-27 10:00:00\", \"start_time\": \"2023-10-27 00:00:00\", \"end_time\": \"2023-11-27 23:59:59\", \"discount_amt\": \"1000\", \"actual_amt\": \"9000\", \"discount_rule\": {\"discount_threshold\": \"0\", \"rebate\": \"90\", \"discount_top\": \"0\"}, \"use_rule\": {\"use_time_type\": \"0\", \"limit_days\": \"30\"}, \"use_note\": \"Terms and conditions apply.\"}", "sence_no": "ALIPAY_TRACE_ID" } ``` ### Member Info Structure - **nick_name** (String) - Required - User's nickname. - **phone** (String) - Required - User's phone number. - **card_no** (String) - Required - User's card number. ### Coupon Info Structure - **coupon_credential** (String) - Optional - Coupon credential for payment interface, returned if `freeze_flag` is 1. - **channel_type** (String) - Required - Channel type (LC, WECHAT, ALIPAY, MALLCOO). - **coupon_no** (String) - Required - Coupon code. - **coupon_name** (String) - Required - Coupon name. - **apply_scope** (String) - Required - Application scope (0: Full site, 1: Single item). - **coupon_type** (String) - Required - Coupon type (0: Full reduction, 1: Discount, 2: Redemption, 3: Parking, 4: Group purchase, 5: Voucher). Types 4 and 5 only exist for `channel_type` MALLCOO. - **get_time** (String) - Optional - Time coupon was received (yyyy-MM-dd HH:mm:ss). - **start_time** (String) - Required - Coupon validity start time (yyyy-MM-dd HH:mm:ss). - **end_time** (String) - Required - Coupon validity end time (yyyy-MM-dd HH:mm:ss). - **discount_amt** (String) - Required - Discount amount (in cents), calculated based on `amount`. - **actual_amt** (String) - Required - Actual payable amount (in cents) after discount. - **discount_rule** (Object) - Required - Discount rules. - **use_rule** (Object) - Required - Coupon usage rules. - **use_note** (String) - Required - Usage instructions. ### Discount Rule Structure - **discount_threshold** (String) - Required - Consumption threshold (in cents), 0 means no threshold. - **discount_amt** (String) - Optional - Discount amount (in cents). Required if `coupon_type` is 0. - **rebate** (String) - Optional - Discount rate (integer from 1 to 100, e.g., 70 for 30% off). Required if `coupon_type` is 1. - **discount_top** (String) - Required - Maximum discount amount per transaction, 0 means no limit. - **deduction_amt** (String) - Optional - Deduction amount (in cents). Applicable for `coupon_type` 3. - **deduction_time** (String) - Optional - Deduction time (in minutes). Applicable for `coupon_type` 3. ### Use Rule Structure - **use_time_type** (String) - Required - Coupon usable time type (0: Within N days of receiving, 1: Fixed period, 2: Rule-based dates). - **limit_days** (String) - Optional - Valid within N days of receiving the coupon. Required if `use_time_type` is 0. - **wait_days** (String) - Optional - Becomes effective N days after receiving, maximum 90. Not mandatory if `use_time_type` is 0. - **use_start_time** (String) - Optional - Fixed usable period start time (yyyy-MM-dd HH:mm:ss). Required if `use_time_type` is 1. - **use_end_time** (String) - Optional - Fixed usable period end time (yyyy-MM-dd HH:mm:ss). Required if `use_time_type` is 1. - **days_period** (String) - Optional - Days of the week coupon is usable (1 for Sunday, 2 for Monday, etc., separated by commas). Example: "1,2". Used when `use_time_type` is 2. Empty means no time restrictions. - **time_period** (String) - Optional - Time segment during rule-based days (format: HH:mm-HH:mm). Used with `days_period` when `use_time_type` is 2. Empty means no time restriction within the specified days. ``` -------------------------------- ### Huabei Installment Barcode Payment API Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/dh995i Initiates a Huabei installment payment using a customer's barcode. This endpoint is suitable for point-of-sale scenarios where the customer provides a payment code. ```APIDOC ## POST /pay/fenqi/barcodepay ### Description Initiates a Huabei installment payment using a customer's barcode. This endpoint is suitable for point-of-sale scenarios where the customer provides a payment code. ### Method POST ### Endpoint /pay/fenqi/barcodepay ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **pay_ver** (String) - Required - Version number, current version is `110` - **pay_type** (String) - Required - Request type, `020` for Alipay - **service_id** (String) - Required - Interface type, current type is `010` - **merchant_no** (String) - Required - Merchant number - **terminal_id** (String) - Required - Terminal number - **terminal_trace** (String) - Required - Terminal trace number, use merchant system's order number - **terminal_time** (String) - Required - Terminal transaction time, format: yyyyMMddHHmmss - **auth_no** (String) - Required - Authorization code, customer's payment code - **total_fee** (String) - Required - Amount in cents - **order_body** (String) - Optional - Order description - **attach** (String) - Optional - Additional data, returned as is - **goods_detail** (String) - Optional - Goods list information in JSON format - **goods_tag** (String) - Optional - Order discount tag for voucher or reduction promotions (values: `cs`, `bld`) - **fenqi_num** (String) - Required - Huabei installment number, supports `3`, `6`, `12` installments - **key_sign** (String) - Required - Signature verification string, MD5 hash of all non-empty parameters concatenated with the access token ### Request Example ```json { "pay_ver": "110", "pay_type": "020", "service_id": "010", "merchant_no": "123456789012345", "terminal_id": "ABCDEFGH", "terminal_trace": "ORDER12345", "terminal_time": "20231027103000", "auth_no": "280871765740498793", "total_fee": "10000", "order_body": "Example Product", "fenqi_num": "3", "key_sign": "generated_signature" } ``` ### Response #### Success Response (200) - **return_code** (String) - Response code: `01` for success, `02` for failure. Indicates communication status, not business result. - **return_msg** (String) - Descriptive message, e.g., "Payment successful", "Payment processing", "Request limited". - **key_sign** (String) - Signature verification string. - **result_code** (String) - Business result: `01` for success, `02` for failure, `03` for processing, `99` for type mismatch. - **pay_type** (String) - Request type, `020` for Alipay. - **merchant_name** (String) - Merchant name. - **merchant_no** (String) - Merchant number. - **terminal_id** (String) - Terminal number. - **terminal_trace** (String) - Terminal trace number, original merchant order number. - **terminal_time** (String) - Terminal transaction time (yyyyMMddHHmmss). - **total_fee** (String) - Amount in cents. - **end_time** (String) - Payment completion time (yyyyMMddHHmmss). - **out_trade_no** (String) - Unique order number. - **channel_trade_no** (String) - Channel order number (e.g., Alipay order number). - **channel_order_no** (String) - Bank channel order number. - **user_id** (String) - Payer's user ID (e.g., Alipay account). - **attach** (String) - Additional data, returned as is. - **receipt_fee** (String) - Actual received amount in cents. #### Response Example ```json { "return_code": "01", "return_msg": "Payment successful", "key_sign": "generated_signature", "result_code": "01", "pay_type": "020", "merchant_name": "Example Merchant", "merchant_no": "123456789012345", "terminal_id": "ABCDEFGH", "terminal_trace": "ORDER12345", "terminal_time": "20231027103000", "total_fee": "10000", "end_time": "20231027103015", "out_trade_no": "LICHU123456789", "channel_trade_no": "ALIPAY987654321", "channel_order_no": "BANK456789", "user_id": "ALIPAYUSER123", "attach": "", "receipt_fee": "10000" } ``` ``` -------------------------------- ### POST /member/terminal/queryoptimalsolution Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/yp6frh Queries the optimal solution for a given member transaction, potentially involving discounts and promotions. ```APIDOC ## POST /member/terminal/queryoptimalsolution ### Description Queries the optimal solution for a given member transaction, potentially involving discounts and promotions. ### Method POST ### Endpoint /member/terminal/queryoptimalsolution ### Parameters #### Request Body - **api_ver** (String) - Required - Version number, defaults to 100. - **trace_no** (String) - Required - Request serial number, unique UUID without hyphens. - **merchant_no** (String) - Required - Saobei merchant number. - **terminal_id** (String) - Required - Terminal number. - **user_id_type** (String) - Required - User identifier type (AUTO, PAYCODE, PHONE, OPENID, USERID, UNIONID, CARDNO, MEMBERNO, DYNAMICCODE). - **user_id** (String) - Required - User identifier. - **amount** (String) - Required - Amount to participate in discounts (in cents). - **freeze_flag** (String) - Optional - Whether to freeze the optimal coupon found (0: no, 1: yes). Defaults to not freezing if empty. - **freeze_time** (String) - Optional - Freeze duration in seconds. Applicable if freeze_flag is 1. Minimum 300 seconds. Defaults to 2 hours if not provided. - **key_sign** (String) - Required - Signature verification string (MD5 hash of sorted parameters + token). ### Request Example ```json { "api_ver": "100", "trace_no": "uuid-without-hyphens", "merchant_no": "merchant123", "terminal_id": "term001", "user_id_type": "PHONE", "user_id": "13800138000", "amount": "10000", "freeze_flag": "1", "freeze_time": "7200", "key_sign": "abcdef1234567890abcdef1234567890" } ``` ### Response #### Success Response (200) - **return_code** (String) - Response code (01: success, 02: failure). - **return_msg** (String) - Return message. - **key_sign** (String) - Signature verification string. - **result_code** (String) - Business result code (01: success, 02: failure). - **trace_no** (String) - Original request serial number. - **merchant_no** (String) - Saobei merchant number. - **terminal_id** (String) - Terminal number. - **discount_credential** (String) - Discount credential (passed directly to payment interface). - **member_info** (String) - Member information (JSON string, needs escaping). - **coupon_info** (String) - Coupon information (JSON string, needs escaping). - **activity_info** (String) - Activity information (JSON string, needs escaping). **member_info fields:** - **nick_name** (String) - Nickname. - **phone** (String) - Phone number. - **member_card_no** (String) - Member card number. **coupon_info fields:** - **coupon_no** (String) - Coupon number. - **coupon_name** (String) - Coupon name. - **coupon_type** (String) - Coupon type (0: Full reduction, 1: Discount, 2: Exchange, 3: Parking, 4: Group purchase, 5: Coupon). 4 and 5 are only available when channel_type is MALLCOO. **activity_info fields:** - **activity_no** (String) - Activity number. - **activity_name** (String) - Activity name. - **market_type** (String) - Activity type (FULL_REDUCTION, FULL_DISCOUNT, CONSUME_REDUCTION). - **serial_number** (String) - Discount rule serial number. Required if activity_no is not empty. #### Response Example ```json { "return_code": "01", "return_msg": "Success", "key_sign": "abcdef1234567890abcdef1234567890", "result_code": "01", "trace_no": "uuid-without-hyphens", "merchant_no": "merchant123", "terminal_id": "term001", "discount_credential": "DC12345", "member_info": "{\"nick_name\": \"TestUser\", \"phone\": \"13800138000\", \"member_card_no\": \"MC98765\"}", "coupon_info": "{\"coupon_no\": \"CN112233\", \"coupon_name\": \"10% Off\", \"coupon_type\": \"1\"}", "activity_info": "{\"activity_no\": \"AN445566\", \"activity_name\": \"Summer Sale\", \"market_type\": \"FULL_DISCOUNT\", \"serial_number\": \"1\"}" } ``` ``` -------------------------------- ### Huabei Installment QR Code Payment (Prepay) API Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/dh995i Generates a QR code for Huabei installment payment. This endpoint is used to create a payment QR code that the customer can scan to complete the transaction. ```APIDOC ## POST /pay/fenqi/prepay ### Description Generates a QR code for Huabei installment payment. This endpoint is used to create a payment QR code that the customer can scan to complete the transaction. ### Method POST ### Endpoint /pay/fenqi/prepay ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **pay_ver** (String) - Required - Version number, current version is `110` - **pay_type** (String) - Required - Request type, `020` for Alipay - **service_id** (String) - Required - Interface type, current type is `011` - **merchant_no** (String) - Required - Merchant number - **terminal_id** (String) - Required - Terminal number - **terminal_trace** (String) - Required - Terminal trace number, use merchant system's order number - **terminal_time** (String) - Required - Terminal transaction time, format: yyyyMMddHHmmss - **total_fee** (String) - Required - Amount in cents - **order_body** (String) - Optional - Order description - **notify_url** (String) - Optional - External system notification URL - **attach** (String) - Optional - Additional data, returned as is - **goods_detail** (String) - Optional - Goods list information in JSON format - **goods_tag** (String) - Optional - Order discount tag for voucher or reduction promotions (values: `cs`, `bld`) - **fenqi_num** (String) - Required - Huabei installment number, supports `3`, `6`, `12` installments - **key_sign** (String) - Required - Signature verification string, MD5 hash of all non-empty parameters concatenated with the access token ### Request Example ```json { "pay_ver": "110", "pay_type": "020", "service_id": "011", "merchant_no": "123456789012345", "terminal_id": "ABCDEFGH", "terminal_trace": "ORDER67890", "terminal_time": "20231027103500", "total_fee": "15000", "order_body": "Another Product", "notify_url": "https://yourdomain.com/notify", "fenqi_num": "6", "key_sign": "generated_signature" } ``` ### Response #### Success Response (200) - **return_code** (String) - Response code: `01` for success, `02` for failure. Indicates communication status, not business result. - **return_msg** (String) - Descriptive message, e.g., "Prepay request successful", "Prepay request failed". - **key_sign** (String) - Signature verification string. - **result_code** (String) - Business result: `01` for success, `02` for failure. - **pay_type** (String) - Request type, `020` for Alipay. - **merchant_name** (String) - Merchant name. - **merchant_no** (String) - Merchant number. - **terminal_id** (String) - Terminal number. - **terminal_trace** (String) - Terminal trace number, original merchant order number. - **terminal_time** (String) - Terminal transaction time (yyyyMMddHHmmss). - **total_fee** (String) - Amount in cents. - **out_trade_no** (String) - Unique order number. - **qr_code** (String) - The generated QR code string. #### Response Example ```json { "return_code": "01", "return_msg": "Prepay request successful", "key_sign": "generated_signature", "result_code": "01", "pay_type": "020", "merchant_name": "Example Merchant", "merchant_no": "123456789012345", "terminal_id": "ABCDEFGH", "terminal_trace": "ORDER67890", "terminal_time": "20231027103500", "total_fee": "15000", "out_trade_no": "LICHU987654321", "qr_code": "https://qr.alipay.com/...?data=..." } ``` ``` -------------------------------- ### Saobei QR Code Payment API Request Example Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rinsc3 An example of an API request for the Saobei QR Code payment interface. This POST request includes essential parameters like merchant details, transaction information, and signature. ```json { "pay_ver": "202", "pay_type": "000", "service_id": "016", "merchant_no": "商户号", "terminal_id": "终端号", "terminal_trace": "终端流水号", "terminal_time": "yyyyMMddHHmmss", "total_fee": "金额", "order_body": "订单描述", "notify_url": "支付结果接收地址", "attach": "附加数据", "timeout_express": "链接失效时间", "repeated_trace": "是否允许重复扫码或支付", "auto_pay": "是否自动生成订单", "key_sign": "签名验证串" } ``` -------------------------------- ### 支付2.0接口 - Java SDK引入方式 Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rinsc3 提供了两种在Maven项目中引入Java SDK的方式:本地安装jar包和使用systemPath属性。 ```APIDOC ## 支付2.0接口 - Java SDK引入方式 ### 3.1.1 SDK引入方式参考 **方式一:IDEA或者Eclipse引入本地jar包** 请自行搜索对应开发工具添加jar包的步骤。 **方式二:使用Maven安装本地jar包** 1. 执行以下Maven命令将jar包安装到本地仓库(请替换路径和版本号): ```bash mvn install:install-file -Dfile=D:\saobei-open-sdk-1.2.1.jar -DgroupId=com.lcsw.opensdk -DartifactId=saobei-open-sdk -Dversion=1.2.1 -Dpackaging=jar ``` 2. 在`pom.xml`中添加如下依赖(请替换版本号): ```xml com.lcsw.opensdk saobei-open-sdk 1.2.1 ``` **方式三:使用Maven的systemPath属性** 在`pom.xml`中配置如下依赖(请替换版本号和jar包路径): ```xml com.lcsw.opensdk saobei-open-sdk 1.2.1 system ${project.basedir}/lib/saobei-open-sdk-1.2.1.jar ``` ``` -------------------------------- ### Barcode Payment API Request Example Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rinsc3 This example illustrates a typical POST request to the barcode payment API endpoint. It includes essential parameters like `pay_ver`, `pay_type`, `merchant_no`, `terminal_id`, `terminal_ip`, `auth_no`, `total_fee`, and `key_sign`. The `goods_detail` parameter can be used to specify itemized product information. ```http POST /pay/open/barcodepay HTTP/1.1 Host: api.example.com Content-Type: application/json { "pay_ver": "202", "pay_type": "010", "service_id": "010", "merchant_no": "your_merchant_no", "terminal_id": "your_terminal_id", "terminal_ip": "192.168.1.100", "terminal_trace": "your_order_id", "terminal_time": "20231027103000", "auth_no": "customer_payment_code", "total_fee": "1000", "key_sign": "your_generated_signature" } ``` -------------------------------- ### Barcode Payment Response Structure (JSON Example) Source: https://help.lcsw.cn/xrmpic/tisnldchblgxohfl/rezg7u Provides an example of the JSON response structure for a barcode payment transaction. This includes details such as channel trade number, end time, merchant information, transaction status, and payment type. This structure is crucial for parsing payment results. ```json BarcodepayOutstr={ "channel_trade_no":"2017111721001104680200756475", "end_time":"20171117143227", "key_sign":"1f86c43df47efe37198096aa8bf76a3a", "merchant_name":"利楚扫码对接专用-参数勿动", "merchant_no":"810000270000007", "out_trade_no":"300505520012117111714322700007", "pay_type":"020", "receipt_fee":"1", "result_code":"01", "return_code":"01", "return_msg":"支付成功", "terminal_id":"30050552", "terminal_time":"20171117143224", "terminal_trace":"ab5e8d77a63648ee84ed2b3b59a66d31", "total_fee":"1", "user_id":"2088302647936684" } ```