Transaction Resource
Transactions are also good when making shop carts with payments to different beneficiaries - user will have to confirm something just once.
Automatically created transactions
When creating payment or allowance, transaction is created with default parameters. It's key is provided in the response astransaction_key
. Automatically created transaction always has only one payment or allowance.allowance
parameter optional
is false
in automatically created transactions.transaction_key
for payment or allowance can change if new transaction is created with that payment or
allowance. Only one transaction can be assigned to any payment or allowance - if payment is added to another transaction,
it is removed from the old one.Create transaction
This method creates transaction that groups payment(s) and/or allowance into one confirmable item.new
are deleted automatically 1 month after creation time.
Request
POST https://wallet.paysera.com/rest/v1/transaction
Request body structure
payments
allowance
is not specified
allowance
payments
is not specified
reserve
It's used with one of parameter inside:
for
or until
unavailable if
reserve_until
or reserve_for
is provided
for
- Maximum reservation time in seconds. Time starts when user accepts transaction. In this
time must confirm the transaction to finish it successfuly, otherwise money will be returned to the payer
until
- Maximum reservation time in UNIX timestamp - reservation will last up to that moment
reserve_for
24
hoursunavailable if
reserve_until
or reserve
is provided
reserve
with subparameter for
instead.
Maximum reservation time in hours. Time starts when user accepts transaction. In this time you must confirm the transaction to finish it successfuly, otherwise money will be returned to the payer
reserve_until
reserve_for
or reserve
is provided
reserve
with subparameter until
instead.
Maximum reservation time in UNIX timestamp - reservation will last up to that moment
use_allowance
false
true
is used if accepting transaction by
using active allowance
suggest_allowance
false
;ignored if
allowance
is provided
auto_confirm
false
;unavailable if at least one payment in transaction has no beneficiary specified
true
, transaction is automatically confirmed after going to reserved
.
This option is only available if transaction has only allowance or only payments with beneficiary specified.
This option is unrecommended, use it only if confirmation from the client is unavailable.
redirect_uri
callback_uri
false
false
is provided, callbacks for this
transaction will not be made
user
inquiries
new
objects. If you include already confirmed payment,
operation will fail
Allowance data structure
id
data
is not provided;unavailable if
data
is provided
data
id
is not provided;unavailable if
id
is provided
optional
false
User data structure
email
Response data structure
On success API returns transaction object that was created. See get transaction information for more info.Errors
limit_violation
(status code 400
)
Example request for grouping already created payments
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="WAkhZJYmq4avsKOxXKBjOFM7Z7HnPhC5LR7FN4e/sys=", ext="body_hash=PeBwBRvUOAkvAMBcOdXPPpg6u%2Bn1naMXUupsHZK01Rg%3D"
{ "payments": [ 2987, 2988 ], "suggest_allowance": true }
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "new", "project_id": 2248, "valid_for_payment_card_debit": false, "payments": [ { "id": 2987, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "new", "price": 1299, "currency": "EUR", "price_decimal": "12.99", "description": "Payment for order No. 2001", "parameters": { "orderid": 2001 } }, { "id": 2988, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "new", "price": 500, "currency": "EUR", "price_decimal": "5.00", "description": "Payment for order No. 2002", "parameters": { "orderid": 2002 } } ], "reserve": { "until": 1355400732 }, "use_allowance": false, "suggest_allowance": true, "auto_confirm": false }
transaction_key
of all objects in the transaction are the same and equals to that of transaction itself
Example request for creating payment and assigning optional allowance
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="R5Kw+qeaej/TRdVEkxbKzJHeHfA7HbsEcI4StcJo3lU=", ext="body_hash=gK8kVbYW1XEeZUf4BR1yZ45YLu%2BEYnq1WOGYtRhxyQA%3D"
{ "payments": [ { "description": "Payment for order No. 1234", "price": 1299, "currency": "EUR", "parameters": { "orderid": 1234 } } ], "allowance": { "id": 784, "optional": true }, "redirect_uri": "http://www.example.com/somePage" }
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "new", "project_id": 2248, "valid_for_payment_card_debit": false, "payments": [ { "id": 2988, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "new", "price": 1299, "currency": "EUR", "price_decimal": "12.99", "description": "Payment for order No. 1234", "parameters": { "orderid": 1234 } } ], "allowance": { "optional": true, "data": { "id": 784, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "new", "description": "Allowance for weekly services (5 weeks)", "currency": "EUR", "max_price": 1500, "max_price_decimal": "15.00", "limits": [ { "max_price": 300, "max_price_decimal": "3.00", "time": 604800 } ] } }, "reserve": { "until": 1355400732 }, "use_allowance": false, "suggest_allowance": false, "auto_confirm": false, "redirect_uri": "http://www.example.com/somePage" }
Renew transaction
This method creates new transaction based on some other transaction. Basically it resets transaction status to
new
, but new transaction is created for this purpose to be able to see all history more easily.
status
codes to be renewed: deleted
, rejected
,
failed
, revoked
.
Request
POST https://wallet.paysera.com/rest/v1/transaction/renew/:transaction_key
Parameters
transaction_key - transaction_key assigned to transaction. Can be get from creation response of transaction or some other object
Response data structure
On success API returns transaction object that was created. See get transaction information for more info.Example request
POST /rest/v1/transaction/renew/pDAlAZ3z HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="1fOTmeSJdSPBoLGYSn4ORO7U6fvT7QcJIkJ8TXcuDAQ="
Get transaction information
This method returns transaction information that was created earlier. Transaction information can change in time, because it contains status field.Request
GET https://wallet.paysera.com/rest/v1/transaction/:transaction_key
Parameters
transaction_key - key of transaction. Can be get from transaction and other objects creation responses
Response data structure
transaction_key
created_at
status
new
, waiting
, waiting_funds
,
waiting_registration
, waiting_password
, revoked
, rejected
, failed
,
reserved
, confirmed
, deleted
type
status
is not new
automatic
, page
, flash
, user_initiated
, pin
,
reservation_code
, mobile_app
wallet
always if
status
is reserved
or confirmed
valid_for_payment_card_debit
confirmed_at
status
is confirmed
correlation_key
status
is waiting
and type
is flash
project_id
payments
payments
was provided when creating the transaction
allowance
allowance
was provided when creating the transaction
optional
(same as when creating the transaction) and data
, which
holds allowance object. Structure of the object is the same as when
getting allowance information
reserve
for
or until
for
- same as provided when creating the transaction.
Only if it was provided when creating the transaction
until
- date in UNIX timestamp until when the money is reserved for this transaction.
You must confirm transaction before this time to finish it.
Only if status
is reserved
or it was provided when creating the transaction
reserve_until
status
is reserved
or it was provided when creating the transaction
reserve
with subparameter until
instead.
Date in UNIX timestamp until when the money is reserved for this transaction. You must confirm transaction before this time to finish it
reserve_for
reserve
with subparameter for
instead.
Same as provided when creating the transaction
use_allowance
status
is new
true
if not provided
suggest_allowance
status
is new
false
if suggest_allowance
was not provided or allowance
was,
otherwise the same as when creating the transaction
auto_confirm
redirect_uri
redirect_uri
was provided when creating the transaction
callback_uri
callback_uri
was provided when creating the transaction
manager_id
user
user
was provided when creating the transaction
inquiries
inquiries
where provided when creating transaction
location_id
Meaning of transaction status codes
new
- Initial state of the transaction. Only new
transactions can be given to the user to accept.
waiting
- Transaction was presented to the user and is waiting for user to accept or reject.
waiting_funds
- Transaction was accepted by user on the web page, but there is not enough funds in selected account. After incoming funds, if it is enough for all payments in transaction, flow continues.
waiting_registration
- Transaction was accepted by user and money was reserved, but at least one beneficiary is not yet registered in Paysera system.
This state can be entered from new
, if reserve transaction API method was used with active allowance and at least one beneficiary is not yet registered.
Transaction can be in this state only when making payments between users and using phone or email identifier for beneficiary.
waiting_password
- Transaction was accepted by user and money was reserved, but a password was given for at least one payment and is still not provided. Password should be provided by client or by user, receiving the payment.
This state can be entered from new
, if reserve transaction API method was used with active allowance and at least one password was given.
revoked
- Client can revoke transactions which are waiting
, waiting_funds
, waiting_registration
, waiting_password
or reserved
. After revoking, transaction will become revoked
rejected
- User has rejected this transaction
failed
- Transaction has failed due to a timeout or some similar reason
reserved
- Transaction has been accepted by the user and the money was reserved for this transaction. You must confirm or revoke the transaction. If no action is made in some time, transaction is automatically made failed
and money reservation is canceled. You can know when transaction is reserved by using callbacks.
confirmed
- You have confirmed the transaction. It is successfully made, this is the final state of the transaction
deleted
- Transactions with status new
are automatically deleted after some time. Deleted items are accessible in the system only by providing their unique identifier.
done
and canceled
statuses are available only for payments.
Up to these states, all payments in the same transaction has the same status as the transaction itself
Example request
GET /rest/v1/transaction/pDAlAZ3z HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="G8FdB/Ck6eSGwDo2Em4kDG4N3pr4s72r8H1OvXhzbdE="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "confirmed", "type": "page", "wallet": 14471, "valid_for_payment_card_debit": false, "confirmed_at": 1355314392, "project_id": 2248, "payments": [ { "id": 2988, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "confirmed", "price": 1299, "currency": "EUR", "price_decimal": "12.99", "wallet": 14471, "confirmed_at": 1355314392, "freeze": { "until": 1357992732 }, "description": "Payment for order No. 1234", "parameters": { "orderid": 1234 } } ], "allowance": { "optional": true, "data": { "id": 784, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "active", "currency": "EUR", "wallet": 14471, "confirmed_at": 1355314392, "valid": { "until": 1357992732 }, "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 } ] } } }
Search transactions
This method returns transaction list by provided filters.Request
GET https://wallet.paysera.com/rest/v1/transactions?status=:status&wallet=:wallet&from=:from&to=:to&limit=:limit&offset=:offset
Parameters
status - optional; comma separated statuses of transactions to search for
wallet - optional; ID of the wallet in Paysera system which was related to the transaction
from
- optional; date from which results should be provided in UNIX timestamp. Defaults to week before to
to - optional; date from which results should be provided in UNIX timestamp. Defaults to current time
limit
- optional; maximum number of results to be returned in one response. Defaults to 20
, maximum available is 200
offset
- optional; number of results to skip. Defaults to 0
Response data structure
transactions
_metadata
Metadata information structure
total
limit
and offset
parameters
offset
limit
Example request when searching for reserved transactions
GET /rest/v1/transactions?status=reserved%2Cconfirmed HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="tJHijYiz23/2KvTeaRf2E2dxsuodkuukY9UNR/J08hE="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transactions": [ { "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "reserved", "type": "page", "wallet": 14471, "valid_for_payment_card_debit": false, "project_id": 2248, "payments": [ { "id": 2988, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "confirmed", "price": "12.99", "currency": "EUR", "wallet": 14471, "confirmed_at": 1355314392, "freeze": { "until": 1357992732 }, "description": "Payment for order No. 1234", "parameters": { "orderid": 1234 } } ] } ], "_metadata": { "total": 1, "offset": 0, "limit": 50 } }
Revoke transaction
This method revokes transaction. status
of the transaction must be waiting
,
waiting_funds
, waiting_registration
, waiting_password
or reserved
.
If transaction is new
, this method deletes it.
Request
DELETE https://wallet.paysera.com/rest/v1/transaction/:transaction_key
Parameters
transaction_key - key of transaction. Can be get from transaction and other objects creation responses
Response data structure
On success API returns transaction object that was revoked. See get transaction information for more info.Example request
DELETE /rest/v1/payment/pDAlAZ3z HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="zdgKunsm+SVagkNOnpMNJl4jiwSmnM7Bezy2/bYFh9Q="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "revoked", "type": "page", "wallet": 14471, "valid_for_payment_card_debit": false, "project_id": 2248, "payments": [ { "id": 2988, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "revoked", "price": 1299, "currency": "EUR", "price_decimal": "12.99", "wallet": 14471, "freeze": { "until": 1357992732 }, "description": "Payment for order No. 1234", "parameters": { "orderid": 1234 } } ], "allowance": { "optional": true, "data": { "id": 784, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "inactive", "currency": "EUR", "wallet": 14471, "valid": { "until": 1357992732 }, "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 } ] } } }
Confirm transaction
When the money is reserved, you can confirm or revoke the transaction.Request
PUT https://wallet.paysera.com/rest/v1/transaction/:transaction_key/confirm
Parameters
transaction_key - transaction_key assigned to transaction. Can be get from creation response of transaction or some other object
Request data structure
Request body is optional and can be provided if it is needed to reduce amounts of one or several payments at confirmation time. If amount change is not needed, request body can be omitted.
If provided, request structure must be an object, which keys are payment IDs in current transaction, and each value is price object.
Structure of price object
price
price_decimal
is not provided,
unavailable if
price_decimal
is provided
currency
price_decimal
price
is not provided,
unavailable if
price
is provided
Response data structure
Confirmed transaction is returned on success. See get transaction information response data structure for more information.Errors
Ifcashback
is set to any of the payments, following errors may occur:
not_enough_funds
(status code 400
),
limits_exceeded
(status code 400
),
restriction_limits_exceeded
(status code 400
),
no_rights
(status code 400
)
Example request
PUT /rest/v1/transaction/pDAlAZ3z/confirm HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="ZQYIS0L4Uq40te+qxNXJzWHNO6Ff7qhnEDuwduFlqRI="
Example request with price reduction
PUT /rest/v1/transaction/pDAlAZ3z/confirm 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="Uvw+/2IIWPhmbVg9slod1EHhrxX/1dAMkCALBWVIktI=", ext="body_hash=oeolAI8pLwYDuNDCv74QhcBxRH7ec3cNt5PkaFyrVHo%3D"
{ "2988": { "price": 799, "currency": "EUR" } }
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "confirmed", "type": "page", "wallet": 14471, "valid_for_payment_card_debit": false, "confirmed_at": 1355314392, "project_id": 2248, "payments": [ { "id": 2988, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "confirmed", "price": 1299, "currency": "EUR", "price_decimal": "12.99", "wallet": 14471, "confirmed_at": 1355314392, "freeze": { "until": 1357992732 }, "description": "Payment for order No. 1234", "parameters": { "orderid": 1234 } } ], "allowance": { "optional": true, "data": { "id": 784, "transaction_key": "pDAlAZ3z", "created_at": 1355314332, "status": "active", "currency": "EUR", "wallet": 14471, "confirmed_at": 1355314392, "valid": { "until": 1357992732 }, "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 } ] } } }
Getting receipt for confirmed transaction
In case user is identified at some location (for offline
or gateway
clients),
receipt with transaction information can be printed for the user.
Request
GET https://wallet.paysera.com/rest/v1/transaction/:transaction_key/receipt?locale=:locale&width=:width
Parameters
transaction_key - key of the transaction
locale
- optional parameter; locale for the text translation. Currently available locales: en
, lt
, ru
width - optional parameter; maximum symbol count in one line. Longer lines will be broken into separate ones
Response data structure
text_for_customer
\r\n
characters (CR + LF)
text_for_merchant
\r\n
characters (CR + LF)
Example request
GET /rest/v1/transaction/pDAlAZ3z/receipt?locale=en HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="ljIHyvUhkBj4C5J68XbMiEZzPsWaR05BXQm13parnLY="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "text_for_customer": "Transaction ID: pDAlAZ3zrnMerchant ID: 125rnConfirmed with PIN code", "text_for_merchant": "Transaction ID: pDAlAZ3zrnWallet ID: 14471rnConfirmed with PIN code" }