@4a/sdk-payment
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.1 • Public • Published

    Payment

    收银台SDK

    • v0.x for payment1.0
    • v2.x for payment2.0

    Usage

    const { Payment } = require('@4a/sdk-payment')
    // or
    import Payment from '@4a/sdk-payment'
    
    const pay = new Payment({
        appId: 'appId',
        appSecret: 'appSecret',
        baseURL: 'http://localhost:9121',
    })

    API

    interface PlainObject {
        [key: string]: any
    }
    interface Options {
        appId: string
        appSecret: string
        baseURL: string
    }
    export declare class Payment {
        sign: any
        baseURL: string
        constructor({ appId, appSecret, baseURL }: Options)
        prepay(trade: PlainObject): Promise<any>
        query(tradeid: string): Promise<any>
        verifySign(params: PlainObject): boolean
        isPaid(tradeid: string): Promise<boolean>
        /**
         * @deprecated
         * verifyTrade is deprecated, please use {isPaid}
         */
        verifyTrade(tradeid: string): Promise<boolean>
    }

    For FE

    import { gotoPay } from '@4a/sdk-payment/dist/fe'
    function gotoPay(baseURL: string, tradeid: string, params?: PlainObject): void

    Keywords

    Install

    npm i @4a/sdk-payment

    DownloadsWeekly Downloads

    108

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    8.66 kB

    Total Files

    11

    Last publish

    Collaborators

    • gavinning