Методы P2P создают операцию и возвращают в ответе номер платежного средства для осуществления перевода денег клиентом. В некоторых случаях для получения платежного средства клиенту понадобится пройти дополнительную проверку. После совершения перевода денег будет отправлен стандартный callback.

В случае успешного завершения операции в ответ придет статус WAITING_FOR_EXTERNAL_AUTH с номером и типом платежного средства. При необходимости дополнительной проверки придет ответ WAITING_FOR_CONFIRMATION с параметрами для верификации. На данный момент поддерживается только тип CAPTCHA_ROTATIONS с 9 картинками (матрица 3x3), в формате base64.

Завершение P2P

Для завершения проверки клиента и получения номера платежного средства необходимо отправить запрос с количеством вращений каждой картинки.

Поддерживаемые платежные средства

  • банковская карта

  • номер телефона

  • номер счета

  • внешняя страница провайдера

Поддерживаемые методы проверки

  • rotation captcha

Тестовый банк

Моделирование различных сценариев возможно с помощью передачи различных номеров телефона плательщика во входящих параметрах.

payer.phone результат

1111111111

перевод по номеру телефона

2222222222

перевод на внешней странице

3333333333

перевод по номеру карты

1111111199

перевод по номеру телефона с предварительной верификацией

2222222299

перевод на внешней странице с предварительной верификацией

3333333399

перевод по номеру карты с предварительной верификацией

прочие

отказ

Для успешного прохождения верификации необходимо передать 9 единиц в поле rotations.

Примеры запросов и ответов

Банковская карта

POST /card/1-1/operations/p2p HTTP/1.1
W1-Signature: BKaacQwxTMpTdusiFxW8jyx/J8bfiixcvIFT1xQH4WJO4NVZzzAFAzxGoU0913LSZrm3IoJn9BqKCaUq3u6fQIOzKJdstDIIThVOhM06RN38hto7gTXd6GKs2vvOM18qKdzvlxF66q1oaYtuvfD4F6TXFvDcF8byuwemxPGZo04poCK33QpgOneGbUawa/AFeAXiSs6JxZKceKq0H+xyFec7pEZBAKR3C2/qUdHOBcZ5RKLvXQi3kawxZEDxNeTEZXqmKV8T+FnV7Pf/FMxwa3wCguQCxAnysyHSkWNaT53TOGBbGyI5rDcRd2CMh6i4VVcd7NVQMRwBFCMAJtKeWg==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 479

{
  "notification" : {
    "url" : "http://127.0.0.1:8080/test/callback/default/",
    "version" : 1
  },
  "externalId" : "ext#73",
  "amount" : {
    "amount" : 10.55,
    "currency" : "USD"
  },
  "payer" : {
    "paymentMethod" : null,
    "info" : {
      "ip" : "127.0.0.1",
      "email" : "name@example.com",
      "phone" : "3333330000"
    }
  },
  "merchantParameters" : {
    "param1" : "anything you want for callback",
    "param2" : null,
    "param3" : null
  }
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 348

{
  "operationId" : "1-1-a-61",
  "status" : "WAITING_FOR_EXTERNAL_AUTH",
  "type" : "P2P",
  "externalId" : "ext#73",
  "params" : { },
  "actions" : {
    "required" : [ ]
  },
  "externalPaymentParameters" : {
    "card" : {
      "pan" : "4000000000000002",
      "bank" : {
        "name" : "BBANK"
      },
      "receiver" : null
    }
  }
}

Банковский счет

POST /card/1-1/operations/p2p HTTP/1.1
W1-Signature: H0mXHU+bBPwe5c3gzmy5LIG5Ng4QFQfM5DOT3TvdXJwMwk0+ze+S2c72M2ahOg0xKwnTtDrYwgI7ZZKqxG/4oAsV3DfS585QG/4IPwsk1evaudib/OyY8hXoauUega5Zkl/VtWBIOoDSDgC6mKk3FkNh7JFvKDUNqyq5OLE6fvDTlwBRPtpNyQ+HMNMqpekfCLdGU8O8wzFonvypWG+eRXrC53ZYEDUBTxXndsqwYAqjYyvnjF5eBJ6f7sHeAgo/rZNovTpPBgtksf67Jk/3++c+sFxPIwKpUHAYPxtLYhW9pnhrizJYF6LKuSw1Thu1PX/dOQlo1Z8hIOafWxYCqA==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 479

{
  "notification" : {
    "url" : "http://127.0.0.1:8080/test/callback/default/",
    "version" : 1
  },
  "externalId" : "ext#80",
  "amount" : {
    "amount" : 10.55,
    "currency" : "USD"
  },
  "payer" : {
    "paymentMethod" : null,
    "info" : {
      "ip" : "127.0.0.1",
      "email" : "name@example.com",
      "phone" : "4444440000"
    }
  },
  "merchantParameters" : {
    "param1" : "anything you want for callback",
    "param2" : null,
    "param3" : null
  }
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 358

{
  "operationId" : "1-1-a-67",
  "status" : "WAITING_FOR_EXTERNAL_AUTH",
  "type" : "P2P",
  "externalId" : "ext#80",
  "params" : { },
  "actions" : {
    "required" : [ ]
  },
  "externalPaymentParameters" : {
    "account" : {
      "number" : "20000000000000000004",
      "bank" : {
        "name" : "CBANK"
      },
      "receiver" : null
    }
  }
}

Номер телефона

POST /card/1-1/operations/p2p HTTP/1.1
W1-Signature: jSbeqeG6AVgezfEK7ClwlqpVxdK69WS3UPpkfy9uxQw+CMCq0+WXnK1djuihfhS14YfmP/bZ021pPlwlZXrEQ2gqRLy+CoP37bs+svwrSS1/UYKtLCeG8+JIf3bCpR6s9VvwOI6B4Twq/ceuNzOwSod/2ZF+wiHQq44jMJbm2U1TwFeQT+8m1QZBXcLW2GV0pxdrFn1peQuUmMQtFJw4/aDYC/7scl/b8VyXHuCgZCh3kSoxaiH1h4e5OW+rb5qdSrFwxGs0Ky6cPWHFJfiuV15pg6DGgecd7m9xye2ySCa4W4AmVFvjr+CZq/BZMnauKKAvQtgeYP0V6nvbmTTPRQ==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 479

{
  "notification" : {
    "url" : "http://127.0.0.1:8080/test/callback/default/",
    "version" : 1
  },
  "externalId" : "ext#74",
  "amount" : {
    "amount" : 10.55,
    "currency" : "USD"
  },
  "payer" : {
    "paymentMethod" : null,
    "info" : {
      "ip" : "127.0.0.1",
      "email" : "name@example.com",
      "phone" : "1111110000"
    }
  },
  "merchantParameters" : {
    "param1" : "anything you want for callback",
    "param2" : null,
    "param3" : null
  }
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 374

{
  "operationId" : "1-1-a-62",
  "status" : "WAITING_FOR_EXTERNAL_AUTH",
  "type" : "P2P",
  "externalId" : "ext#74",
  "params" : { },
  "actions" : {
    "required" : [ ]
  },
  "externalPaymentParameters" : {
    "phone" : {
      "number" : "1231231",
      "bank" : {
        "name" : "ABANK"
      },
      "receiver" : {
        "name" : "IVAN I"
      }
    }
  }
}

Внешняя платежная страница

POST /card/1-1/operations/p2p HTTP/1.1
W1-Signature: H0mXHU+bBPwe5c3gzmy5LIG5Ng4QFQfM5DOT3TvdXJwMwk0+ze+S2c72M2ahOg0xKwnTtDrYwgI7ZZKqxG/4oAsV3DfS585QG/4IPwsk1evaudib/OyY8hXoauUega5Zkl/VtWBIOoDSDgC6mKk3FkNh7JFvKDUNqyq5OLE6fvDTlwBRPtpNyQ+HMNMqpekfCLdGU8O8wzFonvypWG+eRXrC53ZYEDUBTxXndsqwYAqjYyvnjF5eBJ6f7sHeAgo/rZNovTpPBgtksf67Jk/3++c+sFxPIwKpUHAYPxtLYhW9pnhrizJYF6LKuSw1Thu1PX/dOQlo1Z8hIOafWxYCqA==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 479

{
  "notification" : {
    "url" : "http://127.0.0.1:8080/test/callback/default/",
    "version" : 1
  },
  "externalId" : "ext#80",
  "amount" : {
    "amount" : 10.55,
    "currency" : "USD"
  },
  "payer" : {
    "paymentMethod" : null,
    "info" : {
      "ip" : "127.0.0.1",
      "email" : "name@example.com",
      "phone" : "4444440000"
    }
  },
  "merchantParameters" : {
    "param1" : "anything you want for callback",
    "param2" : null,
    "param3" : null
  }
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 358

{
  "operationId" : "1-1-a-67",
  "status" : "WAITING_FOR_EXTERNAL_AUTH",
  "type" : "P2P",
  "externalId" : "ext#80",
  "params" : { },
  "actions" : {
    "required" : [ ]
  },
  "externalPaymentParameters" : {
    "account" : {
      "number" : "20000000000000000004",
      "bank" : {
        "name" : "CBANK"
      },
      "receiver" : null
    }
  }
}

Проверка Captcha

POST /card/1-1/operations/p2p HTTP/1.1
W1-Signature: E/L68XHeWuUvrsIhltSPqKrgpJe/w/M4nyovIBDjNEgqV4KmudSobAgxlu/C7EQ33UXYuFVGifqm5VfRfz46z5ORGG9tkpthz+6B+9qWUEla/mxDaK3tUOXgsThDO54MS07Mq5ehJfs5lhzSU6BvQR3d2FZG62WV7yZx4+jkA41v72q3oT0sBmlfjEHLEviPdZ877aENa5ibyx6Olr0rFpP3v2HM2/XO6okslAQ/B2VI7TA6kqqk4W7Y/vcXeIYht7OlpgLiho3xzGsgk04sPN4MLriUjqqmrDaD3NPkG/6/zrvzfik9nupUAwcIveefNrx5pPTzFCrt3OHKxywTlQ==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 479

{
  "notification" : {
    "url" : "http://127.0.0.1:8080/test/callback/default/",
    "version" : 1
  },
  "externalId" : "ext#75",
  "amount" : {
    "amount" : 10.55,
    "currency" : "USD"
  },
  "payer" : {
    "paymentMethod" : null,
    "info" : {
      "ip" : "127.0.0.1",
      "email" : "name@example.com",
      "phone" : "3333331000"
    }
  },
  "merchantParameters" : {
    "param1" : "anything you want for callback",
    "param2" : null,
    "param3" : null
  }
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 336

{
  "operationId" : "1-1-a-63",
  "status" : "WAITING_FOR_CONFIRMATION",
  "type" : "P2P",
  "externalId" : "ext#75",
  "params" : { },
  "actions" : {
    "required" : [ ]
  },
  "verificationParameters" : {
    "type" : "CAPTCHA_ROTATIONS",
    "params" : {
      "images" : [ "a", "b", "c", "d", "e", "f", "g", "h", "i" ]
    }
  }
}
POST /card/1-1/operations/1-1-a-63/completep2p HTTP/1.1
W1-Signature: ETYH4UacnTxyol3FjrDN+cMqBMOb545vqxLPmLVfKkLklXyu2F1ULUWO4QbSeVzVUHY5pLPZ4SvBV9Mtdvy2Ax2HDLYe1TIl5po7Evqt34W/lOhJPJDvObyhJos7bRbL76oOACRZRy6RX/K1mjgIeBe55pgMT71yI7QJbbZJ1AoVAxjjPsqN+SsoTtw81WLO7iR0zkDodKHetotePyKuunR2p/Yey1ynI5yuc26HXoNbld+7FiyNB7QpjQD6rhrBxpLuHNCx0wa2QieOxLskzZkMlkkAQYwjQbt4miOkb6JncivKfaoE5zaDzhH/OXouK23eqrGlmyUmP4nVhPysDw==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 102

{
  "type" : "CAPTCHA_ROTATIONS",
  "entity" : {
    "rotations" : [ 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
  }
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 348

{
  "operationId" : "1-1-a-63",
  "status" : "WAITING_FOR_EXTERNAL_AUTH",
  "type" : "P2P",
  "externalId" : "ext#75",
  "params" : { },
  "actions" : {
    "required" : [ ]
  },
  "externalPaymentParameters" : {
    "card" : {
      "pan" : "4000000000000002",
      "bank" : {
        "name" : "BBANK"
      },
      "receiver" : null
    }
  }
}

Пример кода для отображения Captcha

<table>
    <tr>
        <td><img src="data:image/png;base64, ${images[0]}" id="img0"/></td>
        <td><img src="data:image/png;base64, ${images[1]}" id="img1"/></td>
        <td><img src="data:image/png;base64, ${images[2]}" id="img2"/></td>
    </tr>
    <tr>
        <td><img src="data:image/png;base64, ${images[3]}" id="img3"/></td>
        <td><img src="data:image/png;base64, ${images[4]}" id="img4"/></td>
        <td><img src="data:image/png;base64, ${images[5]}" id="img5"/></td>
    </tr>
    <tr>
        <td><img src="data:image/png;base64, ${images[6]}" id="img6"/></td>
        <td><img src="data:image/png;base64, ${images[7]}" id="img7"/></td>
        <td><img src="data:image/png;base64, ${images[8]}" id="img8"/></td>
    </tr>
</table>
<input type="text" id="result"/>
<button type="button" id="submit">done</button>
div1=document.createElement("div");
div1.innerHTML = `$html`;
document.body.appendChild(div1);

var rotations = {
    'img0': 0,
    'img1': 0,
    'img2': 0,
    'img3': 0,
    'img4': 0,
    'img5': 0,
    'img6': 0,
    'img7': 0,
    'img8': 0,
}

var txtField = document.getElementById('result');

var imageNodes = document.getElementsByTagName('IMG');
for (var i=0; i<imageNodes.length; i++) {
   imageNodes[i].addEventListener('click', e => {
       var target = e.currentTarget
       var angle = (rotations[target.id] + 90) % 360;
       rotations[target.id] = angle;


       target.style.transform = 'rotate(' + angle + 'deg)';

       var value = "";
       for (const [key, vl] of Object.entries(rotations)) {
         value = value + (vl / 90);
       }
       txtField.value = value;
   })
}

var btn = document.getElementById("submit")
btn.addEventListener('click', e => {
   var result = document.createElement("input");
   result.id = "finalResult";
   result.type = "text";
   result.value = txtField.value;
   document.body.appendChild(result);
})