forked from LiveCarta/PayPal-PHP-SDK
Updates to Sample Code
- Updated UI Presentation on samples - Fixed Bugs
This commit is contained in:
@@ -6,30 +6,20 @@
|
||||
// API called: '/v1/vault/credit-card'
|
||||
// The following code takes you through
|
||||
// the process of retrieving a saved CreditCard
|
||||
require __DIR__ . '/../bootstrap.php';
|
||||
use PayPal\Api\CreditCard;
|
||||
/** @var CreditCard $card */
|
||||
$card = require 'CreateCreditCard.php';
|
||||
|
||||
// The cardId can be obtained from a previous save credit
|
||||
// card operation. Use $card->getId()
|
||||
$cardId = "CARD-44D10970C24287906KRCTWNI";
|
||||
use PayPal\Api\CreditCard;
|
||||
|
||||
/// ### Retrieve card
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
try {
|
||||
$card = CreditCard::get($cardId, $apiContext);
|
||||
} catch (PayPal\Exception\PPConnectionException $ex) {
|
||||
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||
var_dump($ex->getData());
|
||||
exit(1);
|
||||
$card = CreditCard::get($card->getId(), $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Get Credit Card", "Credit Card", $card->getId(), null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Lookup a saved credit card</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>Retrieving saved credit card: <?php echo $cardId;?></div>
|
||||
<pre><?php echo $card->toJSON(128);?></pre>
|
||||
<a href='../index.html'>Back</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
ResultPrinter::printResult("Get Credit Card", "Credit Card", $card->getId(), null, $card);
|
||||
|
||||
return $card;
|
||||
|
||||
Reference in New Issue
Block a user