Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

Після того, як у відповідь на метод POST After responding to the POST method /api/invoicer/payments/checkStatus було отримано was received data.status=NEEDS_CONFIRMATION та and data.confirmation.type=3DS, необхідно перенаправити користувача на ACS-сторінку банка емітента для виконання підтвердження платежу.

...

it is necessary to redirect the user to the ACS-page of the issuer's bank to confirm the payment.

To do this, you need to perform a query using the POST method on URL data.confirmation.url. Якщо є параметри в об'єкті If there are parameters in the object data.confirmation.form - їх потрібно передати в запиті (всі вони не є обов'язковими). Обов'язково потрібно передати параметр TermUrl, його потрібно сформувати за принципом they must be passed in the request (they are not all required). Be sure to pass the parameter TermUrl, it must be formed on the principle URL + query string параметриparameters: id, redirect, key (не є обов'язковимnot required)::

Info

${redirectUrl}?id=${redirectParamsId}&key=${key}&redirect=${redirect}

деwhere:

  • ${redirectUrl} - значення поля value of the field data.redirect.url з відповіді на запит отримання статусу платежуfrom the response to the request to receive the payment status;

  • ${redirectParamsId} - значення поля field value data.redirect.params.id з відповіді на запит отримання статусу платежу in response to a request for payment status;

  • ${key} - значення поля the value of the data.key з відповіді на запит створення платежуfield in response to the payment request;

  • ${redirect} - URL, на який буде виконано перенаправлення після завершення підтвердження на ACS-сторінці (зазвичай URL сторінки мерчанта)

...

  • to be redirected to after completion of ACS page verification (usually Merchant page URL)

Example of response to the POST method api/invoicer/payments/checkStatus:

Code Block
{
  "status": 1,
  "data": {
    "id": "d00c4a4e-30e6-499c-8dba-9fae2816094c",
    "externalId": "ab527192-0f81-423d-a192-d6d270d3a9d2.1611586242200",
    "receiptId": "8SRY8F4AK95E",
    "status": "NEEDS_CONFIRMATION",
    "amount": 1200,
    "pluginId": 38,
    "key": "7qAux1wS9QrEjMutPcahmtHvUBECmXuiyYu6AhQrCgZu.kkcou74107632189319",
    "confirmation": {
      "type": "3DS",
      "url": "https://api.demo.uapay.ua/api/acs/virtual/form",
      "form": {
        "PaReq": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlcklkIjoiMjc5MTZjODEtOTIwYi00YWFlLTkxNWYtZjEwNjBiZDdkOGYxIiwiYW1vdW50IjoxMzI0LCJwYW5NYXNrZWQiOiI1NDU0NTQ1NDU0IiwiaWF0IjoxNjExNTg2MjQzfQ.Wof7YYGOed6AJdeuPGzQZ8T6sZEz_i9zq1o84CjAgEM",
        "MD": "27916c81-920b-4aae-915f-f1060bd7d8f1"
      }
    },
    "redirect": {
      "url": "https://api.demo.uapay.ua/api/payments/ecom/confirm",
      "params": {
        "id": "d00c4a4e-30e6-499c-8dba-9fae2816094c"
      },
      "directAcs": null
    },
    "paymentStatus": "NEW"
  }
}
Info

Приклад сформованого An example of the formed TermUrl:
https://api.demo.uapay.ua/api/payments/ecom/confirm?id=d00c4a4e-30e6-499c-8dba-9fae2816094c&redirect=https://uapay.ua/

Щоб зробити POST-запит до банку емітенту, потрібно створити і викликати HTML-форму. Приклад з використанням To make a POST request to the issuer's bank, you need to create and call an HTML form. Example using JavaScript:

Code Block
<!DOCTYPE html>
<html>

<head>
    <title>Example call ACS</title>
</head>

<body>
    <script type="text/javascript">
    var form = document.createElement('form');
    form.setAttribute('method', 'POST');
    form.setAttribute('action', data.confirmation.url);

    var paReq = document.createElement('input');
    paReq.setAttribute('type', 'hidden');
    paReq.setAttribute('name', 'PaReq');
    paReq.setAttribute('value', data.confirmation.form.PaReq);
    form.appendChild(paReq);

    var md = document.createElement('input');
    md.setAttribute('type', 'hidden');
    md.setAttribute('name', 'MD');
    md.setAttribute('value', data.confirmation.form.MD);
    form.appendChild(md);

    var termUrl = document.createElement('input');
    termUrl.setAttribute('type', 'hidden');
    termUrl.setAttribute('name', 'TermUrl');
    termUrl.setAttribute('value', termUrl);
    form.appendChild(termUrl);
    
    document.body.append(form);
    
    form.submit();
    </script>
    </body>

</html>

Після повернення користувача на сторінку необхідно продовжувати відправляти запит show, до тих пір, поки не буде отримано фінальний статус платежуAfter the user returns to the page, it is necessary to continue sending the show request, until the final payment status is received.