Inheritance: extends PayPal\Core\PPBaseService
コード例 #1
0
    $preapprovalRequest->feesPayer = $_POST['feesPayer'];
}
/*
 * (Optional) Whether to display the maximum total amount of this preapproval. It is one of the following values:
   TRUE – Display the amount
    FALSE – Do not display the amount (default)
*/
if ($_POST['displayMaxTotalAmount'] != null) {
    $preapprovalRequest->displayMaxTotalAmount = $_POST['displayMaxTotalAmount'];
}
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->Preapproval($preapprovalRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Preapproval</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #2
0
 *  You use the GetPaymentOptions API operation to retrieve the payment options passed with the SetPaymentOptionsRequest. 
 */
/*
 * (Required) Information common to each API operation, such as the language in which an error message is returned.
 */
$requestEnvelope = new RequestEnvelope("en_US");
/*
 * (Required) The pay key that identifies the payment for which you want to get payment options. This is the pay key you used to set the payment options.
 */
$getPaymentOptionsReq = new GetPaymentOptionsRequest($requestEnvelope, $_POST['payKey']);
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->GetPaymentOptions($getPaymentOptionsReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Get Payment Options</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #3
0
            $payRequest->sender->phone->phoneNumber = $_POST["senderPhoneNumber"];
        }
        if ($_POST['senderExtension'] != "") {
            $payRequest->sender->phone->extension = $_POST["senderExtension"];
        }
    }
    if ($_POST['useCredentials'] != "") {
        $payRequest->sender->useCredentials = $_POST["useCredentials"];
    }
}
/*
 * 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
configuration file for your credentials and endpoint
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->Pay($payRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
/* Make the call to PayPal to get the Pay token
 If the API call succeded, then redirect the buyer to PayPal
to begin to authorize payment.  If an error occured, show the
resulting errors */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
コード例 #4
0
    if ($_POST['emailMarketingImageUrl'] != "") {
        $setPaymentOptionsRequest->displayOptions->emailMarketingImageUrl = $_POST['emailMarketingImageUrl'];
    }
    if ($_POST['headerImageUrl'] != "") {
        $setPaymentOptionsRequest->displayOptions->headerImageUrl = $_POST['headerImageUrl'];
    }
    if ($_POST['businessName'] != "") {
        $setPaymentOptionsRequest->displayOptions->businessName = $_POST['businessName'];
    }
}
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->SetPaymentOptions($setPaymentOptionsRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Set Payment Options</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #5
0
/*
 *  (Required) The payment paykey that identifies the account holder for whom you want to obtain the selected shipping address.
Note:

Shipping information can only be retrieved through the payment payKey; not through the preapprovalKey.
*/
/*
 * (Required) Information common to each API operation, such as the language in which an error message is returned.
 */
$getShippingAddressesReq = new GetShippingAddressesRequest(new RequestEnvelope("en_US"), $_POST['key']);
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->GetShippingAddresses($getShippingAddressesReq);
} catch (Exception $ex) {
    require_once 'Comon/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Get Shipping Addresses</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #6
0
use PayPal\Types\Common\RequestEnvelope;
require_once 'PPBootStrap.php';
// create request
$requestEnvelope = new RequestEnvelope("en_US");
$confirmPreapprovalReq = new ConfirmPreapprovalRequest($requestEnvelope, $_POST['preapprovalKey']);
// set optional params
if ($_POST['fundingSourceId'] != "") {
    $confirmPreapprovalReq->fundingSourceId = $_POST['fundingSourceId'];
}
if ($_POST['pin'] != "") {
    $confirmPreapprovalReq->pin = $_POST['pin'];
}
/*
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    $response = $service->ConfirmPreapproval($confirmPreapprovalReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Confirm Preapproval</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #7
0
 * Use the CancelPreapproval API operation to handle the canceling of preapprovals. Preapprovals can be canceled regardless of the state they are in, such as active, expired, deactivated, and previously canceled. 
 */
/*
 * (Required) Information common to each API operation, such as the language in which an error message is returned.
 */
$requestEnvelope = new RequestEnvelope("en_US");
/*
 * (Required) The preapproval key that identifies the preapproval to be canceled. 
 */
$cancelPreapprovalReq = new CancelPreapprovalRequest($requestEnvelope, $_POST['preapprovalKey']);
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->CancelPreapproval($cancelPreapprovalReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Cancel Preapproval</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #8
0
*/
if ($_POST['payKey'] != "") {
    $paymentDetailsReq->payKey = $_POST['payKey'];
}
if ($_POST['transactionId'] != "") {
    $paymentDetailsReq->transactionId = $_POST['transactionId'];
}
if ($_POST['trackingId'] != "") {
    $paymentDetailsReq->trackingId = $_POST['trackingId'];
}
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->PaymentDetails($paymentDetailsReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Payment Details</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #9
0
 * (Optional) The pay key that identifies the payment to be executed. This is the pay key returned in the PayResponse message. 
 */
$executePaymentRequest = new ExecutePaymentRequest(new RequestEnvelope("en_US"), $_POST['payKey']);
$executePaymentRequest->actionType = $_POST["actionType"];
/*
 * The ID of the funding plan from which to make this payment.
 */
if ($_POST["fundingPlanID"] != "") {
    $executePaymentRequest->fundingPlanId = $_POST["fundingPlanID"];
}
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->ExecutePayment($executePaymentRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Execute Payment</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #10
0
<?php

use PayPal\Service\AdaptivePaymentsService;
use PayPal\Types\AP\GetAvailableShippingAddressesRequest;
use PayPal\Types\Common\RequestEnvelope;
require_once 'PPBootStrap.php';
// create request
$getAvailableShippingAddressesReq = new GetAvailableShippingAddressesRequest(new RequestEnvelope("en_US"), $_POST['key']);
/*
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    $response = $service->GetAvailableShippingAddresses($getAvailableShippingAddressesReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Get Available Shipping Addresses</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>

<body>
<div id="wrapper">
		<img src="https://devtools-paypal.com/image/bdg_payments_by_pp_2line.png"/>
<div id="response_form">
コード例 #11
0
 */
if ($_POST['transactionId'] != "") {
    $refundRequest->transactionId = $_POST["transactionId"];
}
/*
 * The tracking ID associated with the payment that you want to refund
 */
if ($_POST['trackingId'] != "") {
    $refundRequest->trackingId = $_POST["trackingId"];
}
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->Refund($refundRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Refund</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #12
0
if ($_POST['email'] != "" || $_POST['phoneCountry'] != "" && $_POST['phoneNumber'] != "") {
    $getUserLimitsReq->user = new AccountIdentifier();
    if ($_POST['email'] != "") {
        $getUserLimitsReq->user->email = $_POST['email'];
    }
    if ($_POST['phoneCountry'] != "" && $_POST['phoneNumber'] != "") {
        $getUserLimitsReq->user->phone = new PhoneNumberType($_POST['phoneCountry'], $_POST['phoneNumber']);
        if ($_POST['phoneExtension'] != "") {
            $getUserLimitsReq->user->phone->extension = $_POST['phoneExtension'];
        }
    }
}
/*
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    $response = $service->GetUserLimits($getUserLimitsReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Get User Limits</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #13
0
use PayPal\Types\Common\RequestEnvelope;
require_once 'PPBootStrap.php';
/*
 * Use the GetFundingPlans API operation to determine the funding sources that are available for a specified payment, identified by its key, which takes into account the preferences and country of the receiver as well as the payment amount. You must be both the sender of the payment and the caller of this API operation 
 */
/*
 * The key used to create the payment whose funding sources you want to determine. 
 * The code for the language in which errors are returned, which must be en_US.
 */
$getFundingPlansReq = new GetFundingPlansRequest(new RequestEnvelope("en_US"), $_POST['payKey']);
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->GetFundingPlans($getFundingPlansReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Get Funding Plans</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #14
0
		 be converted.
		 * `ConvertToCurrencyList` - A list of currencies to convert to.
*/
$convertCurrencyReq = new ConvertCurrencyRequest(new RequestEnvelope("en_US"), $baseAmountList, $convertToCurrencyList);
if ($_POST['countryCode'] != "") {
    $convertCurrencyReq->countryCode = $_POST['countryCode'];
}
if ($_POST['conversionType'] != "" && $_POST['conversionType'] != "- Select -") {
    $convertCurrencyReq->conversionType = $_POST['conversionType'];
}
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->ConvertCurrency($convertCurrencyReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Convert Currency</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>
コード例 #15
0
<?php

use PayPal\Service\AdaptivePaymentsService;
use PayPal\Types\AP\GetAllowedFundingSourcesRequest;
use PayPal\Types\Common\RequestEnvelope;
require_once 'PPBootStrap.php';
// create request
$requestEnvelope = new RequestEnvelope("en_US");
$getAllowedFundingSourcesReq = new GetAllowedFundingSourcesRequest($requestEnvelope, $_POST['key']);
/*
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    $response = $service->GetAllowedFundingSources($getAllowedFundingSourcesReq);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Get Allowed Funding Sources</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>

<body>
	<div id="wrapper">
		<img src="https://devtools-paypal.com/image/bdg_payments_by_pp_2line.png"/>
コード例 #16
0
 * The PreapprovalDetailsRequest message specifies the key of the preapproval agreement whose details you want to obtain.
 */
/*
 * (Required) Information common to each API operation, such as the language in which an error message is returned.
 */
$requestEnvelope = new RequestEnvelope("en_US");
/*
 * (Required) A preapproval key that identifies the preapproval for which you want to retrieve details. The preapproval key is returned in the PreapprovalResponse message.
 */
$preapprovalDetailsRequest = new PreapprovalDetailsRequest($requestEnvelope, $_POST['preapprovalKey']);
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->PreapprovalDetails($preapprovalDetailsRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Preapproval Details</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>