Verify a payment

How to verify a payment.

Overview

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 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

This API call uses OAuth2 authentication.

get    /checkout/v2/transactions/{id}

Run in Postman

curl --location --request GET 'https://demo-api.vivapayments.com/checkout/v2/transactions/c90d4902-6245-449f-b2b0-51d99cd09cfe' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjBEOEZCOEQ2RURFQ0Y1Qzk3RUY1MjdDMDYxNkJCMjMzM0FCNjVGOUZSUzI1NiIsInR5cCI6ImF0K2p3dCIsIng1ps5qUpclHyL9jzLdnC5I8QSjYkxw' \
--data-raw ''

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo-api.vivapayments.com/checkout/v2/transactions/c90d4902-6245-449f-b2b0-51d99cd09cfe',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjBEOEZCOEQ2RURFQ0Y1Qzk3RUY1MjdDMDYxNkJCMjMzM0FCNjVGOUZSUzI1NiIsInR5cCI6ImF0K2p3dCIsIng1dCI6IkRZLTQxdTNzOWNsLTlTZkFZV3V5TXpxMlg1OCJ9.eyJuYmYiOjE2MzkwNDI4MDQsImV4cCI6MTYzOTA0NjQwNCwiaXNzIjoiaHR0cHM6Ly9kZW1vLWFjY291bnRzLnZpdmFwYXltZW50cy5jb20iLCJhdWQiOlsiY29yZV9hcGkiLCJodHRwczovL2RlbW8tYWNjb3VudHMudml2YXBheW1lbnRzLmNvbS9yZXNvdXJjZXMiXSwiY2xpZW50X2lkIjoiZ2JqdXM3ZGdzZTBzcTJ0dXQ4MDdyYTN1cW8wM3Rtb2NsdnljemljYWhyYTQyLmFwcHMudml2YXBheW1lbnRzLmNvbSIsInVybjp2aXZhOnBheW1lbnRzOmNsaWVudF9wZXJzb25faWQiOiJCREY0QzZCMy1DMjZELTQwNDYtQjVERi01QzQ0M0VDMzlEMDkiLCJpYXQiOjE2MzkwNDI4MDQsInNjb3BlIjpbInVybjp2aXZhOnBheW1lbnRzOmNvcmU6YXBpOnJlZGlyZWN0Y2hlY2tvdXQiXX0.YcqR3InV759yxYD9uZhW2FsawyZe__RlTu-7T604o8kmZ6kFQ_DOeGt31l7X1JMBTX5p1JyPDcSIYBFQ56qCGuhJ6NIxQdx6EVl6zOGJy5DYfmJRvq2OArc3dbNiqoPcHcmnBqg0ymHs1BefLuSHg2621kDfijp3F6qVPlpUiX5Jj_Eg6VLZV28N5rKVub_bJx4os1tWZJRkSmwCs-NSZwyntq2L4sKCfPelelwLTC61CUEYwZ4Okgi6Dz1-2nkMm0vTJN9snwsKyyrEd3nX3rbnTzZJ5EI28fgBRt14wO-zKWrVmW6Dfh6X6Ups5qUpclHyL9jzLdnC5I8QSjYkxw'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Response example

{
    "email": "someone@example.com",
    "amount": 30.00,
    "orderCode": 6962462482972601,
    "statusId": "F",
    "fullName": "George Seferis",
    "insDate": "2021-12-06T14:32:10.32+02:00",
    "cardNumber": "523929XXXXXX0168",
    "currencyCode": "978",
    "customerTrns": "Short description of items/services purchased to display to your customer",
    "merchantTrns": "Short description of items/services purchased by customer",
    "transactionTypeId": 5,
    "recurringSupport": false,
    "totalInstallments": 0,
    "cardUniqueReference": "9521B4209B611B11E080964E09640F4EB3C3AA18",
    "cardCountryCode": null,
    "cardIssuingBank": null,
    "currentInstallment": 0,
    "cardTypeId": 1
}

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

Get Support

If you would like to integrate with Viva, or if you have any queries about our products and solutions, please see our Contact & Support page to see how we can help!