UNPKG

my-uniapp-tools

Version:

一个简洁稳定的 uni-app 开发工具库,提供剪贴板、本地存储、导航、系统信息等常用功能

50 lines (49 loc) 1.23 kB
/** * 支付相关工具函数(优化版本) */ /** * 微信支付配置接口 */ export interface WeChatPayConfig { appId: string; timeStamp: string; nonceStr: string; package: string; signType: "MD5" | "HMAC-SHA256"; paySign: string; } /** * 微信支付结果接口(微信回调) */ export interface WeChatPayResult { err_msg: string; err_desc?: string; } /** * 支付选项 */ export interface WeChatPayOptions { reportError?: boolean; timeoutMs?: number; } /** * 支付返回结果(结构化) */ export interface PaymentResult { /** * @deprecated 使用 status === "success" 判断支付是否成功(避免冗余字段) */ success: boolean; status: "success" | "error" | "cancel"; code: string; message: string; raw: WeChatPayResult | null; } /** * 微信公众号/H5 支付 * @param config 微信支付配置对象 * @param options 支付选项 * @returns Promise<PaymentResult> 支付结果(结构化) * @description 在微信公众号环境中调起微信支付,返回结构化的支付结果 */ export declare const wechatH5Pay: (config: WeChatPayConfig, options?: WeChatPayOptions) => Promise<PaymentResult>;