Skip to content

TotenDev/Lestrade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lestrade

Dependency Status Code Climate

Simple in-app purchase receipt validator.

Stable code will be on master branch, any other branch may contain unstable code. If you are installing in a production environment, use a tag or the master branch for better experience.

Instalation

NOTE: This project has only been tested on Heroku.

Heroku setup:

  1. Clone:

     git clone https://github.com/TotenDev/Lestrade.git
     cd Lestrade
     heroku create
     git push heroku master
    
  2. Set the environment variables for the HTTP Basic Authentication

     heroku config:add LESTRADE_SHOULD_USE_BASIC_AUTH=true
     heroku config:add LESTRADE_BASIC_AUTH_USERNAME=sherlock
     heroku config:add LESTRADE_BASIC_AUTH_PASSWORD=secret
    

Non-Heroku:

  1. Clone or download the code

     git clone https://github.com/TotenDev/Lestrade.git
    
  2. Move the code to your webserver's document root

  3. Set the environment variables for the HTTP Basic Authentication, check your webserver's manual for more information.

Usage

Validate Receipt

  • Route: /validate
  • Method: POST
  • Body: { "receipt-data": "(receipt bytes)" }
  • Success Code:
    • 200: OK
  • Error Code:
    • 401: Unauthorized

Example:

curl --user sherlock:secret \
     --data "{\"receipt-data\":\"(base64 receipt)\"}" \
     https://example.com/validate

The response is a JSON containing the status.

{
  "status": false
}

Sandbox Validate Receipt

  • Route: /sandbox/validate
  • Method: POST
  • Body: { "receipt-data": "(receipt bytes)" }
  • Success Code:
    • 200: OK
  • Error Code:
    • 401: Unauthorized

Example:

curl --user sherlock:secret \
     --data "{\"receipt-data\":\"(base64 receipt)\"}" \
     https://example.com/sandbox/validate

The response is a JSON containing the status.

{
  "status": false
}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT

About

Simple in-app purchase receipt validator.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages