Payment (gRPC)
Protocol
We use gRPC/Protocol buffers to communicate with the POS application (for a store), the TokenPay application (for a user), and the Payment server.
Messages
A message consists of a "common" and a "content" fields. Fields in the "common " are fields commonly used in all APIs. Fields in the "content" are different depending on how API is used. However currently only PayData is used.
Services
Payment
Approval
The POS uses StartPayment method, while the TokenPay uses DoPayment method. These methods are implemented as bidirectional streaming RPC.
DoPayment(START_PAY)
The TokenPay connects to the Payment server.
StartPayment(START_PAY)
The POS connects to the Payment server and starts a payment transaction. The QR code is read from the TokenPay application.
DoPayment(REQUEST_TRANSFER)
The Payment server sends a token transfer request to the TokenPay.
StartPayment(REQUEST_TRANSFER)
The POS is informed that the user is preparing a bank transfer.
DoPayment(TRANSFER)
The user sends relevant information for transfer from the user account to the store account (settlement address).
StartPayament(END_PAY)
If the transfer is successful, the approval result is returned.
DoPayment(END_PAY)
If the transfer is successful, the approval result is returned.
Cancellation
The POS uses CancelPayment method. If successful, the token from the store account is transferred to the user account. The request is as follows.
The response is as follows.
Reward
Issuance
The POS uses IssueReward method. The request is as follows.
The response is as follows.
Reward
There are two ways to reward. The first is to reward at the POS.
The POS uses StartPayment method, while the TokenPay uses DoPayment method. These methods are implemented as bidirectional streaming RPC.ima
DoPayment(START_PAY)
The TokenPay app connects to the Payment server.
StartPayment(START_REWARD)
DoPayment(END_REWARD)
StartPayment(END_REWARD)
The second way is to reward from receipts printed at the POS.
DoPayment(START_REWARD)
DoPayment(END_REWARD)
Cancellation
The POS uses CancelReward method. The request is as follows.
The response is as follows.
Error
For each request, the Payment server sends a response with resCode and resMessage.
Last updated