i have two problem.
Tested in our site:
Need solution for: Get the transaction id from accepted hosted form and then show into our parent page (our site).
Code sample:
IFrameCommunicator.html
<script>
window.CommunicationHandler = {};
function parseQueryString(str) {
alert("iii hee");
var vars = [];
var arr = str.split('&');
var pair;
for (var i = 0; i < arr.length; i++) {
pair = arr[i].split('=');
vars[pair[0]] = unescape(pair[1]);
}
return vars;
}
window.CommunicationHandler.onReceiveCommunication = function (argument) {
params = parseQueryString(argument.qstr)
parentFrame = argument.parent.split('/')[4];
switch (params['action']) {
case "transactResponse":
var transResponse = JSON.parse(params['response']);
if (transResponse.transId > 0) {
alert(transResponse.transId);
}
}
}
</script>
Mytoken_generation_accepted_host.php
$setting3 = new AnetAPI\SettingType();
$setting3->setSettingName("hostedPaymentReturnOptions");
$setting3->setSettingValue("{\"showReceipt\" : false }");
$commUrl = json_encode(array('url' => $homeurl."IFrameCommunicator.html" ), JSON_UNESCAPED_SLASHES);
$setting7 = new AnetAPI\SettingType();
$setting7->setSettingName("hostedPaymentIFrameCommunicatorUrl");
$setting7->setSettingValue($commUrl);
07-07-2022 08:16 AM
he implementation and use of Accept Hosted follow a basic workflow:
1. You call getHostedPaymentPageRequest to request a form token. This request contains transaction information and form parameter settings.
2. You embed the payment form or redirect the customer to the payment form by sending an HTML POST containing the form token to https://accept.authorize.net/payment/payment.
3. Your customer completes and submits the payment form.
4. The API sends the transaction to Authorize.net for processing.
5. The customer is returned to your site, which displays a result page based on the URL followed or the response details sent. PFM Login
07-08-2022 02:51 AM