Skip to content

Commit

Permalink
Merge pull request #17 from chargebee/checkoutdotcom3ds
Browse files Browse the repository at this point in the history
Updated redirection in Checkout.Com 3DS PHP Code Sample
  • Loading branch information
cb-nilotpalr authored Apr 5, 2021
2 parents d1ebf81 + ca8d226 commit 61e888d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions php/php_src/CheckoutDotCom3ds.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,8 @@ function getPaymentSource($token)
$cdc = $this->getCheckout();
$response = $cdc->payments()->request($payment);
$this->setPaymentSourceID($response->id);

echo "Payment Intent ID: " . $this->getPaymentSourceID() . PHP_EOL;

echo "Complete 3DS Flow here: " . $response->getRedirection() . PHP_EOL;

$this->redirectUrl($response);
} catch (CheckoutHttpException $che) {
echo "Checkout.com Error: " . $che->getErrors()[0] . PHP_EOL;
echo "Possibly the token has expired or it has been used." . PHP_EOL;
Expand All @@ -138,13 +135,18 @@ function getPaymentSource($token)
return $this->payment;
}

function redirectUrl($response)
{

echo "Complete 3DS Flow here: " . $response->getRedirection() . PHP_EOL;

}

function checkIfPaymentIsAuthorized(): bool
{
$this->setCheckPayment($this->getCheckout()->payments()->details($this->paymentSourceID));
$currentPaymentStatus = $this->checkPayment->status;
echo "Current Payment Status: " . $currentPaymentStatus . PHP_EOL;
// if ((strcasecmp($currentPaymentStatus, "Authorized") != 0) || (strcasecmp($currentPaymentStatus, "Card Verified") != 0)){
if (($currentPaymentStatus === "Authorized") || ($currentPaymentStatus === "Card Verified")) {
return true;
}
Expand Down

0 comments on commit 61e888d

Please sign in to comment.