The following assumes the dev envioronment is on MacOS.
- Nodejs v14+
- jq (
brew install jq) - sponge (
brew install moreutils) - Java 11+ (for Java examples)
Environment variables are available for PUBLIC_KEY and SECRET_KEY to get you off the ground quickly without having to edit the code.
To get started, go into any examples under ./examples, then execute the following:
PUBLIC_KEY=<YOUR_PUBLIC_KEY> SECRET_KEY=<YOUR_SECRET_KEY> npm run start├── client - front-end examples
├── examples - auto-generated fe/be compbined examples
├── public - downloadable zipped examples
├── scripts - build scripts
└── server - back-end examples
When you are working on the back-end (server) support, here are a couple of things you might want to know before you start.
- Two folders are required for each back-end language. Say if you're working on the support for Ruby, two new folders will be required -
server/rubyandserver/ruby-with-html. The former offers the solution for the case where the frontend handles the redirection after thecheckout sessionis created, on the other hand, for the latter, back-end handles the redirection (redirect via HTTP 303). Hence, the server implementation for the endpoint that creates the session would be different for the two cases. Please refer to the existing implementation for a more straightforward understanding. - Routes for both
successandcancelneed to be provided -/payment-successandpayment-canceled.
Every time a new backend language support is added, please do the following before you commit:
- make sure you add a new
README-INSTALL-{LANGUAGE}.md}with proper content - edit
scripts/build.shwith additional logic to this section:
...
if [[ "$BE" == "node" ]]; then
cat scripts/README-INSTALL-NODE.md >> ${COMB_DIR}/README.md
elif [[ "$BE" == "ruby" ]]; then
cat scripts/README-INSTALL-RUBY.md >> ${COMB_DIR}/README.md
else
cat scripts/README-INSTALL-PYTHON.md >> ${COMB_DIR}/README.md
fi
...- run
script/build.shto generate the examples