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:
japatel
2014-10-13 12:00:31 -05:00
parent 792cdc2b93
commit 0cb302326a
55 changed files with 1936 additions and 654 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class CreateProfileResponse
*
* Response schema for create profile api
*
* @package PayPal\Api
*
* @property string id
*/
class CreateProfileResponse extends PPModel
{
/**
* ID of the payment web experience profile.
*
*
* @param string $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* ID of the payment web experience profile.
*
* @return string
*/
public function getId()
{
return $this->id;
}
}

View File

@@ -1,52 +1,120 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
use PayPal\Validation\UrlValidator;
/**
* Class FlowConfig
*
* Parameters for flow configuration.
*
* @package PayPal\Api
*
* @property string landing_page_type
* @property string bank_txn_pending_url
*/
class FlowConfig extends PPModel {
class FlowConfig extends PPModel
{
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
*
*
* @param string $landing_page_type
*
* @return $this
*/
public function setLandingPageType($landing_page_type)
{
$this->landing_page_type = $landing_page_type;
return $this;
}
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
*
* @return string
*/
public function getLandingPageType()
{
return $this->landing_page_type;
}
/**
*
* @return string landing_page_type
*/
public function getLandingPageType() {
return $this->landing_page_type;
}
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
*
* @deprecated Instead use setLandingPageType
*
* @param string $landing_page_type
* @return $this
*/
public function setLanding_page_type($landing_page_type)
{
$this->landing_page_type = $landing_page_type;
return $this;
}
/*
* @param string landing_page_type *
*/
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
* @deprecated Instead use getLandingPageType
*
* @return string
*/
public function getLanding_page_type()
{
return $this->landing_page_type;
}
public function setLandingPageType($landing_page_type){
$this->landing_page_type = $landing_page_type;
return $this;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
*
*
* @param string $bank_txn_pending_url
* @throws InvalidArgumentException
* @return $this
*/
public function setBankTxnPendingUrl($bank_txn_pending_url)
{
UrlValidator::validate($bank_txn_pending_url, "BankTxnPendingUrl");
$this->bank_txn_pending_url = $bank_txn_pending_url;
return $this;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
*
* @return string
*/
public function getBankTxnPendingUrl()
{
return $this->bank_txn_pending_url;
}
/**
*
* @return string bank_txn_pending_url
*/
public function getBankTxnPendingUrl() {
return $this->bank_txn_pending_url;
}
/*
* @param string bank_txn_pending_url *
*/
public function setBankTxnPendingUrl($bank_txn_pending_url){
$this->bank_txn_pending_url = $bank_txn_pending_url;
return $this;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
*
* @deprecated Instead use setBankTxnPendingUrl
*
* @param string $bank_txn_pending_url
* @return $this
*/
public function setBank_txn_pending_url($bank_txn_pending_url)
{
$this->bank_txn_pending_url = $bank_txn_pending_url;
return $this;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
* @deprecated Instead use getBankTxnPendingUrl
*
* @return string
*/
public function getBank_txn_pending_url()
{
return $this->bank_txn_pending_url;
}
}

View File

@@ -1,4 +1,5 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
@@ -7,62 +8,161 @@ use PayPal\Rest\ApiContext;
/**
* Class InputFields
*
* @property integer no_shipping
* @property integer address_override
* @property boolean allow-note
* Parameters for input fields customization.
*
* @package PayPal\Api
*
* @property bool allow_note
* @property int no_shipping
* @property int address_override
*/
class InputFields extends PPModel {
class InputFields extends PPModel
{
/**
* Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
*
*
* @param bool $allow_note
*
* @return $this
*/
public function setAllowNote($allow_note)
{
$this->allow_note = $allow_note;
return $this;
}
/**
* Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
*
* @return bool
*/
public function getAllowNote()
{
return $this->allow_note;
}
/**
*
* @return integer no_shipping
*/
public function getNoShipping() {
return $this->no_shipping;
}
/**
* Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
*
* @deprecated Instead use setAllowNote
*
* @param bool $allow_note
* @return $this
*/
public function setAllow_note($allow_note)
{
$this->allow_note = $allow_note;
return $this;
}
/*
* @param integer no_shipping *
*/
/**
* Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
* @deprecated Instead use getAllowNote
*
* @return bool
*/
public function getAllow_note()
{
return $this->allow_note;
}
public function setNoShipping($no_shipping){
$this->no_shipping = $no_shipping;
return $this;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
*
*
* @param int $no_shipping
*
* @return $this
*/
public function setNoShipping($no_shipping)
{
$this->no_shipping = $no_shipping;
return $this;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
*
* @return int
*/
public function getNoShipping()
{
return $this->no_shipping;
}
/**
*
* @return integer address_override
*/
public function getAddressOverride() {
return $this->address_override;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
*
* @deprecated Instead use setNoShipping
*
* @param int $no_shipping
* @return $this
*/
public function setNo_shipping($no_shipping)
{
$this->no_shipping = $no_shipping;
return $this;
}
/*
* @param integer address_override *
*/
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
* @deprecated Instead use getNoShipping
*
* @return int
*/
public function getNo_shipping()
{
return $this->no_shipping;
}
public function setAddressOverride($address_override){
$this->address_override = $address_override;
return $this;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
*
*
* @param int $address_override
*
* @return $this
*/
public function setAddressOverride($address_override)
{
$this->address_override = $address_override;
return $this;
}
/**
*
* @return boolean allow_note
*/
public function getAllowNote() {
return $this->allow_note;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
*
* @return int
*/
public function getAddressOverride()
{
return $this->address_override;
}
/*
* @param boolean allow_note *
*/
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
*
* @deprecated Instead use setAddressOverride
*
* @param int $address_override
* @return $this
*/
public function setAddress_override($address_override)
{
$this->address_override = $address_override;
return $this;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
* @deprecated Instead use getAddressOverride
*
* @return int
*/
public function getAddress_override()
{
return $this->address_override;
}
public function setAllowNote($allow_note){
$this->allow_note = $allow_note;
return $this;
}
}

118
lib/PayPal/Api/Patch.php Normal file
View File

@@ -0,0 +1,118 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class Patch
*
* A JSON patch object used for applying partial updates to resources.
*
* @package PayPal\Api
*
* @property string op
* @property string path
* @property \PayPal\Api\object value
* @property string from
*/
class Patch extends PPModel
{
/**
* The operation to perform.
* Valid Values: ["add", "remove", "replace", "move", "copy", "test"]
*
* @param string $op
*
* @return $this
*/
public function setOp($op)
{
$this->op = $op;
return $this;
}
/**
* The operation to perform.
*
* @return string
*/
public function getOp()
{
return $this->op;
}
/**
* String containing a JSON-Pointer value that references a location within the target document where the operation is performed.
*
*
* @param string $path
*
* @return $this
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* String containing a JSON-Pointer value that references a location within the target document where the operation is performed.
*
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* New value to apply based on the operation. op=remove does not require value.
*
*
* @param \PayPal\Api\object $value
*
* @return $this
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* New value to apply based on the operation. op=remove does not require value.
*
* @return \PayPal\Api\object
*/
public function getValue()
{
return $this->value;
}
/**
* A string containing a JSON Pointer value that references the location in the target document from which to move the value. Required for use where op=move.
*
*
* @param string $from
*
* @return $this
*/
public function setFrom($from)
{
$this->from = $from;
return $this;
}
/**
* A string containing a JSON Pointer value that references the location in the target document from which to move the value. Required for use where op=move.
*
* @return string
*/
public function getFrom()
{
return $this->from;
}
}

View File

@@ -374,7 +374,6 @@ class Payment extends PPModel implements IResource
public function setExperienceProfileId($experience_profile_id)
{
$this->experience_profile_id = $experience_profile_id;
return $this;
}

View File

@@ -1,4 +1,5 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
@@ -7,62 +8,161 @@ use PayPal\Rest\ApiContext;
/**
* Class Presentation
*
* Parameters for style and presentation.
*
* @package PayPal\Api
*
* @property string brand_name
* @property string logo_image
* @property string locale_code
*/
class Presentation extends PPModel {
class Presentation extends PPModel
{
/**
* A label that overrides the business name in the PayPal account on the PayPal pages.
*
*
* @param string $brand_name
*
* @return $this
*/
public function setBrandName($brand_name)
{
$this->brand_name = $brand_name;
return $this;
}
/**
* A label that overrides the business name in the PayPal account on the PayPal pages.
*
* @return string
*/
public function getBrandName()
{
return $this->brand_name;
}
/**
*
* @return string brand_name
*/
public function getBrandName() {
return $this->brand_name;
}
/**
* A label that overrides the business name in the PayPal account on the PayPal pages.
*
* @deprecated Instead use setBrandName
*
* @param string $brand_name
* @return $this
*/
public function setBrand_name($brand_name)
{
$this->brand_name = $brand_name;
return $this;
}
/*
* @param string brand_name *
*/
/**
* A label that overrides the business name in the PayPal account on the PayPal pages.
* @deprecated Instead use getBrandName
*
* @return string
*/
public function getBrand_name()
{
return $this->brand_name;
}
public function setBrandName($brand_name){
$this->brand_name = $brand_name;
return $this;
}
/**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`.
*
*
* @param string $logo_image
*
* @return $this
*/
public function setLogoImage($logo_image)
{
$this->logo_image = $logo_image;
return $this;
}
/**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`.
*
* @return string
*/
public function getLogoImage()
{
return $this->logo_image;
}
/**
*
* @return string logo_image
*/
public function getLogoImage() {
return $this->logo_image;
}
/**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`.
*
* @deprecated Instead use setLogoImage
*
* @param string $logo_image
* @return $this
*/
public function setLogo_image($logo_image)
{
$this->logo_image = $logo_image;
return $this;
}
/*
* @param string logo_image *
*/
/**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`.
* @deprecated Instead use getLogoImage
*
* @return string
*/
public function getLogo_image()
{
return $this->logo_image;
}
public function setLogoImage($logo_image){
$this->logo_image = $logo_image;
return $this;
}
/**
* Locale of pages displayed by PayPal payment experience.
*
*
* @param string $locale_code
*
* @return $this
*/
public function setLocaleCode($locale_code)
{
$this->locale_code = $locale_code;
return $this;
}
/**
*
* @return string locale_code
*/
public function getLocaleCode() {
return $this->logo_image;
}
/**
* Locale of pages displayed by PayPal payment experience.
*
* @return string
*/
public function getLocaleCode()
{
return $this->locale_code;
}
/*
* @param string locale_code *
*/
/**
* Locale of pages displayed by PayPal payment experience.
*
* @deprecated Instead use setLocaleCode
*
* @param string $locale_code
* @return $this
*/
public function setLocale_code($locale_code)
{
$this->locale_code = $locale_code;
return $this;
}
/**
* Locale of pages displayed by PayPal payment experience.
* @deprecated Instead use getLocaleCode
*
* @return string
*/
public function getLocale_code()
{
return $this->locale_code;
}
public function setLocaleCode($locale_code){
$this->locale_code = $locale_code;
return $this;
}
}

View File

@@ -5,33 +5,47 @@ namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
use PayPal\Rest\IResource;
use PayPal\Api\CreateProfileResponse;
use PayPal\Transport\PPRestCall;
use PayPal\Validation\ArgumentValidator;
/**
* Class WebProfile
*
* @property string id
* @property string name
* @property InputFields input_fields
* @property FlowConfig flow_config
* @property Presentation presentation
* Payment Web experience profile resource
*
* @package PayPal\Api
*
* @property string id
* @property string name
* @property \PayPal\Api\FlowConfig flow_config
* @property \PayPal\Api\InputFields input_fields
* @property \PayPal\Api\Presentation presentation
*/
class WebProfile extends PPModel implements IResource
{
/**
* @var
* OAuth Credentials to use for this call
*
* @var \PayPal\Auth\OAuthTokenCredential $credential
*/
private static $credential;
protected static $credential;
/**
* Sets Credential
*
* @deprecated Pass ApiContext to create/get methods instead
* @param \PayPal\Auth\OAuthTokenCredential $credential
*/
public static function setCredential($credential)
{
self::$credential = $credential;
}
function __construct() {
$this->input_fields = new InputFields();
}
//private $input_fields = array();
/**
* Set ID
* ID of the web experience profile.
*
*
* @param string $id
*
* @return $this
@@ -39,12 +53,10 @@ class WebProfile extends PPModel implements IResource
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Get ID
* ID of the web experience profile.
*
* @return string
@@ -55,9 +67,9 @@ class WebProfile extends PPModel implements IResource
}
/**
* Set ID
* Name of the web experience profile.
*
*
* @param string $name
*
* @return $this
@@ -65,12 +77,10 @@ class WebProfile extends PPModel implements IResource
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
* Name of the web experience profile.
*
* @return string
@@ -80,144 +90,243 @@ class WebProfile extends PPModel implements IResource
return $this->name;
}
/**
* Parameters for flow configuration.
*
* @param InputFields $input_fields
*/
public function setInputFields($input_fields) {
$this->input_fields = $input_fields;
return $this;
}
/**
*
* @return InputFields
*/
public function getInputFields() {
return $this->input_fields;
}
/**
* @param \PayPal\Api\FlowConfig $flow_config
*
* @param FlowConfig $flow_config
* @return $this
*/
public function setFlowConfig($flow_config) {
public function setFlowConfig($flow_config)
{
$this->flow_config = $flow_config;
return $this;
}
/**
* Parameters for flow configuration.
*
* @return FlowConfig
* @return \PayPal\Api\FlowConfig
*/
public function getFlowConfig() {
public function getFlowConfig()
{
return $this->flow_config;
}
/**
* Parameters for flow configuration.
*
* @deprecated Instead use setFlowConfig
*
* @param \PayPal\Api\FlowConfig $flow_config
* @return $this
*/
public function setFlow_config($flow_config)
{
$this->flow_config = $flow_config;
return $this;
}
/**
* Parameters for flow configuration.
* @deprecated Instead use getFlowConfig
*
* @param Presentation $presentation
* @return \PayPal\Api\FlowConfig
*/
public function setPresentation($presentation) {
public function getFlow_config()
{
return $this->flow_config;
}
/**
* Parameters for input fields customization.
*
*
* @param \PayPal\Api\InputFields $input_fields
*
* @return $this
*/
public function setInputFields($input_fields)
{
$this->input_fields = $input_fields;
return $this;
}
/**
* Parameters for input fields customization.
*
* @return \PayPal\Api\InputFields
*/
public function getInputFields()
{
return $this->input_fields;
}
/**
* Parameters for input fields customization.
*
* @deprecated Instead use setInputFields
*
* @param \PayPal\Api\InputFields $input_fields
* @return $this
*/
public function setInput_fields($input_fields)
{
$this->input_fields = $input_fields;
return $this;
}
/**
* Parameters for input fields customization.
* @deprecated Instead use getInputFields
*
* @return \PayPal\Api\InputFields
*/
public function getInput_fields()
{
return $this->input_fields;
}
/**
* Parameters for style and presentation.
*
*
* @param \PayPal\Api\Presentation $presentation
*
* @return $this
*/
public function setPresentation($presentation)
{
$this->presentation = $presentation;
return $this;
}
/**
* Parameters for style and presentation.
*
* @return Presentation
* @return \PayPal\Api\Presentation
*/
public function getPresentation() {
public function getPresentation()
{
return $this->presentation;
}
/**
* Create
* Create a web experience profile by passing the name of the profile and other profile details in the request JSON to the request URI.
*
* @param \PayPal\Rest\ApiContext|null $apiContext
*
* @return $this
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return CreateProfileResponse
*/
public function create($apiContext = null)
{
$payLoad = $this->toJSON();
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles", "POST", $payLoad);
$this->fromJson($json);
return $this;
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/", "POST", $payLoad);
$ret = new CreateProfileResponse();
$ret->fromJson($json);
return $ret;
}
/**
* Update a web experience profile by passing the ID of the profile to the request URI. In addition, pass the profile details in the request JSON. If your request does not include values for all profile detail fields, the previously set values for the omitted fields are removed by this operation.
*
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return bool
*/
public function update($apiContext = null)
{
ArgumentValidator::validate($this->getId(), "Id");
$payLoad = $this->toJSON();
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/".$this->getId(), "PUT", $payLoad);
return true;
}
/*
* Delete WebProfile resource for the given identifier.
*
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return void
*/
public function delete($apiContext = null) {
if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null");
}
$payLoad = "";
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "DELETE", $payLoad);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "PUT", $payLoad);
return true;
}
/**
* Get all webProfiles of a merchant.
* Partially update an existing web experience profile by passing the ID of the profile to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, path of the profile location to update, and a new value if needed to complete the operation.
*
* @param \PayPal\Rest\ApiContext|null $apiContext
*
* @return WebProfiles
* @param Patch[] $patch
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return bool
*/
public static function get_all($apiContext = null)
public function partial_update($patch, $apiContext = null)
{
$payLoad = "";
ArgumentValidator::validate($this->getId(), "Id");
ArgumentValidator::validate($patch, 'patch');
foreach ($patch as $patchObject) {
$payload[] = $patchObject->toArray();
}
$payLoad = json_encode($payload);
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles", "GET", $payLoad);
$json = '{"web_profiles":'.$json.'}';
$ret = new WebProfiles();
$ret->fromJson($json);
return $ret;
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "PATCH", $payLoad);
return true;
}
/**
* Retrieve the details of a particular web experience profile by passing the ID of the profile to the request URI.
*
* @param string $profileId
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return WebProfile
*/
public static function get($profileId, $apiContext = null)
{
ArgumentValidator::validate($profileId, 'profileId');
$payLoad = "";
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/$profileId", "GET", $payLoad);
$ret = new WebProfile();
$ret->fromJson($json);
return $ret;
}
/**
* Lists all web experience profiles that exist for a merchant (or subject).
*
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return WebProfile[]
*/
public static function get_list($apiContext = null)
{
$payLoad = "";
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/", "GET", $payLoad);
return WebProfile::getList($json);
}
/**
* Delete an existing web experience profile by passing the profile ID to the request URI.
*
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return bool
*/
public function delete($apiContext = null)
{
ArgumentValidator::validate($this->getId(), "Id");
$payLoad = "";
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "DELETE", $payLoad);
return true;
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class WebProfiles
*
* @property array|\PayPal\Api\WebProfile $web_profiles
*/
class WebProfiles extends PPModel {
/**
* List of WebProfiles belonging to a merchant.
*
* @param array|\PayPal\Api\WebProfile $web_profiles
*/
public function setWebProfiles($web_profiles) {
$this->web_profiles = $web_profiles;
return $this;
}
/**
* List of web profiles belonging to a merchant.
*
* @return \PayPal\Api\WebProfile
*/
public function getWebProfiles() {
return $this->web_profiles;
}
}

View File

@@ -1,6 +1,7 @@
<?php
namespace PayPal\Common;
use PayPal\Validation\JsonValidator;
use PayPal\Validation\ModelAccessorValidator;
/**
@@ -28,9 +29,7 @@ class PPModel
case "NULL":
break;
case "string":
if (!$this->isJson($data)) {
throw new \InvalidArgumentException("data should be either json or array representation of object");
}
JsonValidator::validate($data);
$this->fromJson($data);
break;
case "array":
@@ -41,15 +40,28 @@ class PPModel
}
/**
* Tests if the string provided is json representation or not.
* Returns a list of Object from Array or Json String. It is generally used when you json
* contains an array of this object
*
* @param $string
* @return bool
* @param mixed $data Array object or json string representation
* @return array
*/
private function isJson($string)
public static function getList($data)
{
json_decode($string);
return (json_last_error() == JSON_ERROR_NONE);
if (!is_array($data) && JsonValidator::validate($data)) {
//Convert to Array if Json Data Sent
$data = json_decode($data, true);
}
if (!PPArrayUtil::isAssocArray($data)) {
$list = array();
//This means, root element is array
foreach ($data as $k => $v) {
$obj = new static;
$obj->fromArray($v);
$list[] = $obj;
}
return $list;
}
}
/**
@@ -139,16 +151,14 @@ class PPModel
*/
public function fromArray($arr)
{
foreach ($arr as $k => $v) {
if (is_array($v)) {
$clazz = PPReflectionUtil::getPropertyClass(get_class($this), $k);
if (PPArrayUtil::isAssocArray($v)) {
/** @var self $o */
$o = new $clazz();
$o->fromArray($v);
$this->__set($k, $o);
$this->setValue($k, $o);
} else {
$arr = array();
foreach ($v as $nk => $nv) {
@@ -160,15 +170,25 @@ class PPModel
$arr[$nk] = $nv;
}
}
$this->__set($k, $arr);
$this->setValue($k, $arr);
}
} else {
$this->$k = $v;
$this->$k = $v;
}
}
return $this;
}
private function setValue($key, $value)
{
if (ModelAccessorValidator::validate($this, $this->convertToCamelCase($key))) {
$setter = "set" . $this->convertToCamelCase($key);
$this->$setter($value);
} else {
$this->__set($key, $value);
}
}
/**
* Fills object value from Json string
*

View File

@@ -151,7 +151,8 @@ class PPCredentialManager
}
if (empty($credObj)) {
throw new PPInvalidCredentialException("Invalid userId $userId");
throw new PPInvalidCredentialException("Credential not found for " . ($userId ? $userId : " default user") .
". Please make sure your configuration/APIContext has credential information");
}
return $credObj;
}

View File

@@ -88,7 +88,6 @@ class PPHttpConnection
curl_setopt($ch, CURLOPT_URL, $this->httpConfig->getUrl());
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getHttpHeaders());
//Determine Curl Options based on Method
switch ($this->httpConfig->getMethod()) {
case 'POST':
@@ -101,6 +100,7 @@ class PPHttpConnection
//Default Option if Method not of given types in switch case
if ($this->httpConfig->getMethod() != NULL) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpConfig->getMethod());
$this->logger->info("Method : " . $this->httpConfig->getMethod());
}
//Logging Each Headers for debugging purposes
@@ -142,10 +142,8 @@ class PPHttpConnection
curl_close($ch);
throw $ex;
}
//Close the curl request
curl_close($ch);
//More Exceptions based on HttpStatus Code
if (in_array($httpStatus, self::$retryCodes)) {
$ex = new PPConnectionException(
@@ -158,7 +156,8 @@ class PPHttpConnection
} else if ($httpStatus < 200 || $httpStatus >= 300) {
$ex = new PPConnectionException(
$this->httpConfig->getUrl(),
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}."
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}.",
$httpStatus
);
$ex->setData($result);
throw $ex;

View File

@@ -0,0 +1,28 @@
<?php
namespace PayPal\Validation;
/**
* Class JsonValidator
*
* @package PayPal\Validation
*/
class JsonValidator
{
/**
* Helper method for validating if string provided is a valid json.
*
* @param string $string String representation of Json object
* @return bool
*/
public static function validate($string)
{
json_decode($string);
if (json_last_error() != JSON_ERROR_NONE) {
//Throw an Exception for string or array
throw new \InvalidArgumentException("Invalid JSON String");
}
return true;
}
}

View File

@@ -1,6 +1,10 @@
PayPal PHP SDK release notes
============================
v0.13.0
----
* Enabled Payment Experience
v0.12.0
----
* Enabled EC Parameters Support for Payment APIs

View File

@@ -27,7 +27,7 @@ error_reporting(E_ALL);
/** @var \Paypal\Rest\ApiContext $apiContext */
$apiContext = getApiContext();
return $apiContext;
/**
* Helper method for getting an APIContext for all calls
*

View File

@@ -13,26 +13,48 @@ use PayPal\Api\Transaction;
use PayPal\Api\FundingInstrument;
function print_result($title, $objectName, $objectId = null, $output = null)
{
echo "<h3>$title</h3>";
if ($objectId) {
echo "<div> Created " . ($objectName ? $objectName : "Object") . " with ID: $objectId</div>";
}
if ($output) {
if (is_a($output, 'PayPal\Common\PPModel')) {
/** @var $output \PayPal\Common\PPModel */
echo "<pre>" . $output->toJSON(JSON_PRETTY_PRINT) . "</pre>";
} elseif (is_string($output)) {
echo "<pre>$output</pre>";
}
}
echo "<hr />";
}
/**
* ### getBaseUrl function
* // utility function that returns base url for
* // determining return/cancel urls
*
* @return string
*/
function getBaseUrl() {
function getBaseUrl()
{
$protocol = 'http';
if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) {
$protocol .= 's';
$protocol_port = $_SERVER['SERVER_PORT'];
} else {
$protocol_port = 80;
}
$protocol = 'http';
if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) {
$protocol .= 's';
$protocol_port = $_SERVER['SERVER_PORT'];
} else {
$protocol_port = 80;
}
$host = $_SERVER['HTTP_HOST'];
$port = $_SERVER['SERVER_PORT'];
$request = $_SERVER['PHP_SELF'];
return dirname($protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request);
$host = $_SERVER['HTTP_HOST'];
$port = $_SERVER['SERVER_PORT'];
$request = $_SERVER['PHP_SELF'];
return dirname($protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request);
}
/**
@@ -41,51 +63,52 @@ function getBaseUrl() {
* @param PayPal\Api\ApiContext apiContext
* @return PayPal\Api\Authorization
*/
function createAuthorization($apiContext) {
$addr = new Address();
$addr->setLine1("3909 Witmer Road")
->setLine2("Niagara Falls")
->setCity("Niagara Falls")
->setState("NY")
->setPostalCode("14305")
->setCountryCode("US")
->setPhone("716-298-1822");
function createAuthorization($apiContext)
{
$addr = new Address();
$addr->setLine1("3909 Witmer Road")
->setLine2("Niagara Falls")
->setCity("Niagara Falls")
->setState("NY")
->setPostalCode("14305")
->setCountryCode("US")
->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa")
->setNumber("4417119669820331")
->setExpireMonth("11")
->setExpireYear("2019")
->setCvv2("012")
->setFirstName("Joe")
->setLastName("Shopper")
->setBillingAddress($addr);
$card = new CreditCard();
$card->setType("visa")
->setNumber("4417119669820331")
->setExpireMonth("11")
->setExpireYear("2019")
->setCvv2("012")
->setFirstName("Joe")
->setLastName("Shopper")
->setBillingAddress($addr);
$fi = new FundingInstrument();
$fi->setCreditCard($card);
$fi = new FundingInstrument();
$fi->setCreditCard($card);
$payer = new Payer();
$payer->setPaymentMethod("credit_card")
->setFundingInstruments(array($fi));
$payer = new Payer();
$payer->setPaymentMethod("credit_card")
->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD")
->setTotal("1.00");
$amount = new Amount();
$amount->setCurrency("USD")
->setTotal("1.00");
$transaction = new Transaction();
$transaction->setAmount($amount)
->setDescription("Payment description.");
$transaction = new Transaction();
$transaction->setAmount($amount)
->setDescription("Payment description.");
$payment = new Payment();
$payment = new Payment();
// Setting intent to authorize creates a payment
// authorization. Setting it to sale creates actual payment
$payment->setIntent("authorize")
->setPayer($payer)
->setTransactions(array($transaction));
// Setting intent to authorize creates a payment
// authorization. Setting it to sale creates actual payment
$payment->setIntent("authorize")
->setPayer($payer)
->setTransactions(array($transaction));
$paymnt = $payment->create($apiContext);
$resArray = $paymnt->toArray();
$paymnt = $payment->create($apiContext);
$resArray = $paymnt->toArray();
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
}

View File

@@ -25,7 +25,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/CancelInvoice.php",
"projectPath": "sample/invoice/CancelInvoice.php",
"projectPath": "invoice/CancelInvoice.php",
"targetPath": "invoice/CancelInvoice",
"pageTitle": "invoice/CancelInvoice",
"title": "CancelInvoice"
@@ -81,7 +81,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/CreateInvoice.php",
"projectPath": "sample/invoice/CreateInvoice.php",
"projectPath": "invoice/CreateInvoice.php",
"targetPath": "invoice/CreateInvoice",
"pageTitle": "invoice/CreateInvoice",
"title": "CreateInvoice"
@@ -169,7 +169,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/GetInvoice.php",
"projectPath": "sample/invoice/GetInvoice.php",
"projectPath": "invoice/GetInvoice.php",
"targetPath": "invoice/GetInvoice",
"pageTitle": "invoice/GetInvoice",
"title": "GetInvoice"
@@ -209,7 +209,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/ListInvoice.php",
"projectPath": "sample/invoice/ListInvoice.php",
"projectPath": "invoice/ListInvoice.php",
"targetPath": "invoice/ListInvoice",
"pageTitle": "invoice/ListInvoice",
"title": "ListInvoice"
@@ -249,7 +249,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/RemindInvoice.php",
"projectPath": "sample/invoice/RemindInvoice.php",
"projectPath": "invoice/RemindInvoice.php",
"targetPath": "invoice/RemindInvoice",
"pageTitle": "invoice/RemindInvoice",
"title": "RemindInvoice"
@@ -305,7 +305,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/SendInvoice.php",
"projectPath": "sample/invoice/SendInvoice.php",
"projectPath": "invoice/SendInvoice.php",
"targetPath": "invoice/SendInvoice",
"pageTitle": "invoice/SendInvoice",
"title": "SendInvoice"
@@ -343,6 +343,209 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
]
}
]
}, {
"type": "folder",
"data": {
"path": "payment-experience",
"title": "payment-experience"
},
"depth": 1,
"children": [
{
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/CreateWebProfile.php",
"projectPath": "payment-experience/CreateWebProfile.php",
"targetPath": "payment-experience/CreateWebProfile",
"pageTitle": "payment-experience/CreateWebProfile",
"title": "CreateWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Create Web Profile",
"slug": "create-web-profile"
},
"depth": 3,
"children": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Payment Web experience profile resource",
"slug": "payment-web-experience-profile-resource"
},
"depth": 4
}
]
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/DeleteWebProfile.php",
"projectPath": "payment-experience/DeleteWebProfile.php",
"targetPath": "payment-experience/DeleteWebProfile",
"pageTitle": "payment-experience/DeleteWebProfile",
"title": "DeleteWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Delete Web Profile",
"slug": "delete-web-profile"
},
"depth": 4
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/GetWebProfile.php",
"projectPath": "payment-experience/GetWebProfile.php",
"targetPath": "payment-experience/GetWebProfile",
"pageTitle": "payment-experience/GetWebProfile",
"title": "GetWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Get Web Profile",
"slug": "get-web-profile"
},
"depth": 3
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/ListWebProfiles.php",
"projectPath": "payment-experience/ListWebProfiles.php",
"targetPath": "payment-experience/ListWebProfiles",
"pageTitle": "payment-experience/ListWebProfiles",
"title": "ListWebProfiles"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Retrieve List of All Web Profiles",
"slug": "retrieve-list-of-all-web-profiles"
},
"depth": 3
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/PartiallyUpdateWebProfile.php",
"projectPath": "payment-experience/PartiallyUpdateWebProfile.php",
"targetPath": "payment-experience/PartiallyUpdateWebProfile",
"pageTitle": "payment-experience/PartiallyUpdateWebProfile",
"title": "PartiallyUpdateWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Partially Update Web Profile",
"slug": "partially-update-web-profile"
},
"depth": 4
}, {
"type": "heading",
"data": {
"level": 3,
"title": "Create Patch Operation",
"slug": "create-patch-operation"
},
"depth": 3
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/UpdateWebProfile.php",
"projectPath": "payment-experience/UpdateWebProfile.php",
"targetPath": "payment-experience/UpdateWebProfile",
"pageTitle": "payment-experience/UpdateWebProfile",
"title": "UpdateWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Update Web Profile",
"slug": "update-web-profile"
},
"depth": 4
}
]
}
]
}, {
"type": "folder",
"data": {
@@ -363,7 +566,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/AuthorizationCapture.php",
"projectPath": "sample/payments/AuthorizationCapture.php",
"projectPath": "payments/AuthorizationCapture.php",
"targetPath": "payments/AuthorizationCapture",
"pageTitle": "payments/AuthorizationCapture",
"title": "AuthorizationCapture"
@@ -403,7 +606,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreateFuturePayment.php",
"projectPath": "sample/payments/CreateFuturePayment.php",
"projectPath": "payments/CreateFuturePayment.php",
"targetPath": "payments/CreateFuturePayment",
"pageTitle": "payments/CreateFuturePayment",
"title": "CreateFuturePayment"
@@ -491,7 +694,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePayment.php",
"projectPath": "sample/payments/CreatePayment.php",
"projectPath": "payments/CreatePayment.php",
"targetPath": "payments/CreatePayment",
"pageTitle": "payments/CreatePayment",
"title": "CreatePayment"
@@ -595,7 +798,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePaymentUsingPayPal.php",
"projectPath": "sample/payments/CreatePaymentUsingPayPal.php",
"projectPath": "payments/CreatePaymentUsingPayPal.php",
"targetPath": "payments/CreatePaymentUsingPayPal",
"pageTitle": "payments/CreatePaymentUsingPayPal",
"title": "CreatePaymentUsingPayPal"
@@ -707,7 +910,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePaymentUsingSavedCard.php",
"projectPath": "sample/payments/CreatePaymentUsingSavedCard.php",
"projectPath": "payments/CreatePaymentUsingSavedCard.php",
"targetPath": "payments/CreatePaymentUsingSavedCard",
"pageTitle": "payments/CreatePaymentUsingSavedCard",
"title": "CreatePaymentUsingSavedCard"
@@ -811,7 +1014,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/ExecutePayment.php",
"projectPath": "sample/payments/ExecutePayment.php",
"projectPath": "payments/ExecutePayment.php",
"targetPath": "payments/ExecutePayment",
"pageTitle": "payments/ExecutePayment",
"title": "ExecutePayment"
@@ -840,7 +1043,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetAuthorization.php",
"projectPath": "sample/payments/GetAuthorization.php",
"projectPath": "payments/GetAuthorization.php",
"targetPath": "payments/GetAuthorization",
"pageTitle": "payments/GetAuthorization",
"title": "GetAuthorization"
@@ -880,7 +1083,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetCapture.php",
"projectPath": "sample/payments/GetCapture.php",
"projectPath": "payments/GetCapture.php",
"targetPath": "payments/GetCapture",
"pageTitle": "payments/GetCapture",
"title": "GetCapture"
@@ -928,7 +1131,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetPayment.php",
"projectPath": "sample/payments/GetPayment.php",
"projectPath": "payments/GetPayment.php",
"targetPath": "payments/GetPayment",
"pageTitle": "payments/GetPayment",
"title": "GetPayment"
@@ -968,7 +1171,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/ListPayments.php",
"projectPath": "sample/payments/ListPayments.php",
"projectPath": "payments/ListPayments.php",
"targetPath": "payments/ListPayments",
"pageTitle": "payments/ListPayments",
"title": "ListPayments"
@@ -1008,7 +1211,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/Reauthorization.php",
"projectPath": "sample/payments/Reauthorization.php",
"projectPath": "payments/Reauthorization.php",
"targetPath": "payments/Reauthorization",
"pageTitle": "payments/Reauthorization",
"title": "Reauthorization"
@@ -1064,7 +1267,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/RefundCapture.php",
"projectPath": "sample/payments/RefundCapture.php",
"projectPath": "payments/RefundCapture.php",
"targetPath": "payments/RefundCapture",
"pageTitle": "payments/RefundCapture",
"title": "RefundCapture"
@@ -1112,7 +1315,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/VoidAuthorization.php",
"projectPath": "sample/payments/VoidAuthorization.php",
"projectPath": "payments/VoidAuthorization.php",
"targetPath": "payments/VoidAuthorization",
"pageTitle": "payments/VoidAuthorization",
"title": "VoidAuthorization"
@@ -1162,7 +1365,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/sale/GetSale.php",
"projectPath": "sample/sale/GetSale.php",
"projectPath": "sale/GetSale.php",
"targetPath": "sale/GetSale",
"pageTitle": "sale/GetSale",
"title": "GetSale"
@@ -1202,7 +1405,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/sale/RefundSale.php",
"projectPath": "sample/sale/RefundSale.php",
"projectPath": "sale/RefundSale.php",
"targetPath": "sale/RefundSale",
"pageTitle": "sale/RefundSale",
"title": "RefundSale"
@@ -1268,7 +1471,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/CreateCreditCard.php",
"projectPath": "sample/vault/CreateCreditCard.php",
"projectPath": "vault/CreateCreditCard.php",
"targetPath": "vault/CreateCreditCard",
"pageTitle": "vault/CreateCreditCard",
"title": "CreateCreditCard"
@@ -1316,7 +1519,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/DeleteCreditCard.php",
"projectPath": "sample/vault/DeleteCreditCard.php",
"projectPath": "vault/DeleteCreditCard.php",
"targetPath": "vault/DeleteCreditCard",
"pageTitle": "vault/DeleteCreditCard",
"title": "DeleteCreditCard"
@@ -1372,7 +1575,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/GetCreditCard.php",
"projectPath": "sample/vault/GetCreditCard.php",
"projectPath": "vault/GetCreditCard.php",
"targetPath": "vault/GetCreditCard",
"pageTitle": "vault/GetCreditCard",
"title": "GetCreditCard"

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/CancelInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CancelInvoice"><meta name="groc-project-path" content="sample/invoice/CancelInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/CancelInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="cancel-invoice-sample">Cancel Invoice Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>invoice/CancelInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CancelInvoice"><meta name="groc-project-path" content="invoice/CancelInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/CancelInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="cancel-invoice-sample">Cancel Invoice Sample</h1>
<p>This sample code demonstrate how you can cancel
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/CreateInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CreateInvoice"><meta name="groc-project-path" content="sample/invoice/CreateInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/CreateInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>invoice/CreateInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CreateInvoice"><meta name="groc-project-path" content="invoice/CreateInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/CreateInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1>
<p>This sample code demonstrate how you can create
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/GetInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/GetInvoice"><meta name="groc-project-path" content="sample/invoice/GetInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/GetInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-invoice-sample">Get Invoice Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>invoice/GetInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/GetInvoice"><meta name="groc-project-path" content="invoice/GetInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/GetInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-invoice-sample">Get Invoice Sample</h1>
<p>This sample code demonstrate how you can retrieve
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/ListInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/ListInvoice"><meta name="groc-project-path" content="sample/invoice/ListInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/ListInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="list-invoices-sample">List Invoices Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>invoice/ListInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/ListInvoice"><meta name="groc-project-path" content="invoice/ListInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/ListInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="list-invoices-sample">List Invoices Sample</h1>
<p>This sample code demonstrate how you can get
all invoice from history.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/RemindInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/RemindInvoice"><meta name="groc-project-path" content="sample/invoice/RemindInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/RemindInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="remind-invoice-sample">Remind Invoice Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>invoice/RemindInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/RemindInvoice"><meta name="groc-project-path" content="invoice/RemindInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/RemindInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="remind-invoice-sample">Remind Invoice Sample</h1>
<p>This sample code demonstrate how you can remind
an invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/SendInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/SendInvoice"><meta name="groc-project-path" content="sample/invoice/SendInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/SendInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>invoice/SendInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/SendInvoice"><meta name="groc-project-path" content="invoice/SendInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/SendInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1>
<p>This sample code demonstrate how you can send
a legitimate invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/DeleteWebProfile</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/DeleteWebProfile"><meta name="groc-project-path" content="payment-experience/DeleteWebProfile.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/DeleteWebProfile.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h4 id="delete-web-profile">Delete Web Profile</h4>
<p>Use this call to delete a web experience profile.
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#delete-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#delete-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>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.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\CreateProfileResponse $result */</span>
<span class="hljs-variable">$createProfileResponse</span> = <span class="hljs-keyword">require_once</span> <span class="hljs-string">'CreateWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Create a new instance of web Profile ID, and set the ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">new</span> \PayPal\Api\WebProfile();
<span class="hljs-variable">$webProfile</span>-&gt;setId(<span class="hljs-variable">$createProfileResponse</span>-&gt;getId());
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Execute the delete method</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$webProfile</span>-&gt;delete(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
print_result(<span class="hljs-string">"Deleted Web Profile"</span>, <span class="hljs-string">"Web Profile"</span>, <span class="hljs-variable">$createProfileResponse</span>-&gt;getId());</div></div></div></div></body></html>

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/GetWebProfile</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/GetWebProfile"><meta name="groc-project-path" content="payment-experience/GetWebProfile.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/GetWebProfile.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-web-profile">Get Web Profile</h3>
<p>If your request is successful, the API returns a web_profile object response that contains the profile details.
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>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.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\CreateProfileResponse $result */</span>
<span class="hljs-variable">$createProfileResponse</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateWebProfile.php'</span>;
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>If your request is successful, the API returns a web_profile object response that contains the profile details.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$webProfile</span> = \PayPal\Api\WebProfile::get(<span class="hljs-variable">$createProfileResponse</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
print_result(<span class="hljs-string">"Get Web Profile"</span>, <span class="hljs-string">"Web Profile"</span>, <span class="hljs-variable">$webProfile</span>-&gt;getId(), <span class="hljs-variable">$webProfile</span>);
<span class="hljs-keyword">return</span> <span class="hljs-variable">$webProfile</span>;</div></div></div></div></body></html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/ListWebProfiles</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/ListWebProfiles"><meta name="groc-project-path" content="payment-experience/ListWebProfiles.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/ListWebProfiles.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span>
<span class="hljs-variable">$apiContext</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-list-of-all-web-profiles">Retrieve List of All Web Profiles</h3>
<p>Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#list-web-experience-profiles">https://developer.paypal.com/webapps/developer/docs/api/#list-web-experience-profiles</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieve the list of all web profiles by calling the
static <code>get_list</code> method on the WebProfile class.
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$list</span> = \PayPal\Api\WebProfile::get_list(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-variable">$result</span> = <span class="hljs-string">''</span>;
<span class="hljs-keyword">foreach</span> (<span class="hljs-variable">$list</span> <span class="hljs-keyword">as</span> <span class="hljs-variable">$object</span>) {
<span class="hljs-variable">$result</span> .= <span class="hljs-variable">$object</span>-&gt;toJSON(JSON_PRETTY_PRINT) . PHP_EOL;
}
print_result(<span class="hljs-string">"Get List of All Web Profiles"</span>, <span class="hljs-string">"Web Profiles"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$result</span>);
<span class="hljs-keyword">return</span> <span class="hljs-variable">$list</span>;</div></div></div></div></body></html>

View File

@@ -0,0 +1,29 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/PartiallyUpdateWebProfile</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/PartiallyUpdateWebProfile"><meta name="groc-project-path" content="payment-experience/PartiallyUpdateWebProfile.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/PartiallyUpdateWebProfile.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h4 id="partially-update-web-profile">Partially Update Web Profile</h4>
<p>Use this call to partially update a web experience profile.
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#partially-update-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#partially-update-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We will be re-using the sample code to get a web profile. GetWebProfile.php will
create a new web profileId for sample, and return the web profile object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebProfile $webProfile */</span>
<span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-patch-operation">Create Patch Operation</h3>
<p>APIs allows us to pass an array of patches
to make patch operations.
Each Patch operation can be created by using Patch Class
as shown below</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$patchOperation1</span> = <span class="hljs-keyword">new</span> \PayPal\Api\Patch();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>The operation to perform. Required. Allowed values: add, remove, replace, move, copy, test</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$patchOperation1</span>-&gt;setOp(<span class="hljs-string">"add"</span>)</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>string containing a JSON-Pointer value that references a location within the target document (the target location) where the operation is performed. Required.</p></div></div><div class="code"><div class="wrapper"> -&gt;setPath(<span class="hljs-string">"/presentation/brand_name"</span>)</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>New value to apply based on the operation.</p></div></div><div class="code"><div class="wrapper"> -&gt;setValue(<span class="hljs-string">"New Brand Name"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Similar patch operation to remove the landing page type</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$patchOperation2</span> = <span class="hljs-keyword">new</span> \PayPal\Api\Patch();
<span class="hljs-variable">$patchOperation2</span>-&gt;setOp(<span class="hljs-string">"remove"</span>)
-&gt;setPath(<span class="hljs-string">"/flow_config/landing_page_type"</span>);
<span class="hljs-comment">//Generate an array of patch operations</span>
<span class="hljs-variable">$patches</span> = <span class="hljs-keyword">array</span>(<span class="hljs-variable">$patchOperation1</span>, <span class="hljs-variable">$patchOperation2</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Execute the partial update, to carry out these two operations on a given web profile object</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-keyword">if</span> (<span class="hljs-variable">$webProfile</span>-&gt;partial_update(<span class="hljs-variable">$patches</span>, <span class="hljs-variable">$apiContext</span>)) {
<span class="hljs-variable">$webProfile</span> = \PayPal\Api\WebProfile::get(<span class="hljs-variable">$webProfile</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
}
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
print_result(<span class="hljs-string">"Partially Updated Web Profile"</span>, <span class="hljs-string">"Web Profile"</span>, <span class="hljs-variable">$webProfile</span>-&gt;getId(), <span class="hljs-variable">$webProfile</span>);</div></div></div></div></body></html>

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/UpdateWebProfile</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/UpdateWebProfile"><meta name="groc-project-path" content="payment-experience/UpdateWebProfile.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/UpdateWebProfile.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h4 id="update-web-profile">Update Web Profile</h4>
<p>Use this call to update an experience profile.
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#update-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#update-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We will be re-using the sample code to get a web profile. GetWebProfile.php will
create a new web profileId for sample, and return the web profile object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebProfile $webProfile */</span>
<span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Updated the logo image of presentation object in a given web profile.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$webProfile</span>-&gt;getPresentation()-&gt;setLogoImage(<span class="hljs-string">"http://www.google.com/favico.ico"</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Update the web profile to change the logo image.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-keyword">if</span> (<span class="hljs-variable">$webProfile</span>-&gt;update(<span class="hljs-variable">$apiContext</span>)) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>If the update is successfull, we can now get the object, and verify the web profile
object</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$updatedWebProfile</span> = \PayPal\Api\WebProfile::get(<span class="hljs-variable">$webProfile</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
}
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
print_result(<span class="hljs-string">"Updated Web Profile"</span>, <span class="hljs-string">"Web Profile"</span>, <span class="hljs-variable">$updatedWebProfile</span>-&gt;getId(), <span class="hljs-variable">$updatedWebProfile</span>);</div></div></div></div></body></html>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/AuthorizationCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/AuthorizationCapture"><meta name="groc-project-path" content="sample/payments/AuthorizationCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/AuthorizationCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="authorizationcapture">AuthorizationCapture</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/AuthorizationCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/AuthorizationCapture"><meta name="groc-project-path" content="payments/AuthorizationCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/AuthorizationCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="authorizationcapture">AuthorizationCapture</h1>
<p>This sample code demonstrates how you can capture
a previously authorized payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreateFuturePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreateFuturePayment"><meta name="groc-project-path" content="sample/payments/CreateFuturePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreateFuturePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/CreateFuturePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreateFuturePayment"><meta name="groc-project-path" content="payments/CreateFuturePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/CreateFuturePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
<p>This sample code demonstrates how you can process a
PayPal Account based Payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePayment"><meta name="groc-project-path" content="sample/payments/CreatePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="createpaymentsample">CreatePaymentSample</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePayment"><meta name="groc-project-path" content="payments/CreatePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/CreatePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="createpaymentsample">CreatePaymentSample</h1>
<p>This sample code demonstrate how you can process
a direct credit card payment. Please note that direct
credit card payment and related features using the

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingPayPal</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingPayPal"><meta name="groc-project-path" content="sample/payments/CreatePaymentUsingPayPal.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePaymentUsingPayPal.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingPayPal</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingPayPal"><meta name="groc-project-path" content="payments/CreatePaymentUsingPayPal.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/CreatePaymentUsingPayPal.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
<p>This sample code demonstrates how you can process a
PayPal Account based Payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingSavedCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingSavedCard"><meta name="groc-project-path" content="sample/payments/CreatePaymentUsingSavedCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePaymentUsingSavedCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-a-saved-credit-card">Create payment using a saved credit card</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingSavedCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingSavedCard"><meta name="groc-project-path" content="payments/CreatePaymentUsingSavedCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/CreatePaymentUsingSavedCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-a-saved-credit-card">Create payment using a saved credit card</h1>
<p>This sample code demonstrates how you can process a
Payment using a previously stored credit card token.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/ExecutePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ExecutePayment"><meta name="groc-project-path" content="sample/payments/ExecutePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/ExecutePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="execute-payment-sample">Execute Payment Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/ExecutePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ExecutePayment"><meta name="groc-project-path" content="payments/ExecutePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/ExecutePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="execute-payment-sample">Execute Payment Sample</h1>
<p>This sample shows how you can complete
a payment that has been approved by
the buyer by logging into paypal site.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetAuthorization"><meta name="groc-project-path" content="sample/payments/GetAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getauthorization">GetAuthorization</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/GetAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetAuthorization"><meta name="groc-project-path" content="payments/GetAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/GetAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getauthorization">GetAuthorization</h1>
<p>This sample code demonstrates how you can get details
of an authorized payment.
API used: /v1/payments/authorization/&lt;$authorizationId&gt;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetCapture"><meta name="groc-project-path" content="sample/payments/GetCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getcapture">GetCapture</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/GetCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetCapture"><meta name="groc-project-path" content="payments/GetCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/GetCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getcapture">GetCapture</h1>
<p>This sample code demonstrates how you can lookup the details
of a captured payment.
API used: /v1/payments/capture/&lt;$captureId&gt;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetPayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetPayment"><meta name="groc-project-path" content="sample/payments/GetPayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetPayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentsample">GetPaymentSample</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/GetPayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetPayment"><meta name="groc-project-path" content="payments/GetPayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/GetPayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentsample">GetPaymentSample</h1>
<p>This sample code demonstrate how you can
retrieve a list of all Payment resources
you&#39;ve created using the Payments API.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/ListPayments</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ListPayments"><meta name="groc-project-path" content="sample/payments/ListPayments.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/ListPayments.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentlist">GetPaymentList</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/ListPayments</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ListPayments"><meta name="groc-project-path" content="payments/ListPayments.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/ListPayments.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentlist">GetPaymentList</h1>
<p>This sample code demonstrate how you can
retrieve a list of all Payment resources
you&#39;ve created using the Payments API.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/Reauthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/Reauthorization"><meta name="groc-project-path" content="sample/payments/Reauthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/Reauthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="reauthorization-sample">Reauthorization Sample</h2>
<!DOCTYPE html><html lang="en"><head><title>payments/Reauthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/Reauthorization"><meta name="groc-project-path" content="payments/Reauthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/Reauthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="reauthorization-sample">Reauthorization Sample</h2>
<p>This sample code demonstrates how you can reauthorize a PayPal
account payment.
API used: v1/payments/authorization/{authorization_id}/reauthorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/RefundCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/RefundCapture"><meta name="groc-project-path" content="sample/payments/RefundCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/RefundCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="refund-capture-sample">Refund Capture Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/RefundCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/RefundCapture"><meta name="groc-project-path" content="payments/RefundCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/RefundCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="refund-capture-sample">Refund Capture Sample</h1>
<p>This sample code demonstrates how you can
process a refund on a Captured transaction.
API used: /v1/payments/capture/{<captureID>}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/VoidAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/VoidAuthorization"><meta name="groc-project-path" content="sample/payments/VoidAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/VoidAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="voidauthorization">VoidAuthorization</h1>
<!DOCTYPE html><html lang="en"><head><title>payments/VoidAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/VoidAuthorization"><meta name="groc-project-path" content="payments/VoidAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/VoidAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="voidauthorization">VoidAuthorization</h1>
<p>This sample code demonstrates how you can
void an authorized payment.
API used: /v1/payments/authorization/&lt;{authorizationid}&gt;/void&quot;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>sale/GetSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/GetSale"><meta name="groc-project-path" content="sample/sale/GetSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/sale/GetSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-sale-sample">Get Sale sample</h1>
<!DOCTYPE html><html lang="en"><head><title>sale/GetSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/GetSale"><meta name="groc-project-path" content="sale/GetSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sale/GetSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-sale-sample">Get Sale sample</h1>
<p>Sale transactions are nothing but completed payments.
This sample code demonstrates how you can retrieve
details of completed Sale Transaction.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>sale/RefundSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/RefundSale"><meta name="groc-project-path" content="sample/sale/RefundSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/sale/RefundSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="sale-refund-sample">Sale Refund Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>sale/RefundSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/RefundSale"><meta name="groc-project-path" content="sale/RefundSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sale/RefundSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="sale-refund-sample">Sale Refund Sample</h1>
<p>This sample code demonstrate how you can
process a refund on a sale transaction created
using the Payments API.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>vault/CreateCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/CreateCreditCard"><meta name="groc-project-path" content="sample/vault/CreateCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/CreateCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-credit-card-sample">Create Credit Card Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>vault/CreateCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/CreateCreditCard"><meta name="groc-project-path" content="vault/CreateCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">vault/CreateCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-credit-card-sample">Create Credit Card Sample</h1>
<p>You can store credit card details securely
with PayPal. You can then use the returned
Credit card id to process future payments.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>vault/DeleteCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/DeleteCreditCard"><meta name="groc-project-path" content="sample/vault/DeleteCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/DeleteCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="delete-creditcard-sample">Delete CreditCard Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>vault/DeleteCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/DeleteCreditCard"><meta name="groc-project-path" content="vault/DeleteCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">vault/DeleteCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="delete-creditcard-sample">Delete CreditCard Sample</h1>
<p>This sample code demonstrate how you can
delete a saved credit card.
API used: /v1/vault/credit-card/{<creditCardId>}

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>vault/GetCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/GetCreditCard"><meta name="groc-project-path" content="sample/vault/GetCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/GetCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-credit-card-sample">Get Credit Card Sample</h1>
<!DOCTYPE html><html lang="en"><head><title>vault/GetCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/GetCreditCard"><meta name="groc-project-path" content="vault/GetCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">vault/GetCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-credit-card-sample">Get Credit Card Sample</h1>
<p>The CreditCard resource allows you to
retrieve previously saved CreditCards.
API called: &#39;/v1/vault/credit-card&#39;

View File

@@ -235,6 +235,69 @@
</ul>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Payment Experience</h3>
</div>
<!-- List group -->
<ul class="list-group">
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Create a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/CreateWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/CreateWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Retrieve a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/GetWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/GetWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>List web experience profiles</h5></div>
<div class="col-md-3">
<a href="payment-experience/ListWebProfiles.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/ListWebProfiles.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Update a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/UpdateWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/UpdateWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Partially update a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/PartiallyUpdateWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/PartiallyUpdateWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Delete a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/DeleteWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/DeleteWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
</ul>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Invoice</h3>

View File

@@ -0,0 +1,60 @@
<?php
require __DIR__ . '/../bootstrap.php';
// ### Create Web Profile
// Use the /web-profiles resource to create seamless payment experience profiles. See the payment experience overview for further information about using the /payment resource to create the PayPal payment and pass the experience_profile_id.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#create-a-web-experience-profile
// Lets create an instance of FlowConfig and add
// landing page type information
$flowConfig = new \PayPal\Api\FlowConfig();
// Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: Billing or Login. When set to Billing, the Non-PayPal account landing page is used. When set to Login, the PayPal account login landing page is used.
$flowConfig->setLandingPageType("Billing");
// The URL on the merchant site for transferring to after a bank transfer payment.
$flowConfig->setBankTxnPendingUrl("http://www.yeowza.com/");
// Parameters for style and presentation.
$presentation = new \PayPal\Api\Presentation();
// A URL to logo image. Allowed vaues: .gif, .jpg, or .png.
$presentation->setLogoImage("http://www.yeowza.com/favico.ico")
// A label that overrides the business name in the PayPal account on the PayPal pages.
->setBrandName("YeowZa! Paypal")
// Locale of pages displayed by PayPal payment experience.
->setLocaleCode("US");
// Parameters for input fields customization.
$inputFields = new \PayPal\Api\InputFields();
// Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
$inputFields->setAllowNote(true)
// Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: 0, 1, or 2. When set to 0, PayPal displays the shipping address on the PayPal pages. When set to 1, PayPal does not display shipping address fields whatsoever. When set to 2, if you do not pass the shipping address, PayPal obtains it from the buyers account profile. For digital goods, this field is required, and you must set it to 1.
->setNoShipping(1)
// Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: 0 or 1. When set to 0, the PayPal pages should not display the shipping address. When set to 1, the PayPal pages should display the shipping address.
->setAddressOverride(0);
// #### Payment Web experience profile resource
$webProfile = new \PayPal\Api\WebProfile();
// Name of the web experience profile. Required. Must be unique
$webProfile->setName("YeowZa! T-Shirt Shop" . uniqid())
// Parameters for flow configuration.
->setFlowConfig($flowConfig)
// Parameters for style and presentation.
->setPresentation($presentation);
try {
// Use this call to create a profile.
$createProfileResponse = $webProfile->create($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("Created Web Profile", "Web Profile", $createProfileResponse->getId(), $createProfileResponse);
return $createProfileResponse;

View File

@@ -0,0 +1,30 @@
<?php
// #### Delete Web Profile
// Use this call to delete a web experience profile.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#delete-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_once 'CreateWebProfile.php';
// Create a new instance of web Profile ID, and set the ID.
$webProfile = new \PayPal\Api\WebProfile();
$webProfile->setId($createProfileResponse->getId());
try {
// Execute the delete method
$webProfile->delete($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("Deleted Web Profile", "Web Profile", $createProfileResponse->getId());

View 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;

View File

@@ -0,0 +1,28 @@
<?php
$apiContext = require __DIR__ . '/../bootstrap.php';
// ### Retrieve List of All Web Profiles
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#list-web-experience-profiles
// Retrieve the list of all web profiles by calling the
// static `get_list` method on the WebProfile class.
// (See bootstrap.php for more on `ApiContext`)
try {
$list = \PayPal\Api\WebProfile::get_list($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);
}
$result = '';
foreach ($list as $object) {
$result .= $object->toJSON(JSON_PRETTY_PRINT) . PHP_EOL;
}
print_result("Get List of All Web Profiles", "Web Profiles", null, $result);
return $list;

View File

@@ -0,0 +1,48 @@
<?php
// #### Partially Update Web Profile
// Use this call to partially update a web experience profile.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#partially-update-a-web-experience-profile
// We will be re-using the sample code to get a web profile. GetWebProfile.php will
// create a new web profileId for sample, and return the web profile object.
/** @var \PayPal\Api\WebProfile $webProfile */
$webProfile = require 'GetWebProfile.php';
// ### Create Patch Operation
// APIs allows us to pass an array of patches
// to make patch operations.
// Each Patch operation can be created by using Patch Class
// as shown below
$patchOperation1 = new \PayPal\Api\Patch();
// The operation to perform. Required. Allowed values: add, remove, replace, move, copy, test
$patchOperation1->setOp("add")
// string containing a JSON-Pointer value that references a location within the target document (the target location) where the operation is performed. Required.
->setPath("/presentation/brand_name")
// New value to apply based on the operation.
->setValue("New Brand Name");
// Similar patch operation to remove the landing page type
$patchOperation2 = new \PayPal\Api\Patch();
$patchOperation2->setOp("remove")
->setPath("/flow_config/landing_page_type");
//Generate an array of patch operations
$patches = array($patchOperation1, $patchOperation2);
try {
// Execute the partial update, to carry out these two operations on a given web profile object
if ($webProfile->partial_update($patches, $apiContext)) {
$webProfile = \PayPal\Api\WebProfile::get($webProfile->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("Partially Updated Web Profile", "Web Profile", $webProfile->getId(), $webProfile);

View File

@@ -0,0 +1,32 @@
<?php
// #### Update Web Profile
// Use this call to update an experience profile.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#update-a-web-experience-profile
// We will be re-using the sample code to get a web profile. GetWebProfile.php will
// create a new web profileId for sample, and return the web profile object.
/** @var \PayPal\Api\WebProfile $webProfile */
$webProfile = require 'GetWebProfile.php';
// Updated the logo image of presentation object in a given web profile.
$webProfile->getPresentation()->setLogoImage("http://www.google.com/favico.ico");
try {
// Update the web profile to change the logo image.
if ($webProfile->update($apiContext)) {
// If the update is successfull, we can now get the object, and verify the web profile
// object
$updatedWebProfile = \PayPal\Api\WebProfile::get($webProfile->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("Updated Web Profile", "Web Profile", $updatedWebProfile->getId(), $updatedWebProfile);

View File

@@ -0,0 +1,83 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\WebProfile;
/**
* Class WebProfile
*
* @package PayPal\Test\Api
*/
class WebProfileTest extends \PHPUnit_Framework_TestCase
{
public function testCreateprofileSerialization()
{
$requestBody = '{"name":"someName2' . uniqid() . '","presentation":{"logo_image":"http://www.ebay.com"},"input_fields":{"no_shipping":1,"address_override":1},"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"http://www.ebay.com"}}';
$requestBodyEncoded = json_encode(json_decode($requestBody, true));
$object = new WebProfile($requestBodyEncoded);
$json = $object->toJson();
$this->assertEquals($requestBodyEncoded, $json);
}
/**
* @group integration
*/
public function testCreateprofileOperation()
{
$requestBody = '{"name":"someName2' . uniqid() . '","presentation":{"logo_image":"http://www.ebay.com"},"input_fields":{"no_shipping":1,"address_override":1},"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"http://www.ebay.com"}}';
$requestBodyEncoded = json_encode(json_decode($requestBody, true));
$object = new WebProfile($requestBodyEncoded);
$response = $object->create(null);
$this->assertNotNull($response);
return $response->getId();
}
/**
* @depends testCreateprofileOperation
* @group integration
*/
public function testGetprofileOperation($profileId)
{
$response = WebProfile::get($profileId, null);
$this->assertNotNull($response);
$this->assertEquals($response->getId(), $profileId);
$this->assertEquals("http://www.ebay.com", $response->getPresentation()->getLogoImage());
$this->assertEquals(1, $response->getInputFields()->getNoShipping());
$this->assertEquals(1, $response->getInputFields()->getAddressOverride());
$this->assertEquals("billing", $response->getFlowConfig()->getLandingPageType());
$this->assertEquals("http://www.ebay.com", $response->getFlowConfig()->getBankTxnPendingUrl());
return $response->getId();
}
public function testValidationerrorSerialization()
{
$requestBody = '{"name":"sampleName' . uniqid() . '","presentation":{"logo_image":"http://www.ebay.com"},"input_fields":{"no_shipping":4,"address_override":1},"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"ht//www.ebay.com"}}';
$requestBodyEncoded = json_encode(json_decode($requestBody, true));
$object = new WebProfile($requestBodyEncoded);
$json = $object->toJson();
$this->assertEquals($requestBodyEncoded, $json);
}
/**
* @group integration
* @expectedException PayPal\Exception\PPConnectionException
* @expectedExceptionCode 400
*/
public function testValidationerrorOperation()
{
$requestBody = '{"name":"sampleName' . uniqid() . '","presentation":{"logo_image":"http://www.ebay.com"},"input_fields":{"no_shipping":4,"address_override":1},"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"ht//www.ebay.com"}}';
$requestBodyEncoded = json_encode(json_decode($requestBody, true));
$object = new WebProfile($requestBodyEncoded);
$response = $object->create(null);
return $response->getId();
}
}

View File

@@ -50,7 +50,7 @@ class ModelTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage data should be either json or array representation of object
* @expectedExceptionMessage Invalid JSON String
*/
public function testConstructorInvalidInput()
{