forked from LiveCarta/PayPal-PHP-SDK
Updated User Agent & More Samples for Billing Plans
- Fixed versioning in User Agent. - Updated Billing Plan sample to update Payment definitions - Docs & Tests
This commit is contained in:
@@ -81,6 +81,6 @@ class PatchRequest extends PPModel
|
||||
foreach ($this->getPatches() as $patch) {
|
||||
$json[] = $patch->toArray();
|
||||
}
|
||||
return json_encode($json, $options);
|
||||
return str_replace('\\/', '/', json_encode($json, $options));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ class OAuthTokenCredential extends ResourceModel
|
||||
{
|
||||
$base64ClientID = base64_encode($clientId . ":" . $clientSecret);
|
||||
$headers = array(
|
||||
"User-Agent" => PPUserAgent::getValue(RestHandler::$sdkName, RestHandler::$sdkVersion),
|
||||
"User-Agent" => PPUserAgent::getValue(PPConstants::SDK_NAME, PPConstants::SDK_VERSION),
|
||||
"Authorization" => "Basic " . $base64ClientID,
|
||||
"Accept" => "*/*"
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ class PPConstants
|
||||
{
|
||||
|
||||
const SDK_NAME = 'PayPal-PHP-SDK';
|
||||
const SDK_VERSION = '0.14.0';
|
||||
const SDK_VERSION = '0.14.1';
|
||||
|
||||
const REST_SANDBOX_ENDPOINT = "https://api.sandbox.paypal.com/";
|
||||
const OPENID_REDIRECT_SANDBOX_URL = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect";
|
||||
|
||||
@@ -9,6 +9,7 @@ use PayPal\Auth\OAuthTokenCredential;
|
||||
use PayPal\Common\PPUserAgent;
|
||||
use PayPal\Core\PPConstants;
|
||||
use PayPal\Core\PPCredentialManager;
|
||||
use PayPal\Core\PPHttpConfig;
|
||||
use PayPal\Exception\PPConfigurationException;
|
||||
use PayPal\Exception\PPInvalidCredentialException;
|
||||
use PayPal\Exception\PPMissingCredentialException;
|
||||
@@ -26,20 +27,6 @@ class RestHandler implements IPPHandler
|
||||
*/
|
||||
private $apiContext;
|
||||
|
||||
/**
|
||||
* Public Variable
|
||||
*
|
||||
* @var string $sdkName
|
||||
*/
|
||||
public static $sdkName = "rest-sdk-php";
|
||||
|
||||
/**
|
||||
* Public Variable
|
||||
*
|
||||
* @var string $sdkVersion
|
||||
*/
|
||||
public static $sdkVersion = "0.13.2";
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
@@ -51,7 +38,7 @@ class RestHandler implements IPPHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Paypal\Core\PPHttpConfig $httpConfig
|
||||
* @param PPHttpConfig $httpConfig
|
||||
* @param string $request
|
||||
* @param mixed $options
|
||||
* @return mixed|void
|
||||
@@ -87,7 +74,7 @@ class RestHandler implements IPPHandler
|
||||
);
|
||||
|
||||
if (!array_key_exists("User-Agent", $httpConfig->getHeaders())) {
|
||||
$httpConfig->addHeader("User-Agent", PPUserAgent::getValue(self::$sdkName, self::$sdkVersion));
|
||||
$httpConfig->addHeader("User-Agent", PPUserAgent::getValue(PPConstants::SDK_NAME, PPConstants::SDK_VERSION));
|
||||
}
|
||||
|
||||
if (!is_null($credential) && $credential instanceof OAuthTokenCredential && is_null($httpConfig->getHeader('Authorization'))) {
|
||||
|
||||
7
sample/.htaccess
Normal file
7
sample/.htaccess
Normal file
@@ -0,0 +1,7 @@
|
||||
<IfModule mod_php5.c>
|
||||
php_value display_errors On
|
||||
php_flag magic_quotes 1
|
||||
php_flag magic_quotes_gpc 1
|
||||
php_value mbstring.http_input auto
|
||||
php_value date.timezone America/Los_Angeles
|
||||
</IfModule>
|
||||
@@ -67,7 +67,7 @@ $agreement->setPlan($plan);
|
||||
// Add Payer
|
||||
$payer = new Payer();
|
||||
$payer->setPaymentMethod('credit_card')
|
||||
->setPayerInfo(new PayerInfo(['email' => 'jaypatel512-facilitator@hotmail.com']));
|
||||
->setPayerInfo(new PayerInfo(array('email' => 'jaypatel512-facilitator@hotmail.com')));
|
||||
|
||||
// Add Credit Card to Funding Instruments
|
||||
$creditCard = new CreditCard();
|
||||
|
||||
@@ -33,12 +33,12 @@ $paymentDefinition->setName('Regular Payments')
|
||||
->setFrequency('Month')
|
||||
->setFrequencyInterval("2")
|
||||
->setCycles("12")
|
||||
->setAmount(new Currency(['value' => 100, 'currency' => 'USD']));
|
||||
->setAmount(new Currency(array('value' => 100, 'currency' => 'USD')));
|
||||
|
||||
// Charge Models
|
||||
$chargeModel = new ChargeModel();
|
||||
$chargeModel->setType('SHIPPING')
|
||||
->setAmount(new Currency(['value' => 10, 'currency' => 'USD']));
|
||||
->setAmount(new Currency(array('value' => 10, 'currency' => 'USD')));
|
||||
|
||||
$paymentDefinition->setChargeModels(array($chargeModel));
|
||||
|
||||
@@ -49,7 +49,7 @@ $merchantPreferences->setReturnUrl("$baseUrl/ExecuteAgreement.php?success=true")
|
||||
->setAutoBillAmount("yes")
|
||||
->setInitialFailAmountAction("CONTINUE")
|
||||
->setMaxFailAttempts("0")
|
||||
->setSetupFee(new Currency(['value' => 1, 'currency' => 'USD']));
|
||||
->setSetupFee(new Currency(array('value' => 1, 'currency' => 'USD')));
|
||||
|
||||
|
||||
$plan->setPaymentDefinitions(array($paymentDefinition));
|
||||
|
||||
51
sample/billing/UpdatePlanPaymentDefinitions.php
Normal file
51
sample/billing/UpdatePlanPaymentDefinitions.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
// # Update a plan
|
||||
//
|
||||
// This sample code demonstrate how you can update a billing plan, as documented here at:
|
||||
// https://developer.paypal.com/webapps/developer/docs/api/#update-a-plan
|
||||
// API used: /v1/payments/billing-plans/<Plan-Id>
|
||||
|
||||
// ### Changing Plan Amount
|
||||
// This example demonstrate how you could change the plan amount
|
||||
|
||||
// Retrieving the Plan object from Create Plan Sample to demonstrate the List
|
||||
/** @var Plan $createdPlan */
|
||||
$createdPlan = require 'CreatePlan.php';
|
||||
|
||||
use PayPal\Api\Plan;
|
||||
use PayPal\Api\PatchRequest;
|
||||
use PayPal\Api\Patch;
|
||||
|
||||
try {
|
||||
$patch = new Patch();
|
||||
|
||||
$paymentDefinitions = $createdPlan->getPaymentDefinitions();
|
||||
$paymentDefinitionId = $paymentDefinitions[0]->getId();
|
||||
$patch->setOp('replace')
|
||||
->setPath('/payment-definitions/' . $paymentDefinitionId)
|
||||
->setValue(json_decode(
|
||||
'{
|
||||
"name": "Updated Payment Definition",
|
||||
"frequency": "Day",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "50"
|
||||
}
|
||||
}'
|
||||
));
|
||||
$patchRequest = new PatchRequest();
|
||||
$patchRequest->addPatch($patch);
|
||||
|
||||
$createdPlan->update($patchRequest, $apiContext);
|
||||
|
||||
$plan = Plan::get($createdPlan->getId(), $apiContext);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Updated the Plan Payment Definition", "Plan", null, $patchRequest, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Updated the Plan Payment Definition", "Plan", $plan->getId(), $patchRequest, $plan);
|
||||
|
||||
return $plan;
|
||||
@@ -30,19 +30,35 @@ class ResultPrinter
|
||||
* @param string $objectId
|
||||
* @param mixed $request
|
||||
* @param mixed $response
|
||||
* @param string $error
|
||||
* @param string $errorMessage
|
||||
*/
|
||||
public static function printOutput($title, $objectName, $objectId = null, $request = null, $response = null, $errorMessage = null)
|
||||
{
|
||||
if (self::$printResultCounter == 0) {
|
||||
include "header.html";
|
||||
echo '<br />
|
||||
if (PHP_SAPI == 'cli') {
|
||||
self::$printResultCounter++;
|
||||
printf("\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
|
||||
printf("(%d) %s", self::$printResultCounter, strtoupper($title));
|
||||
printf("\n-------------------------------------------------------------\n\n");
|
||||
if ($objectId) {
|
||||
printf("Object with ID: %s \n", $objectId);
|
||||
}
|
||||
printf("-------------------------------------------------------------\n");
|
||||
printf("\tREQUEST:\n");
|
||||
self::printConsoleObject($request);
|
||||
printf("\n\n\tRESPONSE:\n");
|
||||
self::printConsoleObject($response, $errorMessage);
|
||||
printf("\n-------------------------------------------------------------\n\n");
|
||||
} else {
|
||||
|
||||
if (self::$printResultCounter == 0) {
|
||||
include "header.html";
|
||||
echo '<br />
|
||||
<div class="row"><div class="col-md-2 pull-left"><a href="../index.html"><h4>❮❮ Back to Samples</h4></a><br /><br /></div>
|
||||
<div class="col-md-1 pull-right"><img src="../images/pp_v_rgb.png" height="70" /></div> </div><div class="clearfix visible-xs-block"></div>';
|
||||
echo '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">';
|
||||
}
|
||||
self::$printResultCounter++;
|
||||
echo '
|
||||
echo '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">';
|
||||
}
|
||||
self::$printResultCounter++;
|
||||
echo '
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading '. ($errorMessage ? 'error' : '') .'" role="tab" id="heading-'.self::$printResultCounter.'">
|
||||
<h4 class="panel-title">
|
||||
@@ -54,29 +70,29 @@ class ResultPrinter
|
||||
<div class="panel-body">
|
||||
';
|
||||
|
||||
if ($objectId) {
|
||||
echo "<div>" . ($objectName ? $objectName : "Object") . " with ID: $objectId </div>";
|
||||
}
|
||||
if ($objectId) {
|
||||
echo "<div>" . ($objectName ? $objectName : "Object") . " with ID: $objectId </div>";
|
||||
}
|
||||
|
||||
echo '<div class="row hidden-xs hidden-sm hidden-md"><div class="col-md-6"><h4>Request Object</h4>';
|
||||
self::printObject($request);
|
||||
echo '</div><div class="col-md-6"><h4 class="'. ($errorMessage ? 'error' : '') .'">Response Object</h4>';
|
||||
self::printObject($response, $errorMessage);
|
||||
echo '</div></div>';
|
||||
echo '<div class="row hidden-xs hidden-sm hidden-md"><div class="col-md-6"><h4>Request Object</h4>';
|
||||
self::printObject($request);
|
||||
echo '</div><div class="col-md-6"><h4 class="'. ($errorMessage ? 'error' : '') .'">Response Object</h4>';
|
||||
self::printObject($response, $errorMessage);
|
||||
echo '</div></div>';
|
||||
|
||||
echo '<div class="hidden-lg"><ul class="nav nav-tabs" role="tablist">
|
||||
echo '<div class="hidden-lg"><ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" ><a href="#step-'.self::$printResultCounter .'-request" role="tab" data-toggle="tab">Request</a></li>
|
||||
<li role="presentation" class="active"><a href="#step-'.self::$printResultCounter .'-response" role="tab" data-toggle="tab">Response</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane" id="step-'.self::$printResultCounter .'-request"><h4>Request Object</h4>';
|
||||
self::printObject($request) ;
|
||||
echo '</div><div role="tabpanel" class="tab-pane active" id="step-'.self::$printResultCounter .'-response"><h4>Response Object</h4>';
|
||||
self::printObject($response, $errorMessage);
|
||||
echo '</div></div></div></div>
|
||||
self::printObject($request) ;
|
||||
echo '</div><div role="tabpanel" class="tab-pane active" id="step-'.self::$printResultCounter .'-response"><h4>Response Object</h4>';
|
||||
self::printObject($response, $errorMessage);
|
||||
echo '</div></div></div></div>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
flush();
|
||||
}
|
||||
|
||||
@@ -112,6 +128,27 @@ class ResultPrinter
|
||||
self::printOutput($title, $objectName, $objectId, $request, $data, $exception->getMessage());
|
||||
}
|
||||
|
||||
protected static function printConsoleObject($object, $error = null)
|
||||
{
|
||||
if ($error) {
|
||||
echo 'ERROR:'. $error;
|
||||
}
|
||||
if ($object) {
|
||||
if (is_a($object, 'PayPal\Common\PPModel')) {
|
||||
/** @var $object \PayPal\Common\PPModel */
|
||||
echo $object->toJSON(128);
|
||||
} elseif (is_string($object) && \PayPal\Validation\JsonValidator::validate($object, true)) {
|
||||
echo str_replace('\\/', '/', json_encode(json_decode($object), 128));
|
||||
} elseif (is_string($object)) {
|
||||
echo $object;
|
||||
} else {
|
||||
print_r($object);
|
||||
}
|
||||
} else {
|
||||
echo "No Data";
|
||||
}
|
||||
}
|
||||
|
||||
protected static function printObject($object, $error = null)
|
||||
{
|
||||
if ($error) {
|
||||
@@ -145,7 +182,12 @@ class ResultPrinter
|
||||
*/
|
||||
function getBaseUrl()
|
||||
{
|
||||
|
||||
if (PHP_SAPI == 'cli') {
|
||||
$trace=debug_backtrace();
|
||||
$relativePath = substr(dirname($trace[0]['file']), strlen(dirname(dirname(__FILE__))));
|
||||
echo "Warning: This sample may require a server to handle return URL. Cannot execute in command line. Defaulting URL to http://localhost$relativePath \n";
|
||||
return "http://localhost" . $relativePath;
|
||||
}
|
||||
$protocol = 'http';
|
||||
if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) {
|
||||
$protocol .= 's';
|
||||
|
||||
@@ -390,6 +390,46 @@ 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": "file",
|
||||
"data": {
|
||||
"language": {
|
||||
"nameMatchers": [{}, ".fbp"],
|
||||
"pygmentsLexer": "php",
|
||||
"singleLineComment": ["//"],
|
||||
"ignorePrefix": "}",
|
||||
"foldPrefix": "^",
|
||||
"name": "PHP"
|
||||
},
|
||||
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/billing/UpdatePlanPaymentDefinitions.php",
|
||||
"projectPath": "billing/UpdatePlanPaymentDefinitions.php",
|
||||
"targetPath": "billing/UpdatePlanPaymentDefinitions",
|
||||
"pageTitle": "billing/UpdatePlanPaymentDefinitions",
|
||||
"title": "UpdatePlanPaymentDefinitions"
|
||||
},
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Update a plan",
|
||||
"slug": "update-a-plan"
|
||||
},
|
||||
"depth": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Changing Plan Amount",
|
||||
"slug": "changing-plan-amount"
|
||||
},
|
||||
"depth": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}, {
|
||||
|
||||
@@ -55,7 +55,7 @@ Please note that the plan Id should be only set in this case.</p></div></div><di
|
||||
<span class="hljs-variable">$plan</span>->setId(<span class="hljs-variable">$createdPlan</span>->getId());
|
||||
<span class="hljs-variable">$agreement</span>->setPlan(<span class="hljs-variable">$plan</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer();
|
||||
<span class="hljs-variable">$payer</span>->setPaymentMethod(<span class="hljs-string">'credit_card'</span>)
|
||||
->setPayerInfo(<span class="hljs-keyword">new</span> PayerInfo([<span class="hljs-string">'email'</span> => <span class="hljs-string">'jaypatel512-facilitator@hotmail.com'</span>]));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Credit Card to Funding Instruments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$creditCard</span> = <span class="hljs-keyword">new</span> CreditCard();
|
||||
->setPayerInfo(<span class="hljs-keyword">new</span> PayerInfo(<span class="hljs-keyword">array</span>(<span class="hljs-string">'email'</span> => <span class="hljs-string">'jaypatel512-facilitator@hotmail.com'</span>)));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Credit Card to Funding Instruments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$creditCard</span> = <span class="hljs-keyword">new</span> CreditCard();
|
||||
<span class="hljs-variable">$creditCard</span>->setType(<span class="hljs-string">'visa'</span>)
|
||||
->setNumber(<span class="hljs-string">'4417119669820331'</span>)
|
||||
->setExpireMonth(<span class="hljs-string">'12'</span>)
|
||||
|
||||
@@ -16,9 +16,9 @@ You should be able to see the acceptable values in the comments.</p></div></div>
|
||||
->setFrequency(<span class="hljs-string">'Month'</span>)
|
||||
->setFrequencyInterval(<span class="hljs-string">"2"</span>)
|
||||
->setCycles(<span class="hljs-string">"12"</span>)
|
||||
->setAmount(<span class="hljs-keyword">new</span> Currency([<span class="hljs-string">'value'</span> => <span class="hljs-string">'100'</span>, <span class="hljs-string">'currency'</span> => <span class="hljs-string">'USD'</span>]));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Charge Models</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$chargeModel</span> = <span class="hljs-keyword">new</span> ChargeModel();
|
||||
->setAmount(<span class="hljs-keyword">new</span> Currency(<span class="hljs-keyword">array</span>(<span class="hljs-string">'value'</span> => <span class="hljs-number">100</span>, <span class="hljs-string">'currency'</span> => <span class="hljs-string">'USD'</span>)));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Charge Models</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$chargeModel</span> = <span class="hljs-keyword">new</span> ChargeModel();
|
||||
<span class="hljs-variable">$chargeModel</span>->setType(<span class="hljs-string">'SHIPPING'</span>)
|
||||
->setAmount(<span class="hljs-keyword">new</span> Currency([<span class="hljs-string">'value'</span> => <span class="hljs-string">'10'</span>, <span class="hljs-string">'currency'</span> => <span class="hljs-string">'USD'</span>]));
|
||||
->setAmount(<span class="hljs-keyword">new</span> Currency(<span class="hljs-keyword">array</span>(<span class="hljs-string">'value'</span> => <span class="hljs-number">10</span>, <span class="hljs-string">'currency'</span> => <span class="hljs-string">'USD'</span>)));
|
||||
|
||||
<span class="hljs-variable">$paymentDefinition</span>->setChargeModels(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$chargeModel</span>));
|
||||
|
||||
@@ -29,7 +29,7 @@ You should be able to see the acceptable values in the comments.</p></div></div>
|
||||
->setAutoBillAmount(<span class="hljs-string">"yes"</span>)
|
||||
->setInitialFailAmountAction(<span class="hljs-string">"CONTINUE"</span>)
|
||||
->setMaxFailAttempts(<span class="hljs-string">"0"</span>)
|
||||
->setSetupFee(<span class="hljs-keyword">new</span> Currency([<span class="hljs-string">'value'</span> => <span class="hljs-string">'1'</span>, <span class="hljs-string">'currency'</span> => <span class="hljs-string">'USD'</span>]));
|
||||
->setSetupFee(<span class="hljs-keyword">new</span> Currency(<span class="hljs-keyword">array</span>(<span class="hljs-string">'value'</span> => <span class="hljs-number">1</span>, <span class="hljs-string">'currency'</span> => <span class="hljs-string">'USD'</span>)));
|
||||
|
||||
|
||||
<span class="hljs-variable">$plan</span>->setPaymentDefinitions(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$paymentDefinition</span>));
|
||||
|
||||
43
sample/doc/billing/UpdatePlanPaymentDefinitions.html
Normal file
43
sample/doc/billing/UpdatePlanPaymentDefinitions.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/UpdatePlanPaymentDefinitions</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="billing/UpdatePlanPaymentDefinitions"><meta name="groc-project-path" content="billing/UpdatePlanPaymentDefinitions.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">billing/UpdatePlanPaymentDefinitions.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor"><?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="update-a-plan">Update a plan</h1>
|
||||
<p>This sample code demonstrate how you can update a billing plan, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#update-a-plan">https://developer.paypal.com/webapps/developer/docs/api/#update-a-plan</a>
|
||||
API used: /v1/payments/billing-plans/<Plan-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="changing-plan-amount">Changing Plan Amount</h3>
|
||||
<p>This example demonstrate how you could change the plan amount</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Plan object from Create Plan Sample to demonstrate the List</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Plan $createdPlan */</span>
|
||||
<span class="hljs-variable">$createdPlan</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreatePlan.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Plan</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PatchRequest</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Patch</span>;
|
||||
|
||||
<span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$patch</span> = <span class="hljs-keyword">new</span> Patch();
|
||||
|
||||
<span class="hljs-variable">$paymentDefinitions</span> = <span class="hljs-variable">$createdPlan</span>->getPaymentDefinitions();
|
||||
<span class="hljs-variable">$paymentDefinitionId</span> = <span class="hljs-variable">$paymentDefinitions</span>[<span class="hljs-number">0</span>]->getId();
|
||||
<span class="hljs-variable">$patch</span>->setOp(<span class="hljs-string">'replace'</span>)
|
||||
->setPath(<span class="hljs-string">'/payment-definitions/'</span> . <span class="hljs-variable">$paymentDefinitionId</span>)
|
||||
->setValue(json_decode(
|
||||
<span class="hljs-string">'{
|
||||
"name": "Updated Payment Definition",
|
||||
"frequency": "Day",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "50"
|
||||
}
|
||||
}'</span>
|
||||
));
|
||||
<span class="hljs-variable">$patchRequest</span> = <span class="hljs-keyword">new</span> PatchRequest();
|
||||
<span class="hljs-variable">$patchRequest</span>->addPatch(<span class="hljs-variable">$patch</span>);
|
||||
|
||||
<span class="hljs-variable">$createdPlan</span>->update(<span class="hljs-variable">$patchRequest</span>, <span class="hljs-variable">$apiContext</span>);
|
||||
|
||||
<span class="hljs-variable">$plan</span> = Plan::get(<span class="hljs-variable">$createdPlan</span>->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>) {
|
||||
ResultPrinter::printError(<span class="hljs-string">"Updated the Plan Payment Definition"</span>, <span class="hljs-string">"Plan"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$patchRequest</span>, <span class="hljs-variable">$ex</span>);
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult(<span class="hljs-string">"Updated the Plan Payment Definition"</span>, <span class="hljs-string">"Plan"</span>, <span class="hljs-variable">$plan</span>->getId(), <span class="hljs-variable">$patchRequest</span>, <span class="hljs-variable">$plan</span>);
|
||||
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$plan</span>;</div></div></div></div></body></html>
|
||||
@@ -14,7 +14,7 @@ with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)<
|
||||
|
||||
<span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
|
||||
<span class="hljs-variable">$amt</span>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||
->setTotal(<span class="hljs-string">"1.00"</span>);
|
||||
->setTotal(<span class="hljs-number">1</span>);
|
||||
|
||||
<span class="hljs-comment">### Capture</span>
|
||||
<span class="hljs-variable">$capture</span> = <span class="hljs-keyword">new</span> Capture();
|
||||
|
||||
@@ -38,7 +38,7 @@ to correct setting. In this case, it would be 'authorize'</p></div></div
|
||||
|
||||
<span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
|
||||
<span class="hljs-variable">$amount</span>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||
->setTotal(<span class="hljs-string">"1.00"</span>);
|
||||
->setTotal(<span class="hljs-number">1</span>);
|
||||
|
||||
<span class="hljs-variable">$transaction</span> = <span class="hljs-keyword">new</span> Transaction();
|
||||
<span class="hljs-variable">$transaction</span>->setAmount(<span class="hljs-variable">$amount</span>)
|
||||
|
||||
@@ -37,29 +37,29 @@ information</p></div></div><div class="code"><div class="wrapper"><span class="h
|
||||
->setDescription(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
|
||||
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||
->setQuantity(<span class="hljs-number">1</span>)
|
||||
->setTax(<span class="hljs-string">'0.30'</span>)
|
||||
->setPrice(<span class="hljs-string">'7.50'</span>);
|
||||
->setTax(<span class="hljs-number">0.3</span>)
|
||||
->setPrice(<span class="hljs-number">7.50</span>);
|
||||
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
|
||||
<span class="hljs-variable">$item2</span>->setName(<span class="hljs-string">'Granola bars'</span>)
|
||||
->setDescription(<span class="hljs-string">'Granola Bars with Peanuts'</span>)
|
||||
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||
->setQuantity(<span class="hljs-number">5</span>)
|
||||
->setTax(<span class="hljs-string">'0.20'</span>)
|
||||
->setPrice(<span class="hljs-string">'2.00'</span>);
|
||||
->setTax(<span class="hljs-number">0.2</span>)
|
||||
->setPrice(<span class="hljs-number">2</span>);
|
||||
|
||||
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
|
||||
<span class="hljs-variable">$itemList</span>->setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
|
||||
<p>Use this optional field to set additional
|
||||
payment information such as tax, shipping
|
||||
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
|
||||
<span class="hljs-variable">$details</span>->setShipping(<span class="hljs-string">'1.20'</span>)
|
||||
->setTax(<span class="hljs-string">'1.30'</span>)
|
||||
->setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
|
||||
<span class="hljs-variable">$details</span>->setShipping(<span class="hljs-number">1.2</span>)
|
||||
->setTax(<span class="hljs-number">1.3</span>)
|
||||
->setSubtotal(<span class="hljs-number">17.5</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
|
||||
<p>Lets you specify a payment amount.
|
||||
You can also specify additional details
|
||||
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
|
||||
<span class="hljs-variable">$amount</span>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||
->setTotal(<span class="hljs-string">"20.00"</span>)
|
||||
->setTotal(<span class="hljs-number">20</span>)
|
||||
->setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
|
||||
<p>A transaction defines the contract of a
|
||||
payment - what is the payment for and who
|
||||
|
||||
@@ -19,26 +19,26 @@ information</p></div></div><div class="code"><div class="wrapper"><span class="h
|
||||
<span class="hljs-variable">$item1</span>->setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
|
||||
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||
->setQuantity(<span class="hljs-number">1</span>)
|
||||
->setPrice(<span class="hljs-string">'7.50'</span>);
|
||||
->setPrice(<span class="hljs-number">7.5</span>);
|
||||
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
|
||||
<span class="hljs-variable">$item2</span>->setName(<span class="hljs-string">'Granola bars'</span>)
|
||||
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||
->setQuantity(<span class="hljs-number">5</span>)
|
||||
->setPrice(<span class="hljs-string">'2.00'</span>);
|
||||
->setPrice(<span class="hljs-number">2</span>);
|
||||
|
||||
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
|
||||
<span class="hljs-variable">$itemList</span>->setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
|
||||
<p>Use this optional field to set additional
|
||||
payment information such as tax, shipping
|
||||
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
|
||||
<span class="hljs-variable">$details</span>->setShipping(<span class="hljs-string">'1.20'</span>)
|
||||
->setTax(<span class="hljs-string">'1.30'</span>)
|
||||
->setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
|
||||
<span class="hljs-variable">$details</span>->setShipping(<span class="hljs-number">1.2</span>)
|
||||
->setTax(<span class="hljs-number">1.3</span>)
|
||||
->setSubtotal(<span class="hljs-number">17.50</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
|
||||
<p>Lets you specify a payment amount.
|
||||
You can also specify additional details
|
||||
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
|
||||
<span class="hljs-variable">$amount</span>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||
->setTotal(<span class="hljs-string">"20.00"</span>)
|
||||
->setTotal(<span class="hljs-number">20</span>)
|
||||
->setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
|
||||
<p>A transaction defines the contract of a
|
||||
payment - what is the payment for and who
|
||||
|
||||
@@ -30,26 +30,26 @@ information</p></div></div><div class="code"><div class="wrapper"><span class="h
|
||||
<span class="hljs-variable">$item1</span>->setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
|
||||
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||
->setQuantity(<span class="hljs-number">1</span>)
|
||||
->setPrice(<span class="hljs-string">'7.50'</span>);
|
||||
->setPrice(<span class="hljs-number">7.5</span>);
|
||||
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
|
||||
<span class="hljs-variable">$item2</span>->setName(<span class="hljs-string">'Granola bars'</span>)
|
||||
->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||
->setQuantity(<span class="hljs-number">5</span>)
|
||||
->setPrice(<span class="hljs-string">'2.00'</span>);
|
||||
->setPrice(<span class="hljs-number">2</span>);
|
||||
|
||||
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
|
||||
<span class="hljs-variable">$itemList</span>->setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
|
||||
<p>Use this optional field to set additional
|
||||
payment information such as tax, shipping
|
||||
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
|
||||
<span class="hljs-variable">$details</span>->setShipping(<span class="hljs-string">'1.20'</span>)
|
||||
->setTax(<span class="hljs-string">'1.30'</span>)
|
||||
->setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
|
||||
<span class="hljs-variable">$details</span>->setShipping(<span class="hljs-number">1.2</span>)
|
||||
->setTax(<span class="hljs-number">1.3</span>)
|
||||
->setSubtotal(<span class="hljs-number">17.5</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
|
||||
<p>Lets you specify a payment amount.
|
||||
You can also specify additional details
|
||||
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
|
||||
<span class="hljs-variable">$amount</span>->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||
->setTotal(<span class="hljs-string">"20.00"</span>)
|
||||
->setTotal(<span class="hljs-number">20</span>)
|
||||
->setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
|
||||
<p>A transaction defines the contract of a
|
||||
payment - what is the payment for and who
|
||||
|
||||
@@ -12,7 +12,7 @@ has expired.</p></div></div><div class="code"><div class="wrapper"><span class="
|
||||
|
||||
<span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
|
||||
<span class="hljs-variable">$amount</span>->setCurrency(<span class="hljs-string">"USD"</span>);
|
||||
<span class="hljs-variable">$amount</span>->setTotal(<span class="hljs-string">"1.00"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorize-with-amount-being-reauthorized">Reauthorize with amount being reauthorized</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span>->setAmount(<span class="hljs-variable">$amount</span>);
|
||||
<span class="hljs-variable">$amount</span>->setTotal(<span class="hljs-number">1</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorize-with-amount-being-reauthorized">Reauthorize with amount being reauthorized</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span>->setAmount(<span class="hljs-variable">$amount</span>);
|
||||
|
||||
<span class="hljs-variable">$reAuthorization</span> = <span class="hljs-variable">$authorization</span>->reauthorize(<span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
|
||||
|
||||
@@ -13,7 +13,7 @@ API used: /v1/payments/sale/{sale-id}/refund</p></div></div><div class="code"><d
|
||||
and refunded fee (to Payee). Use the $amt->details
|
||||
field to mention fees refund details.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
|
||||
<span class="hljs-variable">$amt</span>->setCurrency(<span class="hljs-string">'USD'</span>)
|
||||
->setTotal(<span class="hljs-string">'0.01'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="refund-object">Refund object</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-variable">$refund</span> = <span class="hljs-keyword">new</span> Refund();
|
||||
->setTotal(<span class="hljs-number">0.01</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="refund-object">Refund object</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-variable">$refund</span> = <span class="hljs-keyword">new</span> Refund();
|
||||
<span class="hljs-variable">$refund</span>->setAmount(<span class="hljs-variable">$amt</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="sale">Sale</h3>
|
||||
<p>A sale transaction.
|
||||
Create a Sale object with the
|
||||
|
||||
@@ -167,6 +167,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-9 "><h5>Update Plan Payment Definitions/Amount</h5></div>
|
||||
<div class="col-md-3">
|
||||
<a href="billing/UpdatePlanPaymentDefinitions.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/billing/UpdatePlanPaymentDefinitions.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 Billing Plans</h5></div>
|
||||
|
||||
@@ -1,93 +1,91 @@
|
||||
{
|
||||
"description" : "This operation creates a billing plan with no charge models and minimal merchant preferences",
|
||||
"title" : "Billing Plan with no charge model and minimal merchant preferences",
|
||||
"runnable" : true,
|
||||
"operationId" : "plan.create",
|
||||
"user" : {
|
||||
"scopes" : ["https://uri.paypal.com/services/subscriptions" ]
|
||||
"description": "This operation creates a billing plan with no charge models and minimal merchant preferences",
|
||||
"title": "Billing Plan with no charge model and minimal merchant preferences",
|
||||
"runnable": true,
|
||||
"operationId": "plan.create",
|
||||
"user": {
|
||||
"scopes": ["https://uri.paypal.com/services/subscriptions"]
|
||||
},
|
||||
"credentials" : {
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"path" : "/v1/oauth/token",
|
||||
"clientId":"",
|
||||
"clientSecret":""
|
||||
"path": "/v1/oauth/token",
|
||||
"clientId": "",
|
||||
"clientSecret": ""
|
||||
}
|
||||
},
|
||||
"request" : {
|
||||
"path" : "v1/payments/billing-plans/",
|
||||
"method" :"POST",
|
||||
"headers" : {},
|
||||
"body" :
|
||||
{
|
||||
"name":"Plan with minimal merchant pref",
|
||||
"description":"Plan with one payment definition,minimal merchant preferences and no charge models",
|
||||
"type":"fixed",
|
||||
"payment_definitions":[
|
||||
{
|
||||
"name":"Payment Definition-1",
|
||||
"type":"REGULAR",
|
||||
"frequency":"MONTH",
|
||||
"frequency_interval":"2",
|
||||
"amount": {
|
||||
"value" : "100",
|
||||
"currency" : "USD"
|
||||
},
|
||||
"cycles":"12"
|
||||
"request": {
|
||||
"path": "v1/payments/billing-plans/",
|
||||
"method": "POST",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"name": "Plan with minimal merchant pref",
|
||||
"description": "Plan with one payment definition,minimal merchant preferences and no charge models",
|
||||
"type": "fixed",
|
||||
"payment_definitions": [
|
||||
{
|
||||
"name": "Payment Definition-1",
|
||||
"type": "REGULAR",
|
||||
"frequency": "MONTH",
|
||||
"frequency_interval": "2",
|
||||
"amount": {
|
||||
"value": "100",
|
||||
"currency": "USD"
|
||||
},
|
||||
"cycles": "12"
|
||||
|
||||
}
|
||||
],
|
||||
"merchant_preferences":{
|
||||
"return_url":"http://www.paypal.com",
|
||||
"cancel_url":"http://www.yahoo.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"merchant_preferences": {
|
||||
"return_url": "http://www.paypal.com",
|
||||
"cancel_url": "http://www.yahoo.com"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"response" : {
|
||||
"status" : "201 Created",
|
||||
"headers" : {},
|
||||
"body" :
|
||||
{
|
||||
"id": "P-1TV69435N82273154UPWDU4I",
|
||||
"state": "CREATED",
|
||||
"name": "Plan with minimal merchant pref",
|
||||
"description": "Plan with one payment definition,minimal merchant preferences and no charge models",
|
||||
"type": "FIXED",
|
||||
"payment_definitions": [
|
||||
{
|
||||
"id": "PD-62U12008P21526502UPWDU4I",
|
||||
"name": "Payment Definition-1",
|
||||
"type": "REGULAR",
|
||||
"frequency": "Month",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "100"
|
||||
},
|
||||
"charge_models": [],
|
||||
"cycles": "12",
|
||||
"frequency_interval": "2"
|
||||
}
|
||||
],
|
||||
"merchant_preferences": {
|
||||
"setup_fee": {
|
||||
"currency": "USD",
|
||||
"value": "0"
|
||||
},
|
||||
"max_fail_attempts": "0",
|
||||
"return_url": "http://www.paypal.com",
|
||||
"cancel_url": "http://www.yahoo.com",
|
||||
"auto_bill_amount": "NO",
|
||||
"initial_fail_amount_action": "CONTINUE"
|
||||
},
|
||||
"create_time": "2014-06-16T09:05:06.161Z",
|
||||
"update_time": "2014-06-16T09:05:06.161Z",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://localhost:12379/v1/payments/billing-plans/P-1TV69435N82273154UPWDU4I",
|
||||
"rel": "self",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
}
|
||||
"response": {
|
||||
"status": "201 Created",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"id": "P-1TV69435N82273154UPWDU4I",
|
||||
"state": "CREATED",
|
||||
"name": "Plan with minimal merchant pref",
|
||||
"description": "Plan with one payment definition,minimal merchant preferences and no charge models",
|
||||
"type": "FIXED",
|
||||
"payment_definitions": [
|
||||
{
|
||||
"id": "PD-62U12008P21526502UPWDU4I",
|
||||
"name": "Payment Definition-1",
|
||||
"type": "REGULAR",
|
||||
"frequency": "Month",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "100"
|
||||
},
|
||||
"charge_models": [],
|
||||
"cycles": "12",
|
||||
"frequency_interval": "2"
|
||||
}
|
||||
],
|
||||
"merchant_preferences": {
|
||||
"setup_fee": {
|
||||
"currency": "USD",
|
||||
"value": "0"
|
||||
},
|
||||
"max_fail_attempts": "0",
|
||||
"return_url": "http://www.paypal.com",
|
||||
"cancel_url": "http://www.yahoo.com",
|
||||
"auto_bill_amount": "NO",
|
||||
"initial_fail_amount_action": "CONTINUE"
|
||||
},
|
||||
"create_time": "2014-06-16T09:05:06.161Z",
|
||||
"update_time": "2014-06-16T09:05:06.161Z",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://localhost:12379/v1/payments/billing-plans/P-1TV69435N82273154UPWDU4I",
|
||||
"rel": "self",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,116 +1,115 @@
|
||||
{
|
||||
"description" : "This operation fetches billing plan details cooresponding to the id.",
|
||||
"title" : "Fetch billing plan details",
|
||||
"runnable" : true,
|
||||
"operationId" : "plan.get",
|
||||
"user" : {
|
||||
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
|
||||
"description": "This operation fetches billing plan details cooresponding to the id.",
|
||||
"title": "Fetch billing plan details",
|
||||
"runnable": true,
|
||||
"operationId": "plan.get",
|
||||
"user": {
|
||||
"scopes": ["https://uri.paypal.com/services/subscriptions"]
|
||||
},
|
||||
"credentials" : {
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"path" : "/v1/oauth/token",
|
||||
"clientId":"",
|
||||
"clientSecret":""
|
||||
"path": "/v1/oauth/token",
|
||||
"clientId": "",
|
||||
"clientSecret": ""
|
||||
}
|
||||
},
|
||||
"request" : {
|
||||
"path" : "v1/payments/billing-plans/P-7DC96732KA7763723UOPKETA",
|
||||
"method" : "GET",
|
||||
"headers" : {},
|
||||
"body" : {}
|
||||
"request": {
|
||||
"path": "v1/payments/billing-plans/P-7DC96732KA7763723UOPKETA",
|
||||
"method": "GET",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
},
|
||||
"response" : {
|
||||
"status" : "200 OK",
|
||||
"headers" : {},
|
||||
"body" :
|
||||
{
|
||||
"id": "P-7DC96732KA7763723UOPKETA",
|
||||
"state": "CREATED",
|
||||
"name": "Sample Plan",
|
||||
"description": "Plan with regular and trial",
|
||||
"type": "FIXED",
|
||||
"payment_definitions": [
|
||||
{
|
||||
"id": "PD-03223056L66578712UOPKETA",
|
||||
"name": "Trial Payment Definition",
|
||||
"type": "TRIAL",
|
||||
"frequency": "Week",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "9.19"
|
||||
},
|
||||
"charge_models": [
|
||||
{
|
||||
"id": "CHM-6JY06508UT8026625UOPKETA",
|
||||
"type": "TAX",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "CHM-7XN63093LF858372XUOPKETA",
|
||||
"type": "SHIPPING",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"cycles": "2",
|
||||
"frequency_interval": "5"
|
||||
},
|
||||
{
|
||||
"id": "PD-0MF87809KK310750TUOPKETA",
|
||||
"name": "Regular Payment Definition",
|
||||
"type": "REGULAR",
|
||||
"frequency": "Month",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "100"
|
||||
},
|
||||
"charge_models": [
|
||||
{
|
||||
"id": "CHM-1V202179WT9709019UOPKETA",
|
||||
"type": "TAX",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "12"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "CHM-89H01708244053321UOPKETA",
|
||||
"type": "SHIPPING",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "10"
|
||||
}
|
||||
}
|
||||
],
|
||||
"cycles": "12",
|
||||
"frequency_interval": "2"
|
||||
}
|
||||
],
|
||||
"merchant_preferences": {
|
||||
"setup_fee": {
|
||||
"currency": "USD",
|
||||
"value": "1"
|
||||
},
|
||||
"max_fail_attempts": "0",
|
||||
"return_url": "http://www.paypal.com",
|
||||
"cancel_url": "http://www.yahoo.com",
|
||||
"auto_bill_amount": "YES",
|
||||
"initial_fail_amount_action": "CONTINUE"
|
||||
},
|
||||
"create_time": "2014-06-16T07:40:20.940Z",
|
||||
"update_time": "2014-06-16T07:40:20.940Z",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://localhost:12379/v1/payments/billing-plans/P-7DC96732KA7763723UOPKETA",
|
||||
"rel": "self",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
}
|
||||
"response": {
|
||||
"status": "200 OK",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"id": "P-7DC96732KA7763723UOPKETA",
|
||||
"state": "CREATED",
|
||||
"name": "Sample Plan",
|
||||
"description": "Plan with regular and trial",
|
||||
"type": "FIXED",
|
||||
"payment_definitions": [
|
||||
{
|
||||
"id": "PD-03223056L66578712UOPKETA",
|
||||
"name": "Trial Payment Definition",
|
||||
"type": "TRIAL",
|
||||
"frequency": "Week",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "9.19"
|
||||
},
|
||||
"charge_models": [
|
||||
{
|
||||
"id": "CHM-6JY06508UT8026625UOPKETA",
|
||||
"type": "TAX",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "CHM-7XN63093LF858372XUOPKETA",
|
||||
"type": "SHIPPING",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"cycles": "2",
|
||||
"frequency_interval": "5"
|
||||
},
|
||||
{
|
||||
"id": "PD-0MF87809KK310750TUOPKETA",
|
||||
"name": "Regular Payment Definition",
|
||||
"type": "REGULAR",
|
||||
"frequency": "Month",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "100"
|
||||
},
|
||||
"charge_models": [
|
||||
{
|
||||
"id": "CHM-1V202179WT9709019UOPKETA",
|
||||
"type": "TAX",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "12"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "CHM-89H01708244053321UOPKETA",
|
||||
"type": "SHIPPING",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "10"
|
||||
}
|
||||
}
|
||||
],
|
||||
"cycles": "12",
|
||||
"frequency_interval": "2"
|
||||
}
|
||||
],
|
||||
"merchant_preferences": {
|
||||
"setup_fee": {
|
||||
"currency": "USD",
|
||||
"value": "1"
|
||||
},
|
||||
"max_fail_attempts": "0",
|
||||
"return_url": "http://www.paypal.com",
|
||||
"cancel_url": "http://www.yahoo.com",
|
||||
"auto_bill_amount": "YES",
|
||||
"initial_fail_amount_action": "CONTINUE"
|
||||
},
|
||||
"create_time": "2014-06-16T07:40:20.940Z",
|
||||
"update_time": "2014-06-16T07:40:20.940Z",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://localhost:12379/v1/payments/billing-plans/P-7DC96732KA7763723UOPKETA",
|
||||
"rel": "self",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +1,86 @@
|
||||
{
|
||||
"description" : "This operation fetches billing plan list",
|
||||
"title" : "Billing Plan list",
|
||||
"runnable" : true,
|
||||
"operationId" : "plans",
|
||||
"user" : {
|
||||
"scopes" : ["https://uri.paypal.com/services/subscriptions" ]
|
||||
"description": "This operation fetches billing plan list",
|
||||
"title": "Billing Plan list",
|
||||
"runnable": true,
|
||||
"operationId": "plans",
|
||||
"user": {
|
||||
"scopes": ["https://uri.paypal.com/services/subscriptions"]
|
||||
},
|
||||
"credentials" : {
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"path" : "/v1/oauth/token",
|
||||
"clientId":"",
|
||||
"clientSecret":""
|
||||
"path": "/v1/oauth/token",
|
||||
"clientId": "",
|
||||
"clientSecret": ""
|
||||
}
|
||||
},
|
||||
"request" : {
|
||||
"path" : "v1/payments/billing-plans?page_size=3&status=ACTIVE&page_size=2&page=1&total_required=yes",
|
||||
"method" : "GET",
|
||||
"headers" : {},
|
||||
"body" : {}
|
||||
"request": {
|
||||
"path": "v1/payments/billing-plans?page_size=3&status=ACTIVE&page_size=2&page=1&total_required=yes",
|
||||
"method": "GET",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
},
|
||||
"response" : {
|
||||
"status" : "200 OK",
|
||||
"headers" : {},
|
||||
"body" :
|
||||
{
|
||||
"total_items": "166",
|
||||
"total_pages": "83",
|
||||
"plans": [
|
||||
{
|
||||
"id": "P-7DC96732KA7763723UOPKETA",
|
||||
"state": "ACTIVE",
|
||||
"name": "Testing1-Regular3",
|
||||
"description": "Create Plan for Regular",
|
||||
"type": "FIXED",
|
||||
"create_time": "2014-08-22T04:41:52.836Z",
|
||||
"update_time": "2014-08-22T04:41:53.169Z",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans/P-6EM196669U062173D7QCVDRA",
|
||||
"rel": "self",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "P-83567698LH138572V7QCVZJY",
|
||||
"state": "ACTIVE",
|
||||
"name": "Testing1-Regular4",
|
||||
"description": "Create Plan for Regular",
|
||||
"type": "INFINITE",
|
||||
"create_time": "2014-08-22T04:41:55.623Z",
|
||||
"update_time": "2014-08-22T04:41:56.055Z",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans/P-83567698LH138572V7QCVZJY",
|
||||
"rel": "self",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=1&start=3&status=active",
|
||||
"rel": "start",
|
||||
"method": "GET"
|
||||
},
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=0&status=active",
|
||||
"rel": "previous_page",
|
||||
"method": "GET"
|
||||
},
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=2&status=active",
|
||||
"rel": "next_page",
|
||||
"method": "GET"
|
||||
},
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=82&status=active",
|
||||
"rel": "last",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
"response": {
|
||||
"status": "200 OK",
|
||||
"headers": {},
|
||||
"body": {
|
||||
"total_items": "166",
|
||||
"total_pages": "83",
|
||||
"plans": [
|
||||
{
|
||||
"id": "P-7DC96732KA7763723UOPKETA",
|
||||
"state": "ACTIVE",
|
||||
"name": "Testing1-Regular3",
|
||||
"description": "Create Plan for Regular",
|
||||
"type": "FIXED",
|
||||
"create_time": "2014-08-22T04:41:52.836Z",
|
||||
"update_time": "2014-08-22T04:41:53.169Z",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans/P-6EM196669U062173D7QCVDRA",
|
||||
"rel": "self",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "P-83567698LH138572V7QCVZJY",
|
||||
"state": "ACTIVE",
|
||||
"name": "Testing1-Regular4",
|
||||
"description": "Create Plan for Regular",
|
||||
"type": "INFINITE",
|
||||
"create_time": "2014-08-22T04:41:55.623Z",
|
||||
"update_time": "2014-08-22T04:41:56.055Z",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans/P-83567698LH138572V7QCVZJY",
|
||||
"rel": "self",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=1&start=3&status=active",
|
||||
"rel": "start",
|
||||
"method": "GET"
|
||||
},
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=0&status=active",
|
||||
"rel": "previous_page",
|
||||
"method": "GET"
|
||||
},
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=2&status=active",
|
||||
"rel": "next_page",
|
||||
"method": "GET"
|
||||
},
|
||||
{
|
||||
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=82&status=active",
|
||||
"rel": "last",
|
||||
"method": "GET"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +1,39 @@
|
||||
{
|
||||
"description" : "Patch operation for changing merchant preferences values",
|
||||
"title" : "Patch Operation for changing merchant preferences",
|
||||
"runnable" : true,
|
||||
"operationId" : "plan.update",
|
||||
"user" : {
|
||||
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
|
||||
"description": "Patch operation for changing merchant preferences values",
|
||||
"title": "Patch Operation for changing merchant preferences",
|
||||
"runnable": true,
|
||||
"operationId": "plan.update",
|
||||
"user": {
|
||||
"scopes": ["https://uri.paypal.com/services/subscriptions"]
|
||||
},
|
||||
"credentials" : {
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"path" : "/v1/oauth/token",
|
||||
"clientId":"",
|
||||
"clientSecret":""
|
||||
"path": "/v1/oauth/token",
|
||||
"clientId": "",
|
||||
"clientSecret": ""
|
||||
}
|
||||
},
|
||||
"request" : {
|
||||
"path" : "v1/payments/billing-plans/{PLAN-ID}/",
|
||||
"method" : "PATCH",
|
||||
"headers" : {},
|
||||
"body" :
|
||||
[
|
||||
{
|
||||
"op":"replace",
|
||||
"path":"/merchant-preferences",
|
||||
"value" : {
|
||||
"cancel_url":"http://www.cancel.com",
|
||||
"setup_fee": {
|
||||
"value" :"5",
|
||||
"currency" : "USD"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"response" : {
|
||||
"status" : "200 OK",
|
||||
"headers" : {},
|
||||
"body" : { }
|
||||
"request": {
|
||||
"path": "v1/payments/billing-plans/{PLAN-ID}/",
|
||||
"method": "PATCH",
|
||||
"headers": {},
|
||||
"body": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/merchant-preferences",
|
||||
"value": {
|
||||
"cancel_url": "http://www.cancel.com",
|
||||
"setup_fee": {
|
||||
"value": "5",
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": "200 OK",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,40 @@
|
||||
{
|
||||
"description" : "Patch operation for changing payment definition values",
|
||||
"title" : "Patch operation for payment definition",
|
||||
"runnable" : true,
|
||||
"operationId" : "plan.update",
|
||||
"user" : {
|
||||
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
|
||||
"description": "Patch operation for changing payment definition values",
|
||||
"title": "Patch operation for payment definition",
|
||||
"runnable": true,
|
||||
"operationId": "plan.update",
|
||||
"user": {
|
||||
"scopes": ["https://uri.paypal.com/services/subscriptions"]
|
||||
},
|
||||
"credentials" : {
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"path" : "/v1/oauth/token",
|
||||
"clientId":"",
|
||||
"clientSecret":""
|
||||
"path": "/v1/oauth/token",
|
||||
"clientId": "",
|
||||
"clientSecret": ""
|
||||
}
|
||||
},
|
||||
"request" : {
|
||||
"path" : "v1/payments/billing-plans/{PLAN-ID}/",
|
||||
"method" : "PATCH",
|
||||
"headers" : {},
|
||||
"body" :
|
||||
[
|
||||
{
|
||||
"op":"replace",
|
||||
"path":"/payment-definitions/PD-4816080302132415WUQBT7WA",
|
||||
"value" : {
|
||||
"name": "Updated Payment Definition",
|
||||
"frequency": "Day",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"request": {
|
||||
"path": "v1/payments/billing-plans/{PLAN-ID}/",
|
||||
"method": "PATCH",
|
||||
"headers": {},
|
||||
"body": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/payment-definitions/PD-4816080302132415WUQBT7WA",
|
||||
"value": {
|
||||
"name": "Updated Payment Definition",
|
||||
"frequency": "Day",
|
||||
"amount": {
|
||||
"currency": "USD",
|
||||
"value": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"response" : {
|
||||
"status" : "200 OK",
|
||||
"headers" : {},
|
||||
"body" : { }
|
||||
"response": {
|
||||
"status": "200 OK",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
{
|
||||
"description" : "This operation changes the state of billing plan to active if its in created state.",
|
||||
"title" : "Patch Request for changing state",
|
||||
"runnable" : true,
|
||||
"operationId" : "plan.update",
|
||||
"user" : {
|
||||
"scopes" : ["https://uri.paypal.com/services/subscriptions" ]
|
||||
"description": "This operation changes the state of billing plan to active if its in created state.",
|
||||
"title": "Patch Request for changing state",
|
||||
"runnable": true,
|
||||
"operationId": "plan.update",
|
||||
"user": {
|
||||
"scopes": ["https://uri.paypal.com/services/subscriptions"]
|
||||
},
|
||||
"credentials" : {
|
||||
"credentials": {
|
||||
"oauth": {
|
||||
"path" : "/v1/oauth/token",
|
||||
"clientId":"",
|
||||
"clientSecret":""
|
||||
"path": "/v1/oauth/token",
|
||||
"clientId": "",
|
||||
"clientSecret": ""
|
||||
}
|
||||
},
|
||||
"request" : {
|
||||
"path" : "v1/payments/billing-plans/{PLAN-ID}/",
|
||||
"method" : "PATCH",
|
||||
"headers" : {},
|
||||
"body" :
|
||||
[
|
||||
{
|
||||
"op":"replace",
|
||||
"path":"/",
|
||||
"value":{
|
||||
"state":"ACTIVE"
|
||||
}
|
||||
}
|
||||
]
|
||||
"request": {
|
||||
"path": "v1/payments/billing-plans/{PLAN-ID}/",
|
||||
"method": "PATCH",
|
||||
"headers": {},
|
||||
"body": [
|
||||
{
|
||||
"op": "replace",
|
||||
"path": "/",
|
||||
"value": {
|
||||
"state": "ACTIVE"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"response" : {
|
||||
"status" : "200 OK",
|
||||
"headers" : {},
|
||||
"body" : { }
|
||||
"response": {
|
||||
"status": "200 OK",
|
||||
"headers": {},
|
||||
"body": {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user