Swimlanes.io is a free webapp for making sequence diagrams. You simply edit the text on the left and the diagram is updated in real time. You can download your sequence diagrams as images or distribute with a link.
title: Brite - Instant Payments order: Customer, Brite Client, Merchant, Brite // Adding the SDK to your client _: **1. Display Brite's Assets** (Brite and bank logos) note: Go to [swimlanes for Brite's Assets](https://swimlanes.io/u/TfVopPMotO) _: **2. Merchant authorisation** note: Go to [swimlanes for Merchant Authorisation](https://swimlanes.io/u/knxhtrUHAW) _: **3. Create a payment** Merchant -> Brite: Create a new deposit `POST /session.create_deposit` Brite --> Merchant: Response with `url`, `token` and `id`. _: **4. Complete the payment** // Server -> Merchant: Share with the front-end `token` Merchant -> Brite Client: Initiate Brite Client note: ``` new Brite([token]) ``` Brite Client -> Customer: Render Brite Client note_: Please follow [recommendations for rendering](https://docs.britepayments.com/technical-documentation/rendering-the-brite-client/). Note that the client should close once the session completes. Customer -> Brite Client: Select customer's bank Brite Client -> Brite: Authentication with bank _: **5. Handling callbacks** Brite -> Merchant: Notification to `callback[].url` note_: Notification about a change in transaction state with `transaction_id` Merchant --> Brite: `POST /transaction.get` with `transaction_id` from the notification Brite -> Merchant: Response with transaction details // //////////////////////////////////////////////////// // Notify about the transaction state if: Payment notification with `transaction_state: 2` (`STATE_ABORTED`) and `3` (`STATE_FAILED`) note_: This means the payment failed and no re-try should be attempted. As a result, the customer should choose another way to pay. Merchant -> Brite Client: Close Brite Client Brite Client -> Merchant: Removes Brite Client Merchant -> Customer: Notify about failed payment Customer -> Merchant: Confirm failed payment Merchant -> Customer: Return to payment selection view else: Payment notification with `transaction_state: 4` (`STATE_COMPLETED`) // //////////////////////////////////////////////////// // STATE_COMPLETED (4): The deposit flow has finished without errors in the customer bank. // Store the transaction_id to refer to Brite's system note_: This means the payment and so the order can be confirmed to the customer. From hereon the payment is expected to succeed. Merchant -> Merchant: Update order `order_id` with `transaction_id` Merchant -> Brite Client: Close Brite Client Brite Client -> Merchant: Removes Brite Client Merchant -> Customer: Confirm order Customer -> Merchant: Closes purchase flow else: Payment notification with `transaction_state: 5` (`STATE_CREDIT`) // //////////////////////////////////////////////////// // STATE_CREDIT (5): Funds have not yet been settled, but the transaction was successful and a credit callback is sent from Brite. When the credit callback is received, the end user should be credited by the merchant. The transaction receives the state credit immediately after the state completed, unless the transaction amount exceeds the exposure limit (set in the Brite Backoffice, see Backoffice Guide) – then the credit callback will be sent just before the state Settled. // Store the transaction_id to refer to Brite's system note_: This means the payment was successful and goods can be shipped / credit granted to the customer. Merchant -> Merchant: Update payment as successful Merchant -> Customer: Ship goods / grant credits if: Payment notification with `transaction_state: 7` (`STATE_DEBIT`) // //////////////////////////////////////////////////// // STATE_DEBIT (7): When a deposit has been stuck in STATE_CREDIT for more than 15 days,the state will change to STATE_DEBIT and a deposit callback will be sent. // Store the transaction_id to refer to Brite's system note_: This means the payment failed unexpected. The merchant now has to find a way to reach out ot the customer and ask for a new payment. Merchant -> Merchant: Re-open the payment for order `order_id` Merchant -> Customer: Inform about failed payment and ask to pay outstanding amount. end end _: **5. Refund the payment** note_: Go to [swimlane for Refunds](https://swimlanes.io/u/4GuG3mxq_P)