google_subscriptions

2.0.3 • Public • Published

Number Formatter

A small library that allows to retrieve the expiration date of a purchase subscription

Installation

npm install google_subscriptions --save

Usage

    import * as Express                   from "express"
    import { GoogleSubscription }         from "google_subscriptions"
 
    let app = Express()
 
    //Check the expiration date of a given subscription
    let googleSubscription = new GoogleSubscription(process.env.PACKAGE_NAME ,
                process.env.PRODUCT_ID, 
                process.env.SECRET_FILE_PATH,
                process.env.CLIENT_KEY,
                process.env.SERVICE_ACCOUNT_EMAIL );
 
 
    googleSubscription.checkExpire(token, ( err, res_t ) => {
                if (err) {
                    console.log("error : " + err);
                    res.json({"error : " :  err});
                }else{
                    console.log("token expire" + res_t);
                    res.json({"expiryTimeMillis" : res_t });
                }
            });
    // OR 
    app.use("/subscription", googleSubscription.router())
    // http://www.example.com/subscription/expire/{token}
    // result
    // {"expiryTimeMillis":1528337069881}
    ```
## Tests
 
  `npm test`
 
## Contributing
 
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Package Sidebar

Install

npm i google_subscriptions

Weekly Downloads

1

Version

2.0.3

License

ISC

Unpacked Size

11.6 kB

Total Files

6

Last publish

Collaborators

  • muhaye