Cash-out with code
Paysera offers a secure API that lets you perform cash-out to your customers with their generated reservation code.
Integration with the specification
1. Scan reservation code
In order to reserve customer money you need to scan customer reservation code which is generated by Paysera app.
2. 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": [] }
3. Reserve transaction
Reserve money for the transaction using previously scanned reservation code.
PUT https://wallet.paysera.com/rest/v1/transaction/:transaction_key/reserve
Example request:
PUT /rest/v1/transaction/ATaNL6X6CivO2Ou0FMPt/reserve 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="yLzIzyNQSKHKB3wDbOwhI0NwyZ1Tnwhth0c6SRzKqp8=", ext="body_hash=m4DLVKNBTU%2F6qra5%2F85%2Fi1z0CZ%2BJjZjn07Zof9ulEss%3D"
{ "reservation_code": "0155567464130298871198969060" }
Example response:
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transaction_key": "ATaNL6X6CivO2Ou0FMPt", "created_at": 1585146007, "status": "reserved", "type": "reservation_code", "wallet": 14471, "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. 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", "price_decimal": "12.99", "wallet": 14471, "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, "limits": [ { "max_price": 300, "max_price_decimal": "3.00", "time": 604800 } ] } } }