Skip to content

SudoSOS Back-end API / stripe / terminal-payment

Stripe: Terminal Payment ​

A Terminal-Payment is a transaction that is immediately paid for using Stripe. This is done by creating a positive transfer of the same total amount as the transaction, and creating it just before the transaction. In practice, TerminalPayments are most often done when people that incidentally want to order something can pay for their order. A SudoSOS account is not necessary.

Basic flow ​

A TerminalPayment is created like a transaction. The same validation is done, but the major difference is that TerminalPayments can also be "anonymous". In this case, the transaction's fromUser is the point-of-sale user (a User of type POINT_OF_SALE). Then, the created TerminalPayment is sent to a Stripe Terminal, also called a Reader within Stripe. The reader can then execute a card payment and handshake this with SudoSOS. When the payment is done, SudoSOS creates the transfer and the transaction, thus keeping the user's balance the same.

Temporary Transactions ​

Before the payment on the terminal starst, the transaction must be immutable. Otherwise, SudoSOS could create a transaction for something the customer did not pay for. Therefore Temporary Transactions have been introduced. These entities are exact copies of Transaction, except that they are not part of the ledger. When a TerminalPayment has succeeded or is cancelled, these are removed as well.

Immutable TerminalPayments ​

Terminal Payments are immutable, meaning that they cannot be changed once created. When a change needs to be made to its transaction (for example when a product needs to be removed/added), the "old" TerminalPayment must be cancelled and a new one must be created.

Lifecycle ​

Each TerminalPayment has a state:

  • CREATED - The payment is created, but is yet to be paid.
  • PROCESSING - The payment is currently being handled by a reader.
  • PAID - The payment is done.
  • CANCELLED - The payment has been aborted. Status is derived, not stored - see TerminalPayment.getState.

Terminal Reader behaviour ​

The terminal reader is fully controlled by SudoSOS. There are no options to create transactions on the terminal. It is also not possible to cancel/abort a payment. This must all be done via SudoSOS.

Enumerations ​

EnumerationDescription
TerminalPaymentState-

Classes ​

ClassDescription
TerminalPayment-
TerminalPaymentControllerThe BaseController class is responsible for: - Storing route definitions. - Generating router objects based on the policy.
TerminalPaymentService-

Interfaces ​

InterfaceDescription
CreateTerminalPaymentRequest-
ProcessTerminalPaymentRequest-
TerminalPaymentResponse-