Scan and Pay
Информация Извините, эта глава доступна только на английском языке.
Paysera offers a secure API that lets your customers easily pay for product or service using your generated or static QR code. In this chapter will be explained use case with a static QR code (PAYSERA*{locationId}:{identifier}).
Generating QR code
Different QR code types initiate different actions when scanned.
Available QR code templates.
Template
Description
PAYSERA%{transactionKey}
Code is used to initiate transaction confirmation
PAYSERA*{locationId}:{identifier}
Code is used to get transactions registered for some concrete place. See POS Features for more details
EVP{walletId}
walletId
is padded with0
to the left side to the total of 12 characters. This code initializes payment form to beneficiary with specified wallet ID. For example, useEVP000000000001
to initialize payment form to wallet with ID1
https://paysera.com/app?qr={code}
code
is any other QR code - when this QR code is scanned with Paysera application, this has the same effect as if just thecode
value is scanned. However if it's scanned with some other QR code scanner, page in this URL gives more information about the application and how it could be installed on the device
Integration with the specification
1. Customer scans QR code
Customer scans your generated QR code. Spot status changes to waiting.
2. Get spots with waiting status
Info
You should frequently check for spots with waiting status
GET https://wallet.paysera.com/rest/v1/spots?status=:waiting
Example request:
GET /rest/v1/spots?status=waiting HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="irSg0m2b8N87EIhAENNkP+2O3E2x0KkddoTMSOEmHt8="
Example response:
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "spots": [ { "id": 15, "status": "waiting", "identifier": "table1", "place_info": { "title": "Cool caffe", "description": "Coffee and cakes for everyone, even you!", "address": "address", "location_id": 1 }, "check_ins": [ { "user_id": 99, "date": 1111111112 } ], "orders": [] } ], "_metadata": { "total": 1, "offset": 0, "limit": 3 } }
3. Create transaction
POST https://wallet.paysera.com/rest/v1/transaction
Example request:
POST /rest/v1/transaction HTTP/1.1 Host: wallet.paysera.com Content-Type: application/json;charset=utf-8 User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="VEXxazEcDiEls7djj12ngBiMBv3JzwJOn8+Eqd9NUx8=", ext="body_hash=IVDvIGlLKavxtPIloqFNlAspEt1YlRL2VEGmcNjLPKg%3D"
{ "payments": [ { "description": "Payment for order No. 1234", "price": 1299, "currency": "EUR", "parameters": { "orderid": 1234 } } ], "redirect_uri": "http://www.example.com/somePage" }
Example response:
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "created_at": 1585146007, "status": "new", "valid_for_payment_card_debit": false, "reserve": { "for": 2592000 }, "use_allowance": true, "suggest_allowance": false, "auto_confirm": false, "redirect_uri": "http://www.example.com/somePage", "project_id": 19019492, "payments": [ { "id": 186975531, "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "created_at": 1585146007, "status": "new", "cancelable": false, "price": 1299, "currency": "EUR", "price_decimal": "12.99", "freeze": { "for": 0 }, "freeze_for": 0, "description": "Payment for order No. 1234", "parameters": { "orderid": 1234 } } ], "inquiries": [] }
4. Create an order with a transaction created above
POST https://wallet.paysera.com/rest/v1/spot/:id/order
Example request:
POST /rest/v1/spot/1/order HTTP/1.1 Host: wallet.paysera.com Content-Type: application/json;charset=utf-8 User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="tG7zkaFGyeqt00i9NXKhiVzPjuLYh2GinSL6l6Cgijc=", ext="body_hash=9fSrhGfETAG0H9O%2BMqrpupLFqtG8nB05dag9neRfZoY%3D"
{ "transaction_key": "ATaNL6X6CivO2Ou0FMPt" }
Example response:
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "id": 11, "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "status": "pending" }
5. Customer confirms order
Customer gets information about created order and confirms it. After that transaction status becomes reserved.
6. Get transactions with reserved status
GET https://wallet.paysera.com/rest/v1/transactions?status=:reserved
Example request:
POST /rest/v1/transactions?status=reserved HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="yxj82ABgJ3TpNWWpsnoEijfhZdx4a5etY5ncyeLCw1A="
Example response:
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transactions": [ { "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "created_at": 1585146007, "status": "reserved", "type": "page", "wallet": 14471, "valid_for_payment_card_debit": false, "project_id": 2248, "payments": [ { "id": 186975531, "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "created_at": 1585146007, "status": "confirmed", "price": 1299, "currency": "EUR", "price_decimal": "12.99", "wallet": 14471, "confirmed_at": 1585146195, "freeze": { "until": 1585146295 }, "description": "Payment for order No. 1234", "parameters": { "orderid": 1234 } } ] } ], "_metadata": { "total": 1, "offset": 0, "limit": 50 } }
7. Confirm transaction
PUT https://wallet.paysera.com/rest/v1/transaction/:transaction_key/confirm
Example request:
PUT /rest/v1/transaction/ATaNL6X6CivO2Ou0FMPt/confirm HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="MJzOrlIPFTOujw0WODc8HHHGGlDCFCjRK2U2pt23yoQ="
Example response:
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "created_at": 1585146007, "status": "confirmed", "type": "page", "wallet": 14471, "valid_for_payment_card_debit": false, "confirmed_at": 1355314392, "project_id": 2248, "payments": [ { "id": 2988, "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "created_at": 1585146007, "status": "confirmed", "price": 1299, "currency": "EUR", "wallet": 14471, "price_decimal": "12.99", "confirmed_at": 1585146195, "freeze": { "until": 1585146295 }, "description": "Payment for order No. 1234", "parameters": { "orderid": 1234 } } ], "allowance": { "optional": true, "data": { "id": 784, "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "created_at": 1585146007, "status": "active", "currency": "EUR", "wallet": 14471, "confirmed_at": 1585146195, "valid": { "until": 1585146295 }, "description": "Allowance for weekly services (5 weeks)", "max_price": 1500, "max_price_decimal": "15.00", "limits": [ { "max_price": 300, "max_price_decimal": "3.00", "time": 604800 } ] } } }
8. Close spot
PUT https://wallet.paysera.com/rest/v1/spot/:id/close
Example request:
PUT /rest/v1/spot/15/close HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="963jX80YNVkX0rpIvMKQvi0/5II1qB2PQPfrBJagg3s="
Example response:
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "id": 15, "status": "closed", "identifier": "table1", "place_info": { "title": "Cool caffe", "description": "Coffee and cakes for everyone, even you!", "address": "address", "location_id": 9975 }, "orders": [ { "id": 11, "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "status": "closed" } ] }