コード例 #1
0
 /**
  * @param $profile Profile
  * @return \PayPal\Api\WebProfile
  */
 public static function ConstructWebProfile(Profile $profile)
 {
     $flowConfig = new \PayPal\Api\FlowConfig();
     $flowConfig->setLandingPageType($profile->GetLandingPageType());
     $presentation = new \PayPal\Api\Presentation();
     $presentation->setLocaleCode($profile->GetLocale());
     $logoUrl = $profile->GetLogoUrl();
     if ($logoUrl) {
         $presentation->setLogoImage($logoUrl);
     }
     $businessName = $profile->GetBrandName();
     if ($businessName) {
         $presentation->setBrandName($businessName);
     }
     $inputFields = new \PayPal\Api\InputFields();
     $inputFields->setAllowNote($profile->GetAllowNote())->setNoShipping($profile->GetNoShipping())->setAddressOverride($profile->GetAddressOverride());
     $webProfile = new \PayPal\Api\WebProfile();
     $webProfile->setName($profile->GetProfileName())->setFlowConfig($flowConfig)->setPresentation($presentation)->setInputFields($inputFields);
     return $webProfile;
 }
コード例 #2
0
ファイル: CreateWebProfile.php プロジェクト: Roc4rdho/app
<?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")->setBrandName("YeowZa! Paypal")->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)->setNoShipping(1)->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())->setFlowConfig($flowConfig)->setPresentation($presentation)->setInputFields($inputFields);
// For Sample Purposes Only.
$request = clone $webProfile;
try {
    // Use this call to create a profile.
    $createProfileResponse = $webProfile->create($apiContext);
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
コード例 #3
0
// ### 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/");
// When set to "commit", the buyer is shown an amount, and the button text will read "Pay Now" on the checkout page.
$flowConfig->setUserAction("commit");
// Defines the HTTP method to use to redirect the user to a return URL. A valid value is `GET` or `POST`.
$flowConfig->setReturnUriHttpMethod("GET");
// 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")->setBrandName("YeowZa! Paypal")->setLocaleCode("US")->setReturnUrlLabel("Return")->setNoteToSellerLabel("Thanks!");
// 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)->setNoShipping(1)->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())->setFlowConfig($flowConfig)->setPresentation($presentation)->setInputFields($inputFields)->setTemporary(true);
// For Sample Purposes Only.
$request = clone $webProfile;
try {
    // Use this call to create a profile.
    $createProfileResponse = $webProfile->create($apiContext);
コード例 #4
0
ファイル: Payments.php プロジェクト: nikonehauser/ptclient
 public static function getPaymentExperienceProfileId()
 {
     $apiContext = self::getApiContext();
     $list = \PayPal\Api\WebProfile::get_list($apiContext);
     if (count($list) > 0) {
         return $list[0]->getId();
     }
     // ### 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("Login");
     // The URL on the merchant site for transferring to after a bank transfer payment.
     // $flowConfig->setBankTxnPendingUrl("http://www.yeowza.com/");
     // When set to "commit", the buyer is shown an amount, and the button text will read "Pay Now" on the checkout page.
     $flowConfig->setUserAction(null);
     // Defines the HTTP method to use to redirect the user to a return URL. A valid value is `GET` or `POST`.
     // $flowConfig->setReturnUriHttpMethod("GET");
     //
     // Parameters for style and presentation.
     $presentation = new \PayPal\Api\Presentation();
     // A URL to logo image. Allowed vaues: .gif, .jpg, or .png.
     $presentation->setLogoImage("http://betterliving.social/assets/images/paypal_checkout_brand.jpg")->setBrandName(\Tbmt\Config::get('brand.name'))->setLocaleCode("US");
     // A label to use as hypertext for the return to merchant link.
     // ->setReturnUrlLabel("Return")
     // A label to use as the title for the note to seller field. Used only when `allow_note` is `1`.
     // ->setNoteToSellerLabel("Thanks!");
     // 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(false)->setNoShipping(1)->setAddressOverride(0);
     // #### Payment Web experience profile resource
     $webProfile = new \PayPal\Api\WebProfile();
     // Name of the web experience profile. Required. Must be unique
     $webProfile->setName("happiness-guide")->setFlowConfig($flowConfig)->setPresentation($presentation)->setInputFields($inputFields)->setTemporary(false);
     $createProfileResponse = $webProfile->create($apiContext);
     return $createProfileResponse->getId();
 }
コード例 #5
0
 public function storeCustomRecord($parameters)
 {
     // ### 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($this->request->input('landingPageType'));
     // The URL on the merchant site for transferring to after a bank transfer payment.
     $flowConfig->setBankTxnPendingUrl($this->request->input('bankTxnPendingUrl'));
     // Parameters for style and presentation.
     $presentation = new \PayPal\Api\Presentation();
     // A URL to logo image. Allowed vaues: .gif, .jpg, or .png.
     $presentation->setLogoImage($this->request->input('logoImage'))->setBrandName($this->request->input('brandName'))->setLocaleCode($this->request->input('localCode'));
     // 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($this->request->has('allowNote'))->setNoShipping((int) $this->request->input('shippingDataType'))->setAddressOverride((int) $this->request->input('displayShippingDataType'));
     // #### Payment Web experience profile resource
     $webProfile = new \PayPal\Api\WebProfile();
     // Name of the web experience profile. Required. Must be unique
     $webProfile->setName($this->request->input('name'))->setFlowConfig($flowConfig)->setPresentation($presentation)->setInputFields($inputFields);
     try {
         // Use this call to create a profile.
         $webProfile->create($this->apiContext);
     } catch (\PayPal\Exception\PayPalConnectionException $e) {
         dd($e);
     }
 }