A simple backend for processing In-App Payments in Square
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
app.json
index.js
package.json

README.md

In-App Payments Server Quickstart

This is an example server with a single endpoint of /chargeForCooke for processing payments using Square. The server expects a POST request with a payload of application/json following the format:

{
  "nonce": "INSERT_YOUR_NONCE_HERE"
}

Please replace "INSERT_YOUR_NONCE_HERE" with your own nonce this was generated from either the Square Payment Form or the In-App Payments SDK.

Instructions

Deploy to Heroku

  • Click the Deploy to Heroku button
  • Login or create a Heroku account
  • Enter a unique Heroku app name.
  • Go to the Square Application Dashboard and select your application.
  • Copy the Personal Access Token from the Credentials tab into the ACCESS_TOKEN field of the Heroku configuration page.
  • Click Deploy app
  • Copy https://[Heroku app name].herokuapp.com/chargeForCookie as your URL to POST to in your mobile application.

Example curl request you can make to the server:

curl -X POST 'https://[Heroku app name].herokuapp.com/chargeForCookie' \
  -H 'Content-Type: application/json' \
  -d '{ "nonce": "INSERT_YOUR_NONCE_HERE" }'