This sample code shows how to realize the Token Request flow with the Token Merchant Proxy. The Token Request flow enables merchants to request payments from users at any Token-connected bank. The Token Merchant Proxy is a wrapper server around the Java SDK using a simple HTTP API.
The sample requires the proxy as a dependency. Make sure it is configured properly. Refer to this page for more details about its usages.
To start the proxy:
cd merchant-proxy
./gradlew build run
To build this sample, you need Java Development Kit (JDK) version 8 or later.
To build:
./gradlew shadowJar
.
To run:
java -jar app/build/libs/app-*.jar
This starts up a server.
The server shows a web page at localhost:3000
. The page has a checkout button.
Click the button to start the merchant checkout experience. You may need to download
the Token app to link a test bank first. The server will:
- Create a token request.
- Redirect the user to a login page to approve the payment.
- Wait for a callback that contains a token id.
- Create a transfer by redeeming the received token.