Scenario 1. Payment
Koshelek Pay API
Documentation has moved
The information on this page is no longer updated and may be obsolete. The most current Koshelek documentation is now available at the new address:
Payment scenario: basic flow
The Koshelek Pay payment scenario can be split into 2 parts. Please keep in mind that this is a continuous process.
It is essential for payments via Koshelek Pay that the loyalty card barcode scanning is done only once (a single scan should cover both loyalty card processing and payment).
1. Barcode processing and checkout
Step # | Description |
---|---|
[01]-[03] | Customer selects a loyalty card in the Koshelek app. The app displays the card and the TOTP-enabled card barcode (see Koshelek TOTP Module). |
[04] | Checkout operator scans the TOTP-enabled card barcode with a scanner. Cash desk software reads out the full barcode value, checks if payment via Koshelek Pay is available (indicated by |
[05]-[10] | Merchant requests a list of payment providers (refer to API v1.2.1 Requests). The response contains a list of available payment providers along with the |
[11] | If Koshelek Pay is not enabled in customer's account, a fallback to alternate payment methods is triggered. End of scenario. |
[12]-[14] | (Optional steps) Cash desk contacts the merchant's datacenter to calculate discounts and bonuses for different payment methods (traditional and for received payment providers). The merchant's datacenter performs the calculation and returns a marketing message for each provider to the cash desk to be shown in customer's Koshelek app. The cash desk software generates the final value of the payment amount and discounts in the receipt for each payment method. The total amount and the discount amount must be the same for all payment providers (including via the Koshelek app). Only marketing messages and subsequent bonuses from the merchant may differ after payment through a certain payment provider. |
2. Payment
Further scenario execution is determined by the koshelekPayIsDefault
value.
koshelekPayIsDefault
= true
:
Step # | Description |
---|---|
[01]-[05] | Merchant automatically requests payment checkout (refer to API v1.2.1 Requests). As a result, the total amount is displayed in customer's Koshelek app. |
[06] | Customer confirms payment in the app. |
[07-11] | Koshelek server processes payment and informs merchant of transaction status. The status is also displayed on customer's Koshelek app screen. |
[12]-[14] | Merchant sends transaction receipt to the Koshelek server (refer to API v1.2.1 Requests). The receipt is transferred to the Koshelek app screen for customer's notice. End of scenario. |
koshelekPayIsDefault
= false
and at least one payment provider is available:
Step # | Description |
---|---|
[15]-[22] | Checkout operator informs the customer that the Koshelek Pay payment method is available. If the customer confirms to pay with Koshelek Pay, the operator triggers payment checkout request (refer to API v1.2.1 Requests). As a result, the total amount is displayed in customer's Koshelek app. |
[23] | Customer confirms payment in the app. |
[24]-[28] | Koshelek server processes the payment and informs merchant of transaction status. The status is also displayed on customer's Koshelek app screen. |
[29]-[31] | Merchant sends transaction receipt to the Koshelek server (refer to API v1.2.1 Requests). The receipt is transferred to the Koshelek app screen for customer's notice. End of scenario. |
No payment providers are available:
Step # | Description |
---|---|
[32] | Cash desk software displays the reason for payment provider unavailability (see |
Payment transaction states
The diagram shows transaction status transitions during payment operation initiated via Koshelek Pay API.
Green color indicates successful statuses.
Red indicates unsuccessful statuses.
Yellow indicates transit statuses.
Specific payment cases
1. Non-piece purchases
Non-piece goods (e.g. those sold by weight) require proper processing in Pay API. Specify such item details by using the following fields:
measure
: measure unitsquantity
: item count in measure units (use only integer numbers)price
: price for 1 measure unit
2. Buying more than 1 identical item
When customer buys multiple number of the same item, it is important to pass exact number of such items.
This is crucial for partial refunds, as payment provider Dolyame verifies number of items for particular article
during refund processing. If payment transaction specifies item quantity = 1
, then partial refund won't go through.
3. Discounts, rewards, advance payments, mixed payments
If some part of purchase amount is paid differently (i.e. is paid by cash, advance payment or any other way different from Koshelek Pay), then you should specify this part of amount in field discountAmount
.
Alternative payment flows
Sometimes basic payment flow can be extended as described below.
1. Customer updates checkout positions after the /checkout
request is issued
/checkout
request is issuedYour actions:
Tell customer not to confirm payment in the Koshelek app (otherwise, payment can go through and you won't be able to cancel it).
Initiate payment cancel (refer to Scenario 2. Cancel payment).
Send an updated checkout invoice with a new
requestId
but the samecardSession
(refer to API v1.2.1 Requests).
2. Customer cancels purchase (in full or in part) after payment is confirmed in the app
Your actions:
If transaction result is not yet received:
Initiate payment cancellation (refer to Scenario 2. Cancel payment). If cancellation is initiated before the bank receives the payment request, no funds will be withdrawn and no receipt slip will be issued.
If the customer asks to update the checkout: update checkout positions as required and send an updated checkout invoice with a new
requestId
but the samecardSession
(refer to API v1.2.1 Requests).
If transaction result is already received (it may be received even after cancellation request as the bank will likely receive payment request before we get cancellation request from you):
If the transaction result is unsuccessful (payment declined): you may update checkout positions as required and send an updated checkout invoice with a new
requestId
but the samecardSession
(refer to API v1.2.1 Requests).If the transaction is completed successfully and customer wants to cancel payment: initiate payment cancellation (refer to Scenario 3. Refund payment). After refund is completed, new transaction for the same customer and the same loyalty card is done from scratch — i.e. you should scan TOTP barcode and receive a new
cardSession
.
3. Customer cancels payment in the app by mistake
That is: customer cancels payment on the Koshelek app screen accidentally or by mistake.
Your actions:
Send an updated checkout invoice with a new
requestId
but the samecardSession
(refer to API v1.2.1 Requests).
4. Bank declines transaction for some reason
That is: transaction status is rejected
, transaction is declined.
Your actions:
If the reason is insufficient funds and the customer has solved it:
Retry sending checkout invoice with a new
requestId
but the samecardSession
(refer to API v1.2.1 Requests).
Other reasons:
Among possible reasons, it might be technical issues with the acquirer or the Faster Payment System (FPS). You may want to retry sending checkout invoice, likewise in insufficient funds case — or, suggest another payment option to the customer. If retry doesn't help, fall back to a different payment option.
5. POST /checkout
request returns: "cardSession unavailable or invalid"
/checkout
request returns: "cardSession unavailable or invalid"Your actions:
Refresh
cardSession
by re-reading the loyalty card TOTP barcode (or asking a customer to re-scan QR at the cash desk if this method is implemented.)Send an updated checkout invoice with new
requestId
andcardSession
(refer to API v1.2.1 Requests).
6. Can't issue POST /status
request due to no response received on POST /checkout
(transactionId
missing)
/status
request due to no response received on POST /checkout
(transactionId
missing)Your actions:
It is allowable to retry the same request with the same
requestId
иcardSession
(API methods are idempotent).
Last updated