Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple in-app purchase receipt validator.
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
lib
.gitignore
Gemfile
Gemfile.lock
LICENSE
Procfile
README.md
lestrade.rb

README.md

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

Something went wrong with that request. Please try again.