Search code examples
javascriptsimplecart

SimpleCart JS: How can I know if a product it's correctly sold?


I'm trying http://simplecartjs.org – There is a way to know if a user purchas and paid an item?

Thanks


Solution

  • If you look into the documentation of this cart application you will see that there are several checkout options available. see for e.g.: http://simplecartjs.org/documentation/paypal

    So you can link your SimpleCart to one of those checkout providers and you will have to look for completed payments on those sites.

    Of course you have the option to use your own checkout method by using SendForm but then you'll have to write that by yourself.

    There are also several event callbacks for the checkout process like checkoutSuccess, checkoutFail and beforeCheckout that you can use.

    simpleCart({
        checkout: {
            type: "PayPal" ,
            email: "[email protected]"
        },
        checkoutSuccess    : null, /* insert your function call here */
        checkoutFail       : null,
        beforeCheckout     : null
    });
    

    instead of null you simply have to insert your function calls.