Table of Contents | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Terms and definitions
POS (point of sale)- a place where a user executes the payment for goods or services
Merchant - small amd medium enterprises, supplier of goods and/or services that work with the SWiP service.
Integrator - an employee of POS/merchant/third-party who connects the merchant's POS to the SWiP system and provides further support.
SWiP loyalty - a loyalty program provided SWiP, which is configured by the merchant.
User - a person who makes purchases and pays through the SWiP app.
Payment scenarios - SWiP supports following payment scenarios:
Scenario 1 - the user pays by the SWiP app after SWiP loyalty calculation. Payments can be made via various methods: from bank cards, from e-wallets, from payment system, from national payment system and other methods.
Scenario 2 - the user makes payment in cash or by bank card at the terminal after SWiP loyalty calculation.
Two-stage payments - a payment operation that requires additional confirmation.
Holding - the user makes the payment and the funds are put on hold on their bank card. While the funds are put on hold, you can debit funds or cancel the payment within the specified timeout (the payment cancellation period can be changed in the settings).
Withdraw - funds on hold are debited after confirmation.
Using the API
POS API - a programming interface for accepting online payments executed by the SWiP service. Using the API you can execute a payment, cancel a payment, make refunds, get statements with all orders that are made by the SWiP service.
Numberedheadings | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Intergration schemaSWiP loyalty calculation and payment inside SWiP appDuring the payment process, SWiP loyalty is calculated, if loyalty is provided for the user. This scenario includes payment inside SWiP app using the following payment methods: from bank cards, from e-wallets, from payment system, from national payment system and other methods. HTTP protocolStep 1. The POS system creates an order. Step 2. The POS system receives the Order object. Step 3. The SWiP app requests order detailed information. Step 4. The User receives the Order object with personalized loyalty at the SWiP app. Step 5. The User confirms payment at the SWiP app. Step 6. The SWiP server sends a request for order payment. Step 7. The SWiP server receives order payment confirmation. Step 8. The SWiP app receives order payment confirmation from the SWiP server. Step 9. The POS system sends a request to get the information about the current order status. Step 10. The POS system receives paid order with applied loyalty. Step 11. The POS system sends a request to close the order. SWiP loyalty calculation and payment by cash or card in bank terminalDuring the payment process, SWiP loyalty is calculated, if loyalty is provided for the user. This scenario includes payment by cash or card in bank terminal. HTTP protocolStep 1. The POS system creates an order. Step 2. The POS system receives the Order object. Step 3. The SWiP app requests order detailed information. Step 4. The User receives the Order object with personalized loyalty at the SWiP app. Step 5. The User confirms payment via alternative payment method (by cash or card in bank terminal). Step 6. The POS system sends a request to get the information about the current order status. Step 7. The POS system receives unpaid order with applied loyalty. Step 8. The POS accepts payment by cash or card in bank terminal. Step 9. The POS system sends a request to close the order. Integration URLURL of the integration environment https://capi-test.smartwallet.ru. Order and session identificationThe
The
Transport and protocolThe API uses HTTPS as protocol. Messages are represented in the JSON format. AuthenticationAuthentication is implemented by a static token. Token must be sent in the header of HTTP requests. The header in every API request should include:
* This document is valid for API version 2 and higher. Integration scenariosPOS API supports several payment scenarios. They differ depending on the payment method and store’s settings. Grocery store, bakery, coffee shop, restaurant, supermarket and many othersExample of implementation:
Vending machineExample of implementation:
Order objectThe Order object can contain other fields that POS is not using yet. They should be ignored. *- the fields that are filled in by the POS system when creating an order.
Purchases object
Example of ORDER object Create an orderTo send an order for loyalty calculation and payment execution, you need to create an The order can be in the OPEN status for 1,5 minutes for POS systems that operate in fast food or retail mode. For POS systems operating in restaurant mode, the timeout is 10 hours. Endpoint
Request formatTo create an order, you have to send a request with the following parameters:
Request example Response formatThe response to the request will contain the same order with the filled fields:
If sessionCode was sent empty, then the filled in field will return. It should be printed on the guest receipt or shown on the screen (of the POS system) to the user. Response example Get an orderSends a request to get the information about the current order status by its unique ID. Endpoint
Request formatTo get the information about the current order status, you have to send a request with the following parameters:
Response formatThe response to the request will contain the Order object with the current status. Response example Order status options and how they changeThe POS system waits 45 seconds for payment. If there is no payment during this time, the POS system closes the order with amount=0. An order can have the following statuses:
Payment is determined by the paid field. Let's say that a payment is made for 100 monetary units:
If you close the order with amount=0, the payment will be cancelled: Close an orderSends a request to close the order. Order closing method can be requested only once. In the request body, you must pass the order closing amount. If there is an error in the closing process or there is no order closing amount, the money for the order will be refunded. Endpoint
Request formatTo close the order, you have to send a request with the following parameters:
Request example Response formatThe response to the request will contain the RefundOnly the order with the CLOSED status can be refunded. Returns a successfully completed payment by the order’s unique ID. The SWiP loyalty will also be returned. Payment can be refunded in whole or in part. You are allowed to make an infinite number of partial refunds, as long as the total amount of all partial refunds does not exceed the payment amount. Endpoint
Request formatTo make a refund, you have to send a request with the following parameters:
Request example Response formatThe response to the request will contain the refund status and its description. Response example Cancel a paymentOnly the order with the CLOSED status can be cancelled. This method performs cancellation of a payment for which funds were put on hold and have not yet been captured. If it is already impossible to cancel the payment, an error with code 27 will be returned. Endpoint
Request formatTo cancel the payment, you have to send a request with the following parameters:
Request example Response formatThe response to the request will contain the payment cancellation status and its description. Response example Cancel an orderThis method is necessary in case of a timeout at POS or other reasons to cancel an order. Cancels the order with the OPEN status. Endpoint
Request formatTo cancel the order, you have to send a request with the following parameters:
Request example The request body is optional. If it is absent, the entire order is cancelled. Response formatThe response to the request will contain the Order object with the current status. Response example Response codesIn case an error occurs during the processing of a request, the API will return an error object and a standard HTTP code.
Error codes and description
Error objectIf something is wrong with the request (HTTP response code other than 200), then HTTP response codes 4xx or 5xx will return a response body in JSON format with a description of the error. Example of response body in case of error |