示例#1
0
<?php

// Include required library files.
require_once '../includes/config.php';
require_once '../includes/paypal.class.php';
require_once '../includes/paypal.adaptive.class.php';
// Create PayPal object.
$PayPalConfig = array('Sandbox' => $sandbox, 'DeveloperAccountEmail' => $developer_account_email, 'ApplicationID' => $application_id, 'DeviceID' => $device_id, 'IPAddress' => $_SERVER['REMOTE_ADDR'], 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature, 'APISubject' => $api_subject);
$PayPal = new PayPal_Adaptive($PayPalConfig);
// Prepare request arrays
$CreateAccountFields = array('AccountType' => '', 'CitizenshipCountryCode' => '', 'ContactPhoneNumber' => '', 'HomePhoneNumber' => '', 'MobilePhoneNumber' => '', 'ReturnURL' => '', 'ShowAddCreditCard' => '', 'ShowMobileConfirm' => '', 'ReturnURLDescription' => '', 'UseMiniBrowser' => '', 'CurrencyCode' => '', 'DateOfBirth' => '', 'EmailAddress' => '', 'Saluation' => '', 'FirstName' => '', 'MiddleName' => '', 'LastName' => '', 'Suffix' => '', 'NotificationURL' => '', 'PreferredLanguageCode' => '', 'RegistrationType' => '', 'SuppressWelcomeEmail' => '', 'PerformExtraVettingOnThisAccount' => '', 'TaxID' => '');
$BusinessInfo = array('AverageMonthlyVolume' => '', 'AveragePrice' => '', 'BusinessName' => '', 'BusinessSubType' => '', 'BusinessType' => '', 'Category' => '', 'CommercialRegistrationLocation' => '', 'CompanyID' => '', 'CustomerServiceEmail' => '', 'CustomerServicePhone' => '', 'DateOfEstablishment' => '', 'DisputeEmail' => '', 'DoingBusinessAs' => '', 'EstablishmentCountryCode' => '', 'EstablishmentState' => '', 'IncorporationID' => '', 'MerchantCategoryCode' => '', 'PercentageRevenueFromOnline' => '', 'SalesVenu' => '', 'SalesVenuDesc' => '', 'SubCategory' => '', 'VatCountryCode' => '', 'VatID' => '', 'WebSite' => '', 'WorkPhone' => '');
$BusinessAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => '');
$PrinciplePlaceOfBusinessAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => '');
$RegisteredOfficeAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => '');
$BusinessStakeHolder = array('DateOfBirth' => '', 'FullLegalName' => '', 'Saluation' => '', 'FirstName' => '', 'MiddleName' => '', 'LastName' => '', 'Suffix' => '', 'Role' => '', 'CountryCode' => '');
$BusinessStakeHolderAddress = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => '');
$Address = array('Line1' => '', 'Line2' => '', 'City' => '', 'State' => '', 'PostalCode' => '', 'CountryCode' => '');
$PartnerFields = array('Field1' => '', 'Field2' => '', 'Field3' => '', 'Field4' => '', 'Field5' => '');
$PayPalRequestData = array('CreateAccountFields' => $CreateAccountFields, 'BusinessInfo' => $BusinessInfo, 'BusinessAddress' => $BusinessAddress, 'PrinciplePlaceOfBusinessAddress' => $PrinciplePlaceOfBusinessAddress, 'RegisteredOfficeAddress' => $RegisteredOfficeAddress, 'BusinessStakeHolder' => $BusinessStakeHolder, 'BusinessStakeHolderAddress' => $BusinessStakeHolderAddress, 'Address' => $Address, 'PartnerFields' => $PartnerFields);
// Pass data into class for processing with PayPal and load the response array into $PayPalResult
$PayPalResult = $PayPal->CreateAccount($PayPalRequestData);
// Write the contents of the response array to the screen for demo purposes.
echo '<pre />';
print_r($PayPalResult);