1.0.1 • Published 1 year ago

txpay-sdk v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

txpay-sdk

To integrate txPay into your marketplace, you will first need to generate a payment URL that can be used to initialize an iframe with the txPay payment flow.

    import txPay from "txpay-sdk";

    (async () => {
    try {
        // init txPay object
        const txPayOBJ = new txPay({
            appId: "YOUR-APP-ID",
            apiSecret: "YOUR-SECRET",
            sandbox: true, // false for production
        });

         const response = await txPayOBJ.checkout.init({
            nft_action_type: "bid",
            total_value_in_smallest_unit: "1600000000000000",
            user_wallet_address: "0x4r87......o4t40",
            nfts_list: [],
        });

        // The payment status can be tracked using the PAYMENT_ID
        const status = await txPayOBJ.checkout.status("PAYMENT_ID");

    } catch (e) {
        // Deal with the fact the chain failed
        throw e;
    }
    })();
1.0.1

1 year ago

1.0.0

1 year ago