forked from LiveCarta/PayPal-PHP-SDK
Enabled Payment Experience
- Updated Api to enabled Payment Experience - Updated Tests and Samples - Added Json Validator - Ability for PPModel to return array of self objects
This commit is contained in:
28
sample/payment-experience/GetWebProfile.php
Normal file
28
sample/payment-experience/GetWebProfile.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
// ### Get Web Profile
|
||||
// If your request is successful, the API returns a web_profile object response that contains the profile details.
|
||||
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-web-experience-profile
|
||||
|
||||
// We are going to re-use the sample code from CreateWebProfile.php.
|
||||
// If you have not visited the sample yet, please visit it before trying GetWebProfile.php
|
||||
// The CreateWebProfile.php will create a web profile for us, and return a CreateProfileResponse,
|
||||
// that contains the web profile ID.
|
||||
/** @var \PayPal\Api\CreateProfileResponse $result */
|
||||
$createProfileResponse = require 'CreateWebProfile.php';
|
||||
|
||||
try {
|
||||
// If your request is successful, the API returns a web_profile object response that contains the profile details.
|
||||
$webProfile = \PayPal\Api\WebProfile::get($createProfileResponse->getId(), $apiContext);
|
||||
} catch (\Exception $ex) {
|
||||
echo "Exception: " . $ex->getMessage() . PHP_EOL;
|
||||
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
|
||||
/** @var $ex \PayPal\Exception\PPConnectionException */
|
||||
var_dump($ex->getData());
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
print_result("Get Web Profile", "Web Profile", $webProfile->getId(), $webProfile);
|
||||
|
||||
return $webProfile;
|
||||
Reference in New Issue
Block a user