当前位置: 首页>>代码示例>>PHP>>正文


PHP PayPalAPIInterfaceServiceService::CreateRecurringPaymentsProfile方法代码示例

本文整理汇总了PHP中PayPalAPIInterfaceServiceService::CreateRecurringPaymentsProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPalAPIInterfaceServiceService::CreateRecurringPaymentsProfile方法的具体用法?PHP PayPalAPIInterfaceServiceService::CreateRecurringPaymentsProfile怎么用?PHP PayPalAPIInterfaceServiceService::CreateRecurringPaymentsProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PayPalAPIInterfaceServiceService的用法示例。


在下文中一共展示了PayPalAPIInterfaceServiceService::CreateRecurringPaymentsProfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createRecurringProfile

 public function createRecurringProfile()
 {
     $logger = new PPLoggingManager('CreateRecurringPaymentProfile');
     // ## CreateRecurringPaymentsProfileReq
     $createRPProfileReq = new CreateRecurringPaymentsProfileReq();
     $createRPProfileRequestType = new CreateRecurringPaymentsProfileRequestType();
     // You can include up to 10 recurring payments profiles per request. The
     // order of the profile details must match the order of the billing
     // agreement details specified in the SetExpressCheckout request which
     // takes mandatory argument:
     //
     // * `billing start date` - The date when billing for this profile begins.
     // `Note:
     // The profile may take up to 24 hours for activation.`
     $RPProfileDetails = new RecurringPaymentsProfileDetailsType("2013-12-31T13:01:19+00:00");
     // Billing amount for each billing cycle during this payment period.
     // This amount does not include shipping and tax amounts.
     // `Note:
     // All amounts in the CreateRecurringPaymentsProfile request must have
     // the same currency.`
     $billingAmount = new BasicAmountType("USD", "3.00");
     // Regular payment period for this schedule which takes mandatory
     // params:
     //
     // * `Billing Period` - Unit for billing during this subscription period. It is one of the
     // following values:
     // * Day
     // * Week
     // * SemiMonth
     // * Month
     // * Year
     // For SemiMonth, billing is done on the 1st and 15th of each month.
     // `Note:
     // The combination of BillingPeriod and BillingFrequency cannot exceed
     // one year.`
     // * `Billing Frequency` - Number of billing periods that make up one billing cycle.
     // The combination of billing frequency and billing period must be less
     // than or equal to one year. For example, if the billing cycle is
     // Month, the maximum value for billing frequency is 12. Similarly, if
     // the billing cycle is Week, the maximum value for billing frequency is
     // 52.
     // `Note:
     // If the billing period is SemiMonth, the billing frequency must be 1.`
     // * `Billing Amount`
     $paymentPeriod = new BillingPeriodDetailsType("Day", "5", $billingAmount);
     // Describes the recurring payments schedule, including the regular
     // payment period, whether there is a trial period, and the number of
     // payments that can fail before a profile is suspended which takes
     // mandatory params:
     //
     // * `Description` - Description of the recurring payment.
     // `Note:
     // You must ensure that this field matches the corresponding billing
     // agreement description included in the SetExpressCheckout request.`
     // * `Payment Period`
     $scheduleDetails = new ScheduleDetailsType("description", $paymentPeriod);
     // `CreateRecurringPaymentsProfileRequestDetailsType` which takes
     // mandatory params:
     //
     // * `Recurring Payments Profile Details`
     // * `Schedule Details`
     $createRecurringPaymentsProfileRequestDetails = new CreateRecurringPaymentsProfileRequestDetailsType($RPProfileDetails, $scheduleDetails);
     // Either EC token or a credit card number is required.If you include
     // both token and credit card number, the token is used and credit card number is
     // ignored
     // In case of setting EC token,
     // `createRecurringPaymentsProfileRequestDetails.setToken("EC-5KH01765D1724703R");`
     // A timestamped token, the value of which was returned in the response
     // to the first call to SetExpressCheckout. Call
     // CreateRecurringPaymentsProfile once for each billing
     // agreement included in SetExpressCheckout request and use the same
     // token for each call. Each CreateRecurringPaymentsProfile request
     // creates a single recurring payments profile.
     // `Note:
     // Tokens expire after approximately 3 hours.`
     // Credit card information for recurring payments using direct payments.
     $creditCard = new CreditCardDetailsType();
     // Type of credit card. For UK, only Maestro, MasterCard, Discover, and
     // Visa are allowable. For Canada, only MasterCard and Visa are
     // allowable and Interac debit cards are not supported. It is one of the
     // following values:
     //
     // * Visa
     // * MasterCard
     // * Discover
     // * Amex
     // * Solo
     // * Switch
     // * Maestro: See note.
     // `Note:
     // If the credit card type is Maestro, you must set currencyId to GBP.
     // In addition, you must specify either StartMonth and StartYear or
     // IssueNumber.`
     $creditCard->CreditCardType = "Visa";
     // Credit Card Number
     $creditCard->CreditCardNumber = "4442662639546634";
     // Credit Card Expiration Month
     $creditCard->ExpMonth = "12";
     // Credit Card Expiration Year
     $creditCard->ExpYear = "2016";
//.........这里部分代码省略.........
开发者ID:andrewwakeling,项目名称:codesamples-php,代码行数:101,代码来源:CreateRecurringPaymentProfile.php

示例2: BillingPeriodDetailsType

$paymentBillingPeriod->BillingPeriod = $_REQUEST['billingPeriod'];
$paymentBillingPeriod->Amount = $trialAmount;
$paymentBillingPeriod->TotalBillingCycles = $_REQUEST['totalBillingCycles'];
$trialBillingPeriod = new BillingPeriodDetailsType();
$trialBillingPeriod->BillingFrequency = $_REQUEST['trialBillingFrequency'];
$trialBillingPeriod->BillingPeriod = $_REQUEST['trialBillingPeriod'];
$trialBillingPeriod->Amount = $trialAmount;
$trialBillingPeriod->TotalBillingCycles = $_REQUEST['trialBillingCycles'];
$scheduleDetails = new ScheduleDetailsType();
$scheduleDetails->Description = $_REQUEST['profileDescription'];
$scheduleDetails->ActivationDetails = $activationDetails;
$scheduleDetails->TrialPeriod = $trialBillingPeriod;
$scheduleDetails->PaymentPeriod = $paymentBillingPeriod;
$scheduleDetails->MaxFailedPayments = $_REQUEST['maxFailedPayments'];
$scheduleDetails->AutoBillOutstandingAmount = $_REQUEST['autoBillOutstandingAmount'];
$createRPProfileRequestDetail = new CreateRecurringPaymentsProfileRequestDetailsType();
$createRPProfileRequestDetail->CreditCard = $creditCard;
//$createRPProfileRequestDetail->Token  = $_REQUEST['token'];
$createRPProfileRequestDetail->ScheduleDetails = $scheduleDetails;
$createRPProfileRequestDetail->RecurringPaymentsProfileDetails = $RPProfileDetails;
$createRPProfileRequest = new CreateRecurringPaymentsProfileRequestType();
$createRPProfileRequest->CreateRecurringPaymentsProfileRequestDetails = $createRPProfileRequestDetail;
$createRPProfileRequest->Version = 92;
$createRPProfileReq = new CreateRecurringPaymentsProfileReq();
$createRPProfileReq->CreateRecurringPaymentsProfileRequest = $createRPProfileRequest;
$paypalService = new PayPalAPIInterfaceServiceService();
$createRPProfileResponse = $paypalService->CreateRecurringPaymentsProfile($createRPProfileReq);
echo "<pre>";
print_r($createRPProfileResponse);
echo "</pre>";
require_once '../Response.php';
开发者ID:kashyapkk,项目名称:SDKs,代码行数:31,代码来源:CreateRecurringPaymentsProfile.php

示例3: subscribe

 function subscribe($sTocken)
 {
     $this->checkTrialAllowed(array('type' => 'token', 'value' => $sTocken));
     $oRPProfileDetails = new RecurringPaymentsProfileDetailsType();
     $oRPProfileDetails->BillingStartDate = date(DATE_ATOM);
     $oPaymentBillingPeriod = new BillingPeriodDetailsType();
     $oPaymentBillingPeriod->BillingPeriod = $this->sPeriodRegular;
     $oPaymentBillingPeriod->BillingFrequency = $this->iFrequencyRegular;
     $oPaymentBillingPeriod->TotalBillingCycles = $this->iBillingCyclesRegular;
     $oPaymentBillingPeriod->Amount = new BasicAmountType($this->sCurrencyCode, $this->fAmountRegular);
     $oScheduleDetails = new ScheduleDetailsType();
     $oScheduleDetails->Description = $this->sDescription;
     switch ($this->sActivationType) {
         case BX_SITES_PP_ACTIVATION_INIT_AMOUNT:
             $oActivationDetails = new ActivationDetailsType();
             $oActivationDetails->InitialAmount = new BasicAmountType($this->sCurrencyCode, $this->fAmountTrial);
             $oActivationDetails->FailedInitialAmountAction = 'CancelOnFailure';
             $oScheduleDetails->ActivationDetails = $oActivationDetails;
             break;
         case BX_SITES_PP_ACTIVATION_TRIAL_PERIOD:
             if (!$this->bTrial) {
                 break;
             }
             $oTrialBillingPeriod = new BillingPeriodDetailsType();
             $oTrialBillingPeriod->BillingPeriod = $this->sPeriodTrial;
             $oTrialBillingPeriod->BillingFrequency = $this->iFrequencyTrial;
             $oTrialBillingPeriod->TotalBillingCycles = $this->iBillingCyclesTrial;
             $oTrialBillingPeriod->Amount = new BasicAmountType($this->sCurrencyCode, $this->fAmountTrial);
             $oScheduleDetails->TrialPeriod = $oTrialBillingPeriod;
             break;
     }
     $oScheduleDetails->PaymentPeriod = $oPaymentBillingPeriod;
     $oScheduleDetails->MaxFailedPayments = 1;
     $oScheduleDetails->AutoBillOutstandingAmount = 'NoAutoBill';
     // 'AddToNextBilling'
     $oRPProfileRequestDetail = new CreateRecurringPaymentsProfileRequestDetailsType();
     $oRPProfileRequestDetail->Token = $sTocken;
     $oRPProfileRequestDetail->ScheduleDetails = $oScheduleDetails;
     $oRPProfileRequestDetail->RecurringPaymentsProfileDetails = $oRPProfileDetails;
     $oRPProfileRequest = new CreateRecurringPaymentsProfileRequestType();
     $oRPProfileRequest->CreateRecurringPaymentsProfileRequestDetails = $oRPProfileRequestDetail;
     $oRPProfileReq = new CreateRecurringPaymentsProfileReq();
     $oRPProfileReq->CreateRecurringPaymentsProfileRequest = $oRPProfileRequest;
     $oPaypalService = new PayPalAPIInterfaceServiceService();
     try {
         $oRPProfileResponse = $oPaypalService->CreateRecurringPaymentsProfile($oRPProfileReq);
     } catch (Exception $oException) {
         $this->_logException($oException);
         exit;
     }
     $sResultMessage = '_bx_sites_paypal_err_subscribe';
     if (!isset($oRPProfileResponse)) {
         $sLog = "---\n";
         $sLog .= "--- Create Recurring: {date}\n";
         $sLog .= "--- Request: " . $oPaypalService->getLastRequest() . "\n";
         $sLog .= "--- Response: " . $oPaypalService->getLastResponse() . "\n";
         $sLog .= "---\n";
         $this->_logError($sLog);
         return $sResultMessage;
     }
     $sLog = "---\n";
     $sLog .= "--- Create Recurring: {date}\n";
     $sLog .= "--- Status: " . $oRPProfileResponse->Ack . "\n";
     $sLog .= "--- Profile ID: " . $oRPProfileResponse->CreateRecurringPaymentsProfileResponseDetails->ProfileID;
     $this->_logNote($sLog);
     $this->_logNote($oRPProfileResponse);
     $this->_logNote("---\n");
     if ($oRPProfileResponse->Ack == 'Success') {
         $sProfileId = $oRPProfileResponse->CreateRecurringPaymentsProfileResponseDetails->ProfileID;
         $oAccount = $this->_oModule->getObject('Account');
         $oAccount->onProfileCreated($sProfileId, $sTocken);
         $sResultMessage = '_bx_sites_paypal_msg_subscribe';
     }
     return $sResultMessage;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:75,代码来源:BxSitesPaypal.php

示例4: purchase_direct_recurring

 public function purchase_direct_recurring($product)
 {
     //create a recurring payment profile
     $person_name = new PersonNameType();
     $person_name->FirstName = $_POST['first_name'];
     $person_name->LastName = $_POST['last_name'];
     $payer = new PayerInfoType();
     $payer->Payer = $_POST['email'];
     $payer->PayerName = $person_name;
     $card_details = new CreditCardDetailsType();
     $card_details->CreditCardNumber = $_POST['cc_number'];
     $card_details->CreditCardType = $_POST['cc_type'];
     $card_details->ExpMonth = $_POST['cc_expmonth'];
     $card_details->ExpYear = $_POST['cc_expyear'] + 2000;
     $card_details->CVV2 = $_POST['cc_cvc'];
     $card_details->CardOwner = $payer;
     $activation_details = new ActivationDetailsType();
     $activation_details->FailedInitialAmountAction = 'ContinueOnFailure';
     $activation_details->InitialAmount = new BasicAmountType($product['currency'], $product['init_amount']);
     if (empty($product['init_amount'])) {
         $activation_details->InitialAmount = new BasicAmountType($product['currency'], $product['recur_amount']);
     }
     $schedule_details = new ScheduleDetailsType();
     $payment_billing_period = new BillingPeriodDetailsType();
     $payment_billing_period->BillingFrequency = $product['recur_billing_frequency'];
     $payment_billing_period->BillingPeriod = $product['recur_billing_period'];
     $payment_billing_period->Amount = new BasicAmountType($product['currency'], $product['recur_amount']);
     $schedule_details->PaymentPeriod = $payment_billing_period;
     $schedule_details->Description = sprintf("%s %s", $product['name'], __("Subscription", "wishlist-member"));
     $schedule_details->ActivationDetails = $activation_details;
     $recur_profile_details = new RecurringPaymentsProfileDetailsType();
     // adjust the start billing date to the next period
     $recur_profile_details->BillingStartDate = date(DATE_ATOM, strtotime(sprintf("+%s %s", $product['recur_billing_frequency'], $product['recur_billing_period'])));
     $create_recur_paypay_profile_details = new CreateRecurringPaymentsProfileRequestDetailsType();
     $create_recur_paypay_profile_details->Token = $token;
     $create_recur_paypay_profile_details->ScheduleDetails = $schedule_details;
     $create_recur_paypay_profile_details->RecurringPaymentsProfileDetails = $recur_profile_details;
     $create_recur_paypay_profile_details->CreditCard = $card_details;
     $create_recur_profile = new CreateRecurringPaymentsProfileRequestType();
     $create_recur_profile->CreateRecurringPaymentsProfileRequestDetails = $create_recur_paypay_profile_details;
     $create_recur_profile_req = new CreateRecurringPaymentsProfileReq();
     $create_recur_profile_req->CreateRecurringPaymentsProfileRequest = $create_recur_profile;
     $paypal_service = new PayPalAPIInterfaceServiceService($this->pp_settings);
     $create_profile_resp = $paypal_service->CreateRecurringPaymentsProfile($create_recur_profile_req);
     if ($create_profile_resp->Ack != 'Success' && $create_profile_resp->Ack != 'SuccessWithWarning') {
         return false;
     }
     if ($create_profile_resp->CreateRecurringPaymentsProfileResponseDetails->ProfileStatus == 'ActiveProfile') {
         return array('status' => 'active', 'id' => $create_profile_resp->CreateRecurringPaymentsProfileResponseDetails->ProfileID);
     }
     return array('status' => 'pending', 'id' => $create_profile_resp->CreateRecurringPaymentsProfileResponseDetails->ProfileID);
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:52,代码来源:integration.shoppingcart.paypalpro.php


注:本文中的PayPalAPIInterfaceServiceService::CreateRecurringPaymentsProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。