Próbuję użyć SagePay. Mam konto i chciałbym korzystać z integracji z serwerem.
Otrzymuję błąd Szczegóły statusu: 5068: Metoda szyfrowania nie jest obsługiwana przez tę wersję protokołu.
Próbuję utworzyć prosty przycisk "zapłać teraz", jak opisano w dokumentach. Próbki kodu dostarczone przez sage nie działają.
Czy ktoś może dać mi znać, dlaczego poniższy kod nie działa? dzięki
<?php
require_once ("lib/SagePay.php");
$sagePay = new SagePay();
$sagePay->setCurrency("BG");
$sagePay->setAmount("100");
$sagePay->setDescription("Lorem ipsum");
$sagePay->setBillingSurname("Mustermann");
$sagePay->setBillingFirstnames("Max");
$sagePay->setBillingCity("Cologne");
$sagePay->setBillingPostCode("50650");
$sagePay->setBillingAddress1("Bahnhofstr. 1");
$sagePay->setBillingCountry("de");
$sagePay->setDeliverySameAsBilling();
/* Example of using BasketXML */
$xml = new DOMDocument();
$basketNode = $xml->createElement("basket");
$itemNode = $xml->createElement("item");
$descriptionNode = $xml->createElement( "description" );
$descriptionNode->nodeValue = "First Item Description";
$itemNode -> appendChild($descriptionNode);
$quantityNode = $xml->createElement("quantity");
$quantityNode->nodeValue = "1";
$itemNode -> appendChild($quantityNode);
$unitNetAmountNode = $xml->createElement("unitNetAmount");
$unitNetAmountNode->nodeValue = "90.00";
$itemNode -> appendChild($unitNetAmountNode);
$unitTaxAmountNode = $xml->createElement("unitTaxAmount");
$unitTaxAmountNode->nodeValue = "10.00";
$itemNode -> appendChild($unitTaxAmountNode);
$unitGrossAmountNode = $xml->createElement("unitGrossAmount");
$unitGrossAmountNode->nodeValue = "100.00";
$itemNode -> appendChild($unitGrossAmountNode);
$totalGrossAmountNode = $xml->createElement("totalGrossAmount");
$totalGrossAmountNode->nodeValue = "100.00";
$itemNode -> appendChild($totalGrossAmountNode);
$basketNode->appendChild( $itemNode );
$xml->appendChild( $basketNode );
$sagePay->setBasketXML($xml->saveHTML());
$sagePay->setSuccessURL("https://website.co.uk/page.html");
$sagePay->setFailureURL("https://website.co.uk/page.html");
?>
<form method="POST" id="SagePayForm" action="https://test.sagepay.com/gateway/service/vspform-register.vsp">
<input type="hidden" name="VPSProtocol" value= "3.00">
<input type="hidden" name="TxType" value= "PAYMENT">
<input type="hidden" name="Vendor" value= "vendorname here">
<input type="hidden" name="Crypt" value= "<?php echo $sagePay->getCrypt(); ?>">
<input type="submit" value="continue to SagePay">
</form>
Odpowiedzi:
0 dla odpowiedzi № 1Kilka rzeczy do sprawdzenia:
- Upewnij się, że używasz szyfrowania AES w polu Crypt
- Przesyłając kryptę do Sage Pay, upewnij się, że jest poprzedzone prefiksem "@"
- Upewnij się, że kodowanie ciągów nie jest kodowane przez Base64po zaszyfrowaniu AES (dokumenty protokołów są trochę mylące w tym zakresie) [aktualizacja]: 4. W rzeczywistości używasz metody integracji formularza ...
0 dla odpowiedzi nr 2
Dzięki za pomoc w tej sprawie.
To był problem z metodą szyfrowania. Kod, który w końcu pracował dla mnie, był ten:
https://github.com/tolzhabayev/sagepayForm-php/blob/master/lib/SagePay.php
A mój przycisk formularza wygląda następująco:
<form method="POST" id="SagePayForm" action="https://test.sagepay.com/gateway/service/vspform-register.vsp">
<input type="hidden" name="VPSProtocol" value= "3.00">
<input type="hidden" name="TxType" value= "PAYMENT">
<input type="hidden" name="Vendor" value= "vendornamehere">
<input type="hidden" name="Crypt" value= "<?php echo $sagePay->getCrypt(); ?>">
<input type="submit" value="continue to SagePay">
</form>