Verify a payment

To verify a payment you need to use the Retrieve transactions API call to get the status of the transaction along with additional information. You need to provide the transaction ID as a path parameter in the API call.

After the customer clicks on the payment button, which appears on the Viva Wallet page that is used to pay the payment order, the customer is redirected back to your website. If the payment has been successful, the customer is redirected to the Success URL. The redirection uses the HTTP GET method and appends several parameters to the URL, one of which is t (uuid) or transaction ID:

Transaction ID

Request example

curl -L -X GET 'https://demo.vivapayments.com/api/transactions/a2066e6a-64bc-401f-bfc0-43786fa6b3d2' \
-H 'Authorization: Basic ZGRiODI1NzktMGI3Zi00NzUyLTk5MTgtNTVlZTJlZTE1NjhkOmhWMVUmRA=='

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo.vivapayments.com/api/transactions/a2066e6a-64bc-401f-bfc0-43786fa6b3d2',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic ZGRiODI1NzktMGI3Zi00NzUyLTk5MTgtNTVlZTJlZTE1NjhkOmhWMVUmRA=='
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Run in Postman

Response example

{
    "Transactions": [
        {
            "Fee": 0.00,
            "BankId": "NET_VISA",
            "ParentId": null,
            "Switching": false,
            "Amount": 90.00,
            "StatusId": "F",
            "ChannelId": "d84f93ff-8ad0-4d97-a7a3-f187dd667553",
            "MerchantId": "ddb82579-0b7f-4752-9918-55ee2ee1568d",
            "ResellerId": null,
            "InsDate": "2020-12-10T17:13:06.557+02:00",
            "CreatedBy": null,
            "TipAmount": 0.00,
            "SourceCode": "Default",
            "TransactionId": "a2066e6a-64bc-401f-bfc0-43786fa6b3d2",
            "Commission": 2.40,
            "PanEntryMode": "01",
            "MerchantTrns": "Your reference",
            "CustomerTrns": "Short description of items/services purchased to display to your customer",
            "IsManualRefund": false,
            "TargetPersonId": null,
            "AcquirerApproved": false,
            "SourceTerminalId": 90000000,
            "RedeemedAmount": 0.00,
            "AuthorizationId": "815856",
            "TotalInstallments": 6,
            "CurrentInstallment": 0,
            "ClearanceDate": null,
            "ResellerSourceCode": null,
            "RetrievalReferenceNumber": "034515815856",
            "Order": {
                "OrderCode": 4220316024772609,
                "ChannelId": "95d02b56-bace-4608-ad1b-c1a8da705e52",
                "ResellerId": null,
                "SourceCode": "Default",
                "Tags": [
                    "sample string 1",
                    "sample string 2",
                    "sample string 3"
                ],
                "RequestLang": "en-GB",
                "ResellerSourceCode": null
            },
            "Payment": {
                "Email": "customer@example.com",
                "Phone": "07967813180",
                "ChannelId": "d84f93ff-8ad0-4d97-a7a3-f187dd667553",
                "FullName": "Test",
                "Installments": 6,
                "RecurringSupport": true
            },
            "TransactionType": {
                "Name": "CardChargeInstallments",
                "TransactionTypeId": 6
            },
            "CreditCard": {
                "Token": "B6D3CC438671F16B211D83BBC077FEBD843CBC28",
                "Number": "411111XXXXXX1111",
                "CountryCode": "US",
                "IssuingBank": "Demo Bank",
                "CardHolderName": "Test",
                "ExpirationDate": "2024-01-31T00:00:00",
                "CardType": {
                    "Name": "VISA",
                    "CardTypeId": 0
                }
            }
        }
    ],
    "ErrorCode": 0,
    "ErrorText": null,
    "TimeStamp": "2021-05-04T17:06:46.1156443+03:00",
    "CorrelationId": null,
    "EventId": 0,
    "Success": true
}

See also the full-length PHP code sample for retrieving a transaction.