As a part of my internship, I was matched with Convessa - an enterprise-grade voice platform that enables the development of extensive, robust and scalable voice applications. One of my assigned tasks was to research, evaluate and implement a payment service and checkout flow for the company's showcase voice app Mastermind. This project creates this flow (front-end & back-end) according to Amazon Payment's Express Integration (hosted payment).
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- button.html
HTML containing a simple webpage that holds the JavaScript code for the custom Amazon Pay button - uses jQuery to hit the ButtonServlet to retrieve JSON parameters
- ButtonServlet.java
Servlet used to send JSON parameters to button.html
- AmazonParameters.java
Provides Amazon credentials + parameters
- AmazonSignature.java
Calculates + encrypts signature with secret key to verify requests
- AmazonPayAPI.java
Configures + wraps the Amazon Pay SDK for use with the Mastermind account
- ChaChing.java
Servlet used to handle the return URL (GET) and Amazon notifications (POST)
- PaymentProcessor.java
Object class used to process results from both the GET and POST
- MMPaymentServer.java Main method that instantiates a SSL Jetty Server with the servlets intact
Even though this integration was tested locally (Amazon Pay Sandbox Mode), there are a few things that have to be set up in order to effectively test each aspect of the checkout flow.
- Amazon Pay Account (with valid credentials)
- SSL Certificate (optional for Sandbox)
- Amazon Pay Java SDK
- Jetty
Some things to remember to change once moving onto Production
- Change the script source in button.html to render the button w/o the sandbox watermark and enable access to real Amazon accounts (just remove '/sandbox')
- In AmazonPayAPI.java, the SDK Client object should not include the ".withSandboxMode(true)" parameter