SWiP POS API allows you to accept payments with loyalty calculation at the POS system. This article will help you accept your first payment.
To start working with SWiP POS API use the following credentials.
Parameter Name | Parameter Value |
---|---|
Token | c7a8d063-ac26-4226-a6f4-b1d232ca179d |
Merchant ID | SWTS |
Store ID | SwipTestStore |
To place an order in the SWiP service, make the following request.
curl --location --request POST 'https://capi3.weawer.ru/orders' \ --header 'Authorization: Bearer c7a8d063-ac26-4226-a6f4-b1d232ca179d' \ --header 'X-Merchant-ID: SWTS' \ --header 'X-Store-ID: SwipTestStore' \ --header 'X-Cash-ID: 1' \ --header 'Api-Version: 2' \ --header 'Content-Type: application/json' \ --header 'Accept: */*' \ --data-raw '{ "merchantCashier": "Cashier name", "merchantCashierId": "77527945-9a53-4849-a732-bd8736b39144", "merchantOrderId": "1374289e-12fd-47e1-b111-0c6ae5568ff1", "merchantOrderNumber": "11", "purchases": [ { "id": "b314fd4e-df92-427b-a2f9-1da10dcefb78", "name": "Sprite 0,33 l", "parentId": null, "productId": null, "quantity": 1, "unit": "pcs", "price": 50.0, "amount": 50.0 } ], "saleDate": 1540485815026, "sessionCode": "https://swip.one/?qr=01234567890", "total": 50.0, "totalOriginal": 50.0 }' |
If the order was successfully placed, the response will receive the status 200 (OK). The response body will contain a created Order object with the OPEN
status.
In received response, you need to save the value of the id
key (the unique order identifier in SWiP) for further work with this order.
In received response, you need to save the value of the id
key (the unique order identifier in SWiP) for further work with this order.
To check the status of the placed order in the SWiP service, make the following request.
You need to place order ID received at the Step 1 instead of {order_id}.
You need to place order ID received at the Step 1 instead of {order_id}.
curl --location --request GET 'https://capi3.weawer.ru/{order_id}/status' \ --header 'Authorization: Bearer c7a8d063-ac26-4226-a6f4-b1d232ca179d' \ --header 'X-Merchant-ID: SWTS' \ --header 'X-Store-ID: SwipTestStore' \ --header 'X-Cash-ID: 1' \ --header 'Api-Version: 2' \ --header 'Content-Type: application/json' \ --header 'Accept: */*' |
In result you will receive a response with status 200 (OK) and the body:
{ "totalOriginal": 50.0, "total": 50.0, "paid": 0.0, "unconfirmed": 0.0, "refunded": 0.0, "swipDiscount": 0.0, "swipPoints": 0.0, "status": "OPEN", "cash": false } |
Here you can see:
The order has been placed and is awaiting payment ("status": "OPEN"
).
The order has not been paid yet ("paid": 0.0
).
To get full detailed information about a previously placed order in the SWiP service, make the following request.
You need to place order ID received at the Step 1 instead of {order_id}.
You need to place order ID received at the Step 1 instead of {order_id}.
curl --location --request GET 'https://capi3.weawer.ru/orders/{order_id}' \ --header 'Authorization: Bearer c7a8d063-ac26-4226-a6f4-b1d232ca179d' \ --header 'X-Merchant-ID: SWTS' \ --header 'X-Store-ID: SwipTestStore' \ --header 'X-Cash-ID: 1' \ --header 'Api-Version: 2' \ --header 'Content-Type: application/json' \ --header 'Accept: */*' |
In result you will receive a response with status 200 (OK). The response body will contain the Order object with the OPEN
status.
To cancel a previously placed order, you must send a closing request with the value “amount“ = 0.
You need to place order ID received at the Step 1 instead of {order_id}.
You need to place order ID received at the Step 1 instead of {order_id}.
curl --location --request POST 'https://capi3.weawer.ru/orders/{order_id}/actions/close' \ --header 'Authorization: Bearer c7a8d063-ac26-4226-a6f4-b1d232ca179d' \ --header 'X-Merchant-ID: SWTS' \ --header 'X-Store-ID: SwipTestStore' \ --header 'X-Cash-ID: 1' \ --header 'Api-Version: 2' \ --header 'Content-Type: application/json' \ --header 'Accept: */*' \ --data-raw '{ "amount": 0 }' |
In result you will receive a response with status 200 (OK). The response body will contain the Order object with the CLOSED
status.
We are always ready to help and answer all your questions via support@swip.one |