forked from LiveCarta/PayPal-PHP-SDK
Updates to Sample Docs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
<p>This sample code demonstrate how you can create a billing agreement, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#create-an-agreement">https://developer.paypal.com/webapps/developer/docs/api/#create-an-agreement</a>
|
||||
API used: /v1/payments/billing-agreements</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Plan from the Create Update Sample. This would be used to
|
||||
define Plan information to create an agreement. Make sure the plan you are using is in active state.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Plan $createdPlan */</span>
|
||||
define Plan information to create an agreement. Make sure the plan you are using is in active state.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Plan $createdPlan */</span>
|
||||
<span class="hljs-variable">$createdPlan</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'UpdatePlan.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>;
|
||||
@@ -31,7 +31,7 @@ define Plan information to create an agreement. Make sure the plan you are using
|
||||
"payer": {
|
||||
"payment_method": "credit_card",
|
||||
"payer_info": {
|
||||
"email": "jaypatel512-facilitator@hotmail.com"
|
||||
"email": "jaypatel512-facilitator<span class="hljs-doctag">@hotmail</span>.com"
|
||||
},
|
||||
"funding_instruments": [
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>This sample code demonstrate how you can create a billing agreement, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#create-an-agreement">https://developer.paypal.com/webapps/developer/docs/api/#create-an-agreement</a>
|
||||
API used: /v1/payments/billing-agreements</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Plan from the Create Update Sample. This would be used to
|
||||
define Plan information to create an agreement. Make sure the plan you are using is in active state.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Plan $createdPlan */</span>
|
||||
define Plan information to create an agreement. Make sure the plan you are using is in active state.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Plan $createdPlan */</span>
|
||||
<span class="hljs-variable">$createdPlan</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'UpdatePlan.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/DeletePlan</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/DeletePlan"><meta name="groc-project-path" content="billing/DeletePlan.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/DeletePlan.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="delete-plan-sample">Delete Plan Sample</h1>
|
||||
<p>This sample code demonstrate how you can delete a billing plan, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-plan">https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-plan</a>
|
||||
API used: /v1/payments/billing-plans</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Plan object from Create Plan Sample</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Plan $createdPlan */</span>
|
||||
API used: /v1/payments/billing-plans</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Plan object from Create Plan Sample</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@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>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/GetBillingAgreement</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/GetBillingAgreement"><meta name="groc-project-path" content="billing/GetBillingAgreement.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/GetBillingAgreement.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="get-billing-agreement-sample">Get Billing Agreement Sample</h1>
|
||||
<p>This sample code demonstrate how you can get a billing agreement, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#retrieve-an-agreement">https://developer.paypal.com/webapps/developer/docs/api/#retrieve-an-agreement</a>
|
||||
API used: /v1/payments/billing-agreements/<Agreement-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Create Agreement From Credit Card Sample</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Agreement $createdAgreement */</span>
|
||||
API used: /v1/payments/billing-agreements/<Agreement-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Create Agreement From Credit Card Sample</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Agreement $createdAgreement */</span>
|
||||
<span class="hljs-variable">$createdAgreement</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateBillingAgreementWithCreditCard.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/GetPlan</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/GetPlan"><meta name="groc-project-path" content="billing/GetPlan.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/GetPlan.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="get-plan-sample">Get Plan Sample</h1>
|
||||
<p>This sample code demonstrate how you can get a billing plan, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-plan">https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-plan</a>
|
||||
API used: /v1/payments/billing-plans</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Plan object from Create Plan Sample</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Plan $createdPlan */</span>
|
||||
API used: /v1/payments/billing-plans</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Plan object from Create Plan Sample</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@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>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/ListPlans</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/ListPlans"><meta name="groc-project-path" content="billing/ListPlans.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/ListPlans.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="get-list-of-plan-sample">Get List of Plan Sample</h1>
|
||||
<p>This sample code demonstrate how you can get a list of billing plan, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#list-plans">https://developer.paypal.com/webapps/developer/docs/api/#list-plans</a>
|
||||
API used: /v1/payments/billing-plans</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>
|
||||
API used: /v1/payments/billing-plans</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-doctag">@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>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/ReactivateBillingAgreement</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/ReactivateBillingAgreement"><meta name="groc-project-path" content="billing/ReactivateBillingAgreement.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/ReactivateBillingAgreement.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="reactivate-an-agreement">Reactivate an agreement</h1>
|
||||
<p>This sample code demonstrate how you can reactivate a billing agreement, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#suspend-an-agreement">https://developer.paypal.com/webapps/developer/docs/api/#suspend-an-agreement</a>
|
||||
API used: /v1/payments/billing-agreements/<Agreement-Id>/suspend</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Suspend Agreement Sample to demonstrate the List</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Agreement $suspendedAgreement */</span>
|
||||
API used: /v1/payments/billing-agreements/<Agreement-Id>/suspend</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Suspend Agreement Sample to demonstrate the List</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Agreement $suspendedAgreement */</span>
|
||||
<span class="hljs-variable">$suspendedAgreement</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'SuspendBillingAgreement.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/SearchBillingTransactions</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/SearchBillingTransactions"><meta name="groc-project-path" content="billing/SearchBillingTransactions.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/SearchBillingTransactions.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="search-billing-transactions-sample">Search Billing Transactions Sample</h1>
|
||||
<p>This sample code demonstrate how you can search all billing transactions, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#search-for-transactions">https://developer.paypal.com/webapps/developer/docs/api/#search-for-transactions</a>
|
||||
API used: GET /v1/payments/billing-agreements/<Agreement-Id>/transactions? start-date=yyyy-mm-dd&end-date=yyyy-mm-dd</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Get Billing Agreement. This may not be necessary if you are trying to search for transactions of already created Agreement.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Agreement $agreement */</span>
|
||||
API used: GET /v1/payments/billing-agreements/<Agreement-Id>/transactions? start-date=yyyy-mm-dd&end-date=yyyy-mm-dd</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Get Billing Agreement. This may not be necessary if you are trying to search for transactions of already created Agreement.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Agreement $agreement */</span>
|
||||
<span class="hljs-variable">$agreement</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetBillingAgreement.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Replace this with your AgreementId to search transactions based on your agreement.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$agreementId</span> = <span class="hljs-variable">$agreement</span>->getId();
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Adding Params to search transaction within a given time frame.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$params</span> = <span class="hljs-keyword">array</span>(<span class="hljs-string">'start_date'</span> => date(<span class="hljs-string">'Y-m-d'</span>, strtotime(<span class="hljs-string">'-15 years'</span>)), <span class="hljs-string">'end_date'</span> => date(<span class="hljs-string">'Y-m-d'</span>, strtotime(<span class="hljs-string">'+5 days'</span>)));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/SuspendBillingAgreement</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/SuspendBillingAgreement"><meta name="groc-project-path" content="billing/SuspendBillingAgreement.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/SuspendBillingAgreement.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="suspend-an-agreement">Suspend an agreement</h1>
|
||||
<p>This sample code demonstrate how you can suspend a billing agreement, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#suspend-an-agreement">https://developer.paypal.com/webapps/developer/docs/api/#suspend-an-agreement</a>
|
||||
API used: /v1/payments/billing-agreements/<Agreement-Id>/suspend</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Create Agreement Sample to demonstrate the List</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Agreement $createdAgreement */</span>
|
||||
API used: /v1/payments/billing-agreements/<Agreement-Id>/suspend</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Create Agreement Sample to demonstrate the List</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Agreement $createdAgreement */</span>
|
||||
<span class="hljs-variable">$createdAgreement</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateBillingAgreementWithCreditCard.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>billing/UpdateBillingAgreement</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/UpdateBillingAgreement"><meta name="groc-project-path" content="billing/UpdateBillingAgreement.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/UpdateBillingAgreement.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-an-agreement">Update an agreement</h1>
|
||||
<p>This sample code demonstrate how you can update a billing agreement, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#update-an-agreement">https://developer.paypal.com/webapps/developer/docs/api/#update-an-agreement</a>
|
||||
API used: /v1/payments/billing-agreements/<Agreement-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Create Agreement Sample to demonstrate the List</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Agreement $createdAgreement */</span>
|
||||
API used: /v1/payments/billing-agreements/<Agreement-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Agreement object from Create Agreement Sample to demonstrate the List</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Agreement $createdAgreement */</span>
|
||||
<span class="hljs-variable">$createdAgreement</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateBillingAgreementWithCreditCard.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<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="making-plan-active">Making Plan Active</h3>
|
||||
<p>This example demonstrate how you could activate the Plan.</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>
|
||||
<p>This example demonstrate how you could activate the Plan.</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-doctag">@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">Patch</span>;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<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>
|
||||
<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-doctag">@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">Patch</span>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/CancelInvoice</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="invoice/CancelInvoice"><meta name="groc-project-path" content="invoice/CancelInvoice.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">invoice/CancelInvoice.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="cancel-invoice-sample">Cancel Invoice Sample</h1>
|
||||
<p>This sample code demonstrate how you can cancel
|
||||
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'SendInvoice.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CancelNotification</span>;
|
||||
|
||||
75
sample/doc/invoice/CreateThirdPartyInvoice.html
Normal file
75
sample/doc/invoice/CreateThirdPartyInvoice.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/CreateThirdPartyInvoice</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="invoice/CreateThirdPartyInvoice"><meta name="groc-project-path" content="invoice/CreateThirdPartyInvoice.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">invoice/CreateThirdPartyInvoice.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="create-third-party-invoice-sample">Create Third Party Invoice Sample</h1>
|
||||
<p>This sample code demonstrate how you can create third party invoice on someone else's behalf.
|
||||
This requires using <code>Obtain User's Consent</code> to fetch the refresh token of the third party merchant. Please look at <a href="http://paypal.github.io/PayPal-PHP-SDK/sample/doc/lipp/ObtainUserConsent.html">http://paypal.github.io/PayPal-PHP-SDK/sample/doc/lipp/ObtainUserConsent.html</a> for more info.
|
||||
You need the email address of the third party. This can be retrieved using the refresh token obtained from previous call. Please refere to <a href="http://paypal.github.io/PayPal-PHP-SDK/sample/doc/lipp/GetUserInfo.html">http://paypal.github.io/PayPal-PHP-SDK/sample/doc/lipp/GetUserInfo.html</a> for more info.
|
||||
Please make sure to use <code>merchantInfo.email</code> as the email address of the third party.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">BillingInfo</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Currency</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">InvoiceAddress</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">InvoiceItem</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">MerchantInfo</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PaymentTerm</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ShippingInfo</span>;
|
||||
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">new</span> Invoice();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="invoice-info">Invoice Info</h3>
|
||||
<p>Fill in all the information that is
|
||||
required for invoice APIs</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>
|
||||
->setMerchantInfo(<span class="hljs-keyword">new</span> MerchantInfo())
|
||||
->setBillingInfo(<span class="hljs-keyword">array</span>(<span class="hljs-keyword">new</span> BillingInfo()))
|
||||
->setNote(<span class="hljs-string">"Medical Invoice 16 Jul, 2013 PST"</span>)
|
||||
->setPaymentTerm(<span class="hljs-keyword">new</span> PaymentTerm());</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="merchant-info">Merchant Info</h3>
|
||||
<p>A resource representing merchant information that can be
|
||||
used to identify merchant</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>->getMerchantInfo()</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>This would be the email address of third party merchant.</p></div></div><div class="code"><div class="wrapper"> ->setEmail(<span class="hljs-string">"developer@sample.com"</span>)
|
||||
->setFirstName(<span class="hljs-string">"Dennis"</span>)
|
||||
->setLastName(<span class="hljs-string">"Doctor"</span>)
|
||||
->setbusinessName(<span class="hljs-string">"Medical Professionals, LLC"</span>)
|
||||
->setAddress(<span class="hljs-keyword">new</span> InvoiceAddress());</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="address-information">Address Information</h3>
|
||||
<p>The address used for creating the invoice</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>->getMerchantInfo()->getAddress()
|
||||
->setLine1(<span class="hljs-string">"1234 Main St."</span>)
|
||||
->setCity(<span class="hljs-string">"Portland"</span>)
|
||||
->setState(<span class="hljs-string">"OR"</span>)
|
||||
->setPostalCode(<span class="hljs-string">"97217"</span>)
|
||||
->setCountryCode(<span class="hljs-string">"US"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="billing-information">Billing Information</h3>
|
||||
<p>Set the email address for each billing</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$billing</span> = <span class="hljs-variable">$invoice</span>->getBillingInfo();
|
||||
<span class="hljs-variable">$billing</span>[<span class="hljs-number">0</span>]
|
||||
->setEmail(<span class="hljs-string">"sample@buy.com"</span>);
|
||||
|
||||
<span class="hljs-variable">$billing</span>[<span class="hljs-number">0</span>]->setBusinessName(<span class="hljs-string">"Jay Inc"</span>)
|
||||
->setAdditionalInfo(<span class="hljs-string">"This is the billing Info"</span>)
|
||||
->setAddress(<span class="hljs-keyword">new</span> InvoiceAddress());
|
||||
|
||||
<span class="hljs-variable">$billing</span>[<span class="hljs-number">0</span>]->getAddress()
|
||||
->setLine1(<span class="hljs-string">"1234 Main St."</span>)
|
||||
->setCity(<span class="hljs-string">"Portland"</span>)
|
||||
->setState(<span class="hljs-string">"OR"</span>)
|
||||
->setPostalCode(<span class="hljs-string">"97217"</span>)
|
||||
->setCountryCode(<span class="hljs-string">"US"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="items-list">Items List</h3>
|
||||
<p>You could provide the list of all items for
|
||||
detailed breakdown of invoice</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$items</span> = <span class="hljs-keyword">array</span>();
|
||||
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>] = <span class="hljs-keyword">new</span> InvoiceItem();
|
||||
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>]
|
||||
->setName(<span class="hljs-string">"Sutures"</span>)
|
||||
->setQuantity(<span class="hljs-number">100</span>)
|
||||
->setUnitPrice(<span class="hljs-keyword">new</span> Currency());
|
||||
|
||||
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>]->getUnitPrice()
|
||||
->setCurrency(<span class="hljs-string">"USD"</span>)
|
||||
->setValue(<span class="hljs-number">5</span>);
|
||||
|
||||
<span class="hljs-variable">$invoice</span>->getPaymentTerm()
|
||||
->setTermType(<span class="hljs-string">"NET_45"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>For Sample Purposes Only.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$request</span> = <span class="hljs-keyword">clone</span> <span class="hljs-variable">$invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>This would be refresh token retrieved from <a href="http://paypal.github.io/PayPal-PHP-SDK/sample/doc/lipp/ObtainUserConsent.html">http://paypal.github.io/PayPal-PHP-SDK/sample/doc/lipp/ObtainUserConsent.html</a></p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$refreshToken</span> = <span class="hljs-string">"SCNWVZfdg43XaOmoEicazpkXyda32CGnP208EkuQ_QBIrXCYMhlvORFHHyoXPT0VbEMIHYVJEm0gVf1Vf72YgJzPScBenKoVPq__y1QRT7wwJo3WYADwUW4Q5ic"</span>;
|
||||
|
||||
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="use-refresh-token-make-sure-to-update-merchantinfo-email-based-on">Use Refresh Token. MAKE SURE TO update <code>MerchantInfo.Email</code> based on</h3></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoice</span>->updateAccessToken(<span class="hljs-variable">$refreshToken</span>, <span class="hljs-variable">$apiContext</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-invoice">Create Invoice</h3>
|
||||
<p>Create an invoice by calling the invoice->create() method
|
||||
with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoice</span>->create(<span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"Create Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$request</span>, <span class="hljs-variable">$ex</span>);
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printResult(<span class="hljs-string">"Create Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-variable">$invoice</span>->getId(), <span class="hljs-variable">$request</span>, <span class="hljs-variable">$invoice</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="send-invoice">Send Invoice</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="send-invoice">Send Invoice</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoice</span>->send(<span class="hljs-variable">$apiContext</span>);
|
||||
<span class="hljs-variable">$invoice</span> = Invoice::get(<span class="hljs-variable">$invoice</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>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"Send Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$request</span>, <span class="hljs-variable">$ex</span>);
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper">ResultPrinter::printResult(<span class="hljs-string">"Send Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-variable">$invoice</span>->getId(), <span class="hljs-variable">$request</span>, <span class="hljs-variable">$invoice</span>);
|
||||
|
||||
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$invoice</span>;</div></div></div></div></body></html>
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/DeleteInvoice</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="invoice/DeleteInvoice"><meta name="groc-project-path" content="invoice/DeleteInvoice.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">invoice/DeleteInvoice.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="delete-invoice-sample">Delete Invoice Sample</h1>
|
||||
<p>This sample code demonstrate how you can delete
|
||||
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/GetInvoice</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="invoice/GetInvoice"><meta name="groc-project-path" content="invoice/GetInvoice.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">invoice/GetInvoice.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="get-invoice-sample">Get Invoice Sample</h1>
|
||||
<p>This sample code demonstrate how you can retrieve
|
||||
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/ListInvoice</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="invoice/ListInvoice"><meta name="groc-project-path" content="invoice/ListInvoice.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">invoice/ListInvoice.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="list-invoices-sample">List Invoices Sample</h1>
|
||||
<p>This sample code demonstrate how you can get
|
||||
all invoice from history.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
all invoice from history.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/RecordPayment</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="invoice/RecordPayment"><meta name="groc-project-path" content="invoice/RecordPayment.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">invoice/RecordPayment.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="record-payment-sample">Record Payment Sample</h1>
|
||||
<p>This sample code demonstrate how you can record
|
||||
an invoice as paid.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
an invoice as paid.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'SendInvoice.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/RecordRefund</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="invoice/RecordRefund"><meta name="groc-project-path" content="invoice/RecordRefund.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">invoice/RecordRefund.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="record-refund-sample">Record Refund Sample</h1>
|
||||
<p>This sample code demonstrate how you can record
|
||||
an invoice as refunded.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
an invoice as refunded.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'RecordPayment.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/RemindInvoice</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="invoice/RemindInvoice"><meta name="groc-project-path" content="invoice/RemindInvoice.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">invoice/RemindInvoice.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="remind-invoice-sample">Remind Invoice Sample</h1>
|
||||
<p>This sample code demonstrate how you can remind
|
||||
an invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
an invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'SendInvoice.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/RetrieveQRCode</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="invoice/RetrieveQRCode"><meta name="groc-project-path" content="invoice/RetrieveQRCode.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">invoice/RetrieveQRCode.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="retrieve-qr-code-for-invoice-sample">Retrieve QR Code for Invoice Sample</h1>
|
||||
<p>Specify an invoice ID to get a QR code (image) that corresponds to the invoice ID. A QR code for an invoice can be added to a paper or PDF invoice. When a customer uses their mobile device to scan the QR code, the customer is redirected to the PayPal mobile payment flow, where they can pay online with PayPal or a credit card.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
<p>Specify an invoice ID to get a QR code (image) that corresponds to the invoice ID. A QR code for an invoice can be added to a paper or PDF invoice. When a customer uses their mobile device to scan the QR code, the customer is redirected to the PayPal mobile payment flow, where they can pay online with PayPal or a credit card.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'SendInvoice.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/SearchInvoices</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="invoice/SearchInvoices"><meta name="groc-project-path" content="invoice/SearchInvoices.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">invoice/SearchInvoices.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="search-invoices-sample">Search Invoices Sample</h1>
|
||||
<p>This sample code demonstrate how you can
|
||||
search invoices from history.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
search invoices from history.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Search</span>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/SendInvoice</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="invoice/SendInvoice"><meta name="groc-project-path" content="invoice/SendInvoice.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">invoice/SendInvoice.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="create-invoice-sample">Create Invoice Sample</h1>
|
||||
<p>This sample code demonstrate how you can send
|
||||
a legitimate invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
a legitimate invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/UpdateInvoice</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="invoice/UpdateInvoice"><meta name="groc-project-path" content="invoice/UpdateInvoice.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">invoice/UpdateInvoice.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-invoice-sample">Update Invoice Sample</h1>
|
||||
<p>This sample code demonstrate how you can update
|
||||
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
|
||||
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Invoice $invoice */</span>
|
||||
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>For Sample Purposes Only.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$request</span> = <span class="hljs-keyword">clone</span> <span class="hljs-variable">$invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3>
|
||||
<p>Lets update some information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>->setInvoiceDate(<span class="hljs-string">"2014-12-16 PST"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="note-these-are-the-work-around-added-to-the">NOTE: These are the work-around added to the</h3>
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
<span class="hljs-variable">$redirectUrl</span> = OpenIdSession::getAuthorizationUrl(
|
||||
<span class="hljs-variable">$baseUrl</span>,
|
||||
<span class="hljs-keyword">array</span>(<span class="hljs-string">'openid'</span>, <span class="hljs-string">'profile'</span>, <span class="hljs-string">'address'</span>, <span class="hljs-string">'email'</span>, <span class="hljs-string">'phone'</span>,
|
||||
<span class="hljs-string">'https://uri.paypal.com/services/paypalattributes'</span>, <span class="hljs-string">'https://uri.paypal.com/services/expresscheckout'</span>),
|
||||
<span class="hljs-string">'https://uri.paypal.com/services/paypalattributes'</span>,
|
||||
<span class="hljs-string">'https://uri.paypal.com/services/expresscheckout'</span>,
|
||||
<span class="hljs-string">'https://uri.paypal.com/services/invoicing'</span>),
|
||||
<span class="hljs-keyword">null</span>,
|
||||
<span class="hljs-keyword">null</span>,
|
||||
<span class="hljs-keyword">null</span>,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>notifications/DeleteAllWebhooks</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="notifications/DeleteAllWebhooks"><meta name="groc-project-path" content="notifications/DeleteAllWebhooks.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">notifications/DeleteAllWebhooks.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="delete-all-webhook-sample">Delete All Webhook Sample</h1>
|
||||
<p>This is a sample helper method, to delete all existing webhooks, because of limited number of webhooks that are allowed per app.
|
||||
To properly use the sample, change the clientId and Secret from bootstrap.php file with your own app ClientId and Secret.</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="get-webhook-instance">Get Webhook Instance</h2></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebhookList $webhookList */</span>
|
||||
To properly use the sample, change the clientId and Secret from bootstrap.php file with your own app ClientId and Secret.</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="get-webhook-instance">Get Webhook Instance</h2></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\WebhookList $webhookList */</span>
|
||||
<span class="hljs-variable">$webhookList</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'ListWebhooks.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="delete-webhook">Delete Webhook</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-keyword">foreach</span> (<span class="hljs-variable">$webhookList</span>->getWebhooks() <span class="hljs-keyword">as</span> <span class="hljs-variable">$webhook</span>) {
|
||||
<span class="hljs-variable">$webhook</span>->delete(<span class="hljs-variable">$apiContext</span>);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>notifications/DeleteWebhook</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="notifications/DeleteWebhook"><meta name="groc-project-path" content="notifications/DeleteWebhook.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">notifications/DeleteWebhook.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="delete-webhook-sample">Delete Webhook Sample</h1>
|
||||
<p>This sample code demonstrate how to use this call to search for all webhook events., as documented here at:
|
||||
<a href="https://developer.paypal.com/docs/api/#delete-a-webhook">https://developer.paypal.com/docs/api/#delete-a-webhook</a>
|
||||
API used: DELETE v1/notifications/webhooks/<Webhook-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="get-webhook-instance">Get Webhook Instance</h2></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
API used: DELETE v1/notifications/webhooks/<Webhook-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="get-webhook-instance">Get Webhook Instance</h2></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
<span class="hljs-variable">$webhook</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateWebhook.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="delete-webhook">Delete Webhook</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$output</span> = <span class="hljs-variable">$webhook</span>->delete(<span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"Delete a Webhook"</span>, <span class="hljs-string">"Webhook"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$webhookId</span>, <span class="hljs-variable">$ex</span>);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#get-a-webhook">https://developer.paypal.com/webapps/developer/docs/api/#get-a-webhook</a>
|
||||
API used: GET /v1/notifications/webhooks/<Webhook-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="get-webhook-id">Get Webhook ID.</h2>
|
||||
<p>In samples we are using CreateWebhook.php sample to get the created instance of webhook.
|
||||
However, in real case scenario, we could use just the ID from database or retrieved from the form.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
However, in real case scenario, we could use just the ID from database or retrieved from the form.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
<span class="hljs-variable">$webhook</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateWebhook.php'</span>;
|
||||
<span class="hljs-variable">$webhookId</span> = <span class="hljs-variable">$webhook</span>->getId();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-webhook">Get Webhook</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$output</span> = \PayPal\Api\Webhook::get(<span class="hljs-variable">$webhookId</span>, <span class="hljs-variable">$apiContext</span>);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>This sample code demonstrate how you can get a webhook, as documented here at:
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#get-a-webhook">https://developer.paypal.com/webapps/developer/docs/api/#get-a-webhook</a>
|
||||
API used: GET /v1/notifications/webhooks/<Webhook-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="list-subscribed-event-types">List Subscribed Event Types</h2>
|
||||
<p>Use this call to retrieve the list of events types that are subscribed to a webhook.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
<p>Use this call to retrieve the list of events types that are subscribed to a webhook.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
<span class="hljs-variable">$webhook</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateWebhook.php'</span>;
|
||||
<span class="hljs-variable">$webhookId</span> = <span class="hljs-variable">$webhook</span>->getId();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-list-of-subscribed-event-types">Get List of Subscribed Event Types</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$output</span> = \PayPal\Api\WebhookEventType::subscribedEventTypes(<span class="hljs-variable">$webhookId</span>, <span class="hljs-variable">$apiContext</span>);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#list-all-webhooks">https://developer.paypal.com/webapps/developer/docs/api/#list-all-webhooks</a>
|
||||
API used: GET /v1/notifications/webhooks</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="list-webhooks">List Webhooks</h2></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>This step is not necessarily required. We are creating a webhook for sample purpose only, so that we would not
|
||||
get an empty list at any point.
|
||||
In real case, you dont need to create any webhook to make this API call.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
In real case, you dont need to create any webhook to make this API call.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
<span class="hljs-variable">$webhook</span> = <span class="hljs-keyword">require_once</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-list-of-all-webhooks">Get List of All Webhooks</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$output</span> = \PayPal\Api\Webhook::getAll(<span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"List all webhooks"</span>, <span class="hljs-string">"WebhookList"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$webhookId</span>, <span class="hljs-variable">$ex</span>);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
API used: GET /v1/notifications/webhooks-events</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="get-webhook-instance">Get Webhook Instance</h2>
|
||||
<h2 id="please-note">PLEASE NOTE:</h2>
|
||||
<p>Creating webhook is sample purposes only. In real scenario, you dont need to create a new webhook everytime you want to search
|
||||
for a webhook events. This is made in a sample just to make sure there is minimum of one webhook to listen to.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
for a webhook events. This is made in a sample just to make sure there is minimum of one webhook to listen to.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
<span class="hljs-variable">$webhook</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
|
||||
|
||||
<span class="hljs-variable">$params</span> = <span class="hljs-keyword">array</span>(</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>'start_time'=>'2014-12-06T11:00:00Z',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#update-a-webhook">https://developer.paypal.com/webapps/developer/docs/api/#update-a-webhook</a>
|
||||
API used: PATCH v1/notifications/webhooks/<Webhook-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="get-webhook-id">Get Webhook ID.</h2>
|
||||
<p>In samples we are using CreateWebhook.php sample to get the created instance of webhook.
|
||||
However, in real case scenario, we could use just the ID from database or use an already existing webhook.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
However, in real case scenario, we could use just the ID from database or use an already existing webhook.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Webhook $webhook */</span>
|
||||
<span class="hljs-variable">$webhook</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateWebhook.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Updating the webhook as per given request</p>
|
||||
<pre><code> [
|
||||
{
|
||||
|
||||
@@ -10,9 +10,9 @@ This is a sample data, that represents the webhook event data.</p></div></div><d
|
||||
* This is one way to receive the entire body that you received from PayPal webhook. This is one of the way to retrieve that information.
|
||||
* Just uncomment the below line to read the data from actual request.
|
||||
*/</span>
|
||||
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> String $bodyReceived */</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>$bodyReceived = file_get_contents('php://input');</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="validate-received-event-method">Validate Received Event Method</h3>
|
||||
<span class="hljs-comment">/** <span class="hljs-doctag">@var</span> String $bodyReceived */</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>$bodyReceived = file_get_contents('php://input');</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="validate-received-event-method">Validate Received Event Method</h3>
|
||||
<p>Call the validateReceivedEvent() method with provided body, and apiContext object to validate</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebhookEvent $output */</span>
|
||||
<span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\WebhookEvent $output */</span>
|
||||
<span class="hljs-variable">$output</span> = \PayPal\Api\WebhookEvent::validateAndGetReceivedEvent(<span class="hljs-variable">$bodyReceived</span>, <span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"Validate Received Webhook Event"</span>, <span class="hljs-string">"WebhookEvent"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$bodyReceived</span>, <span class="hljs-variable">$ex</span>);
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#delete-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#delete-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We are going to re-use the sample code from CreateWebProfile.php.
|
||||
If you have not visited the sample yet, please visit it before trying GetWebProfile.php
|
||||
The CreateWebProfile.php will create a web profile for us, and return a CreateProfileResponse,
|
||||
that contains the web profile ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\CreateProfileResponse $result */</span>
|
||||
that contains the web profile ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\CreateProfileResponse $result */</span>
|
||||
<span class="hljs-variable">$createProfileResponse</span> = <span class="hljs-keyword">require_once</span> <span class="hljs-string">'CreateWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Create a new instance of web Profile ID, and set the ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">new</span> \PayPal\Api\WebProfile();
|
||||
<span class="hljs-variable">$webProfile</span>->setId(<span class="hljs-variable">$createProfileResponse</span>->getId());
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We are going to re-use the sample code from CreateWebProfile.php.
|
||||
If you have not visited the sample yet, please visit it before trying GetWebProfile.php
|
||||
The CreateWebProfile.php will create a web profile for us, and return a CreateProfileResponse,
|
||||
that contains the web profile ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\CreateProfileResponse $result */</span>
|
||||
that contains the web profile ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\CreateProfileResponse $result */</span>
|
||||
<span class="hljs-variable">$createProfileResponse</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateWebProfile.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>If your request is successful, the API returns a web_profile object response that contains the profile details.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$webProfile</span> = \PayPal\Api\WebProfile::get(<span class="hljs-variable">$createProfileResponse</span>->getId(), <span class="hljs-variable">$apiContext</span>);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payment-experience/PartiallyUpdateWebProfile</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="payment-experience/PartiallyUpdateWebProfile"><meta name="groc-project-path" content="payment-experience/PartiallyUpdateWebProfile.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">payment-experience/PartiallyUpdateWebProfile.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"><h4 id="partially-update-web-profile">Partially Update Web Profile</h4>
|
||||
<p>Use this call to partially update a web experience profile.
|
||||
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#partially-update-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#partially-update-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We will be re-using the sample code to get a web profile. GetWebProfile.php will
|
||||
create a new web profileId for sample, and return the web profile object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebProfile $webProfile */</span>
|
||||
create a new web profileId for sample, and return the web profile object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\WebProfile $webProfile */</span>
|
||||
<span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-patch-operation">Create Patch Operation</h3>
|
||||
<p>APIs allows us to pass an array of patches
|
||||
to make patch operations.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payment-experience/UpdateWebProfile</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="payment-experience/UpdateWebProfile"><meta name="groc-project-path" content="payment-experience/UpdateWebProfile.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">payment-experience/UpdateWebProfile.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"><h4 id="update-web-profile">Update Web Profile</h4>
|
||||
<p>Use this call to update an experience profile.
|
||||
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#update-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#update-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We will be re-using the sample code to get a web profile. GetWebProfile.php will
|
||||
create a new web profileId for sample, and return the web profile object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebProfile $webProfile */</span>
|
||||
create a new web profileId for sample, and return the web profile object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\WebProfile $webProfile */</span>
|
||||
<span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Updated the logo image of presentation object in a given web profile.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$webProfile</span>->getPresentation()->setLogoImage(<span class="hljs-string">"http://www.google.com/favico.ico"</span>);
|
||||
|
||||
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Update the web profile to change the logo image.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-keyword">if</span> (<span class="hljs-variable">$webProfile</span>->update(<span class="hljs-variable">$apiContext</span>)) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>If the update is successfull, we can now get the object, and verify the web profile
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>This sample code demonstrates how you can capture
|
||||
a previously authorized payment.
|
||||
API used: /v1/payments/payment
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization">https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization</a></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Authorization $authorization */</span>
|
||||
<a href="https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization">https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization</a></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Authorization $authorization */</span>
|
||||
<span class="hljs-variable">$authorization</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetAuthorization.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;
|
||||
|
||||
@@ -16,7 +16,7 @@ API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrap
|
||||
<p>A resource representing a credit card that can be
|
||||
used to fund a payment.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$card</span> = <span class="hljs-keyword">new</span> CreditCard();
|
||||
<span class="hljs-variable">$card</span>->setType(<span class="hljs-string">"visa"</span>)
|
||||
->setNumber(<span class="hljs-string">"4148529247832259"</span>)
|
||||
->setNumber(<span class="hljs-string">"4669424246660779"</span>)
|
||||
->setExpireMonth(<span class="hljs-string">"11"</span>)
|
||||
->setExpireYear(<span class="hljs-string">"2019"</span>)
|
||||
->setCvv2(<span class="hljs-string">"012"</span>)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingSavedCard</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="payments/CreatePaymentUsingSavedCard"><meta name="groc-project-path" content="payments/CreatePaymentUsingSavedCard.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">payments/CreatePaymentUsingSavedCard.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="create-payment-using-a-saved-credit-card">Create payment using a saved credit card</h1>
|
||||
<p>This sample code demonstrates how you can process a
|
||||
Payment using a previously stored credit card token.
|
||||
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> CreditCard $card */</span>
|
||||
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> CreditCard $card */</span>
|
||||
<span class="hljs-variable">$card</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../vault/CreateCreditCard.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/GetAuthorization</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="payments/GetAuthorization"><meta name="groc-project-path" content="payments/GetAuthorization.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">payments/GetAuthorization.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="getauthorization">GetAuthorization</h1>
|
||||
<p>This sample code demonstrates how you can get details
|
||||
of an authorized payment.
|
||||
API used: /v1/payments/authorization/<$authorizationId></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Authorization $authorization */</span>
|
||||
API used: /v1/payments/authorization/<$authorizationId></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Authorization $authorization */</span>
|
||||
<span class="hljs-variable">$authorization</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'AuthorizePayment.php'</span>;
|
||||
<span class="hljs-variable">$authorizationId</span> = <span class="hljs-variable">$authorization</span>->getId();
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="getauthorization">GetAuthorization</h3>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/GetCapture</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="payments/GetCapture"><meta name="groc-project-path" content="payments/GetCapture.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">payments/GetCapture.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="getcapture">GetCapture</h1>
|
||||
<p>This sample code demonstrates how you can lookup the details
|
||||
of a captured payment.
|
||||
API used: /v1/payments/capture/<$captureId></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Capture $request */</span>
|
||||
API used: /v1/payments/capture/<$captureId></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Capture $request */</span>
|
||||
<span class="hljs-variable">$request</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'AuthorizationCapture.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Capture</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-capture-details">Retrieve Capture details</h3>
|
||||
|
||||
@@ -5,7 +5,7 @@ you've created using the Payments API.
|
||||
Note various query parameters that you can
|
||||
use to filter, and paginate through the
|
||||
payments list.
|
||||
API used: GET /v1/payments/payments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Payment $createdPayment */</span>
|
||||
API used: GET /v1/payments/payments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Payment $createdPayment */</span>
|
||||
<span class="hljs-variable">$createdPayment</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreatePayment.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/OrderAuthorize</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="payments/OrderAuthorize"><meta name="groc-project-path" content="payments/OrderAuthorize.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">payments/OrderAuthorize.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="authorize-order-sample">Authorize Order Sample</h1>
|
||||
<p>To authorize an order payment, pass the orderId in the URI of a POST call. This begins the process of confirming that funds are available until it is time to complete the payment transaction.
|
||||
API used: POST /v1/payments/orders/<Order-Id>/authorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Payment $payment */</span>
|
||||
API used: POST /v1/payments/orders/<Order-Id>/authorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Payment $payment */</span>
|
||||
<span class="hljs-variable">$payment</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/ExecutePayment.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/OrderCapture</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="payments/OrderCapture"><meta name="groc-project-path" content="payments/OrderCapture.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">payments/OrderCapture.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="capture-order-sample">Capture Order Sample</h1>
|
||||
<p>To authorize an order payment, pass the orderId in the URI of a POST call. This begins the process of confirming that funds are available until it is time to complete the payment transaction.
|
||||
API used: POST /v1/payments/orders/<Order-Id>/authorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Payment $payment */</span>
|
||||
API used: POST /v1/payments/orders/<Order-Id>/authorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Payment $payment */</span>
|
||||
<span class="hljs-variable">$payment</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/ExecutePayment.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/OrderDoVoid</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="payments/OrderDoVoid"><meta name="groc-project-path" content="payments/OrderDoVoid.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">payments/OrderDoVoid.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="void-order-sample">Void Order Sample</h1>
|
||||
<p>Use this call to void an existing order.
|
||||
Note: An order cannot be voided if payment has already been partially or fully captured.
|
||||
API used: POST /v1/payments/orders/<Order-Id>/do-void</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Payment $payment */</span>
|
||||
API used: POST /v1/payments/orders/<Order-Id>/do-void</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Payment $payment */</span>
|
||||
<span class="hljs-variable">$payment</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/ExecutePayment.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="approval-status">Approval Status</h3>
|
||||
<p>Determine if the user approved the payment or not</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">if</span> (<span class="hljs-keyword">isset</span>(<span class="hljs-variable">$_GET</span>[<span class="hljs-string">'success'</span>]) && <span class="hljs-variable">$_GET</span>[<span class="hljs-string">'success'</span>] == <span class="hljs-string">'true'</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-the-order">Retrieve the order</h3>
|
||||
<p>OrderId could be retrieved by parsing the object inside related_resources.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$transactions</span> = <span class="hljs-variable">$payment</span>->getTransactions();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/OrderGet</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="payments/OrderGet"><meta name="groc-project-path" content="payments/OrderGet.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">payments/OrderGet.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="get-order-sample">Get Order Sample</h1>
|
||||
<p>Specify an order ID to get details about an order.
|
||||
API used: GET /v1/payments/orders/<Order-Id></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\Payment $payment */</span>
|
||||
API used: GET /v1/payments/orders/<Order-Id></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\Payment $payment */</span>
|
||||
<span class="hljs-variable">$payment</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/ExecutePayment.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="approval-status">Approval Status</h3>
|
||||
<p>Determine if the user approved the payment or not</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">if</span> (<span class="hljs-keyword">isset</span>(<span class="hljs-variable">$_GET</span>[<span class="hljs-string">'success'</span>]) && <span class="hljs-variable">$_GET</span>[<span class="hljs-string">'success'</span>] == <span class="hljs-string">'true'</span>) {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/Reauthorization</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="payments/Reauthorization"><meta name="groc-project-path" content="payments/Reauthorization.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">payments/Reauthorization.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"><h2 id="reauthorization-sample">Reauthorization Sample</h2>
|
||||
<p>This sample code demonstrates how you can reauthorize a PayPal
|
||||
account payment.
|
||||
API used: v1/payments/authorization/{authorization_id}/reauthorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Authorization $authorization */</span>
|
||||
API used: v1/payments/authorization/{authorization_id}/reauthorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Authorization $authorization */</span>
|
||||
<span class="hljs-variable">$authorization</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'AuthorizePayment.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorization">Reauthorization</h3>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/RefundCapture</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="payments/RefundCapture"><meta name="groc-project-path" content="payments/RefundCapture.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">payments/RefundCapture.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="refund-capture-sample">Refund Capture Sample</h1>
|
||||
<p>This sample code demonstrates how you can
|
||||
process a refund on a Captured transaction.
|
||||
API used: /v1/payments/capture/{<captureID>}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Capture $capture */</span>
|
||||
API used: /v1/payments/capture/{<captureID>}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Capture $capture */</span>
|
||||
<span class="hljs-variable">$capture</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'AuthorizationCapture.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Capture</span>;
|
||||
|
||||
@@ -6,7 +6,7 @@ you've created using the Payments API.</p>
|
||||
<p>Note that it can only be updated before the execute is done. Once, the payment is executed it is not
|
||||
possible to udpate that.
|
||||
Docs: <a href="https://developer.paypal.com/webapps/developer/docs/api/#update-a-payment-resource">https://developer.paypal.com/webapps/developer/docs/api/#update-a-payment-resource</a>
|
||||
API used: PATCH /v1/payments/payment/<Payment-Id></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Payment $createdPayment */</span>
|
||||
API used: PATCH /v1/payments/payment/<Payment-Id></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Payment $createdPayment */</span>
|
||||
<span class="hljs-variable">$createdPayment</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreatePaymentUsingPayPal.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payments/VoidAuthorization</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="payments/VoidAuthorization"><meta name="groc-project-path" content="payments/VoidAuthorization.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">payments/VoidAuthorization.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="voidauthorization">VoidAuthorization</h1>
|
||||
<p>This sample code demonstrates how you can
|
||||
void an authorized payment.
|
||||
API used: /v1/payments/authorization/<{authorizationid}>/void"</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Authorization $authorization */</span>
|
||||
API used: /v1/payments/authorization/<{authorizationid}>/void"</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Authorization $authorization */</span>
|
||||
<span class="hljs-variable">$authorization</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'AuthorizePayment.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Replace $authorizationid with any static Id you might already have. It will do a void on it</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$authorizationId</span> = <span class="hljs-string">'1BF65516U6866543H'</span>; <span class="hljs-comment">// $authorization->getId();</span>
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Authorization</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="voidauthorization">VoidAuthorization</h3>
|
||||
<p>You can void a previously authorized payment
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payouts/CancelPayoutItem</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="payouts/CancelPayoutItem"><meta name="groc-project-path" content="payouts/CancelPayoutItem.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">payouts/CancelPayoutItem.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="cancel-payout-item-status-sample">Cancel Payout Item Status Sample</h1>
|
||||
<p>Use this call to cancel an existing, unclaimed transaction. If an unclaimed item is not claimed within 30 days, the funds will be automatically returned to the sender. This call can be used to cancel the unclaimed item prior to the automatic 30-day return.
|
||||
<a href="https://developer.paypal.com/docs/api/#cancel-an-unclaimed-payout-item">https://developer.paypal.com/docs/api/#cancel-an-unclaimed-payout-item</a>
|
||||
API used: POST /v1/payments/payouts-item/<Payout-Item-Id>/cancel</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\PayoutBatch $payoutBatch */</span>
|
||||
API used: POST /v1/payments/payouts-item/<Payout-Item-Id>/cancel</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\PayoutBatch $payoutBatch */</span>
|
||||
<span class="hljs-variable">$payoutBatch</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateSinglePayout.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="payout-item-id">Payout Item ID</h2>
|
||||
<p>You can replace this with your Payout Batch Id on already created Payout.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payoutItems</span> = <span class="hljs-variable">$payoutBatch</span>->getItems();
|
||||
<span class="hljs-variable">$payoutItem</span> = <span class="hljs-variable">$payoutItems</span>[<span class="hljs-number">0</span>];
|
||||
|
||||
@@ -14,7 +14,7 @@ API used: /v1/payments/payouts</p></div></div><div class="code"><div class="wrap
|
||||
"value": 0.99,
|
||||
"currency": "USD"
|
||||
},
|
||||
"receiver": "shirt-supplier-one@mail.com",
|
||||
"receiver": "shirt-supplier-one<span class="hljs-doctag">@mail</span>.com",
|
||||
"note": "Thank you.",
|
||||
"sender_item_id": "item_1"
|
||||
},
|
||||
@@ -24,7 +24,7 @@ API used: /v1/payments/payouts</p></div></div><div class="code"><div class="wrap
|
||||
"value": 0.90,
|
||||
"currency": "USD"
|
||||
},
|
||||
"receiver": "shirt-supplier-two@mail.com",
|
||||
"receiver": "shirt-supplier-two<span class="hljs-doctag">@mail</span>.com",
|
||||
"note": "Thank you.",
|
||||
"sender_item_id": "item_2"
|
||||
},
|
||||
@@ -34,7 +34,7 @@ API used: /v1/payments/payouts</p></div></div><div class="code"><div class="wrap
|
||||
"value": 2.00,
|
||||
"currency": "USD"
|
||||
},
|
||||
"receiver": "shirt-supplier-three@mail.com",
|
||||
"receiver": "shirt-supplier-three<span class="hljs-doctag">@mail</span>.com",
|
||||
"note": "Thank you.",
|
||||
"sender_item_id": "item_3"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ API used: /v1/payments/payouts?sync_mode=true</p></div></div><div class="code"><
|
||||
},
|
||||
"note":"Thanks for your patronage!",
|
||||
"sender_item_id":"2014031400023",
|
||||
"receiver":"shirt-supplier-one@mail.com"
|
||||
"receiver":"shirt-supplier-one<span class="hljs-doctag">@mail</span>.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payouts/GetPayoutBatchStatus</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="payouts/GetPayoutBatchStatus"><meta name="groc-project-path" content="payouts/GetPayoutBatchStatus.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">payouts/GetPayoutBatchStatus.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="get-payout-batch-status-sample">Get Payout Batch Status Sample</h1>
|
||||
<p>This sample code demonstrate how you can get the batch payout status of a created batch payout, as documented here at:
|
||||
<a href="https://developer.paypal.com/docs/api/#get-the-status-of-a-batch-payout">https://developer.paypal.com/docs/api/#get-the-status-of-a-batch-payout</a>
|
||||
API used: GET /v1/payments/payouts/<Payout-Batch-Id></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\PayoutBatch $payoutBatch */</span>
|
||||
API used: GET /v1/payments/payouts/<Payout-Batch-Id></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\PayoutBatch $payoutBatch */</span>
|
||||
<span class="hljs-variable">$payoutBatch</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateBatchPayout.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="payout-batch-id">Payout Batch ID</h2>
|
||||
<p>You can replace this with your Payout Batch Id on already created Payout.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payoutBatchId</span> = <span class="hljs-variable">$payoutBatch</span>->getBatchHeader()->getPayoutBatchId();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-payout-batch-status">Get Payout Batch Status</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$output</span> = \PayPal\Api\Payout::get(<span class="hljs-variable">$payoutBatchId</span>, <span class="hljs-variable">$apiContext</span>);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>payouts/GetPayoutItemStatus</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="payouts/GetPayoutItemStatus"><meta name="groc-project-path" content="payouts/GetPayoutItemStatus.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">payouts/GetPayoutItemStatus.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="get-payout-item-status-sample">Get Payout Item Status Sample</h1>
|
||||
<p>Use this call to get data about a payout item, including the status, without retrieving an entire batch. You can get the status of an individual payout item in a batch in order to review the current status of a previously-unclaimed, or pending, payout item.
|
||||
<a href="https://developer.paypal.com/docs/api/#get-the-status-of-a-payout-item">https://developer.paypal.com/docs/api/#get-the-status-of-a-payout-item</a>
|
||||
API used: GET /v1/payments/payouts-item/<Payout-Item-Id></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\PayoutBatch $payoutBatch */</span>
|
||||
API used: GET /v1/payments/payouts-item/<Payout-Item-Id></p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\PayoutBatch $payoutBatch */</span>
|
||||
<span class="hljs-variable">$payoutBatch</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetPayoutBatchStatus.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="payout-item-id">Payout Item ID</h2>
|
||||
<p>You can replace this with your Payout Batch Id on already created Payout.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payoutItems</span> = <span class="hljs-variable">$payoutBatch</span>->getItems();
|
||||
<span class="hljs-variable">$payoutItem</span> = <span class="hljs-variable">$payoutItems</span>[<span class="hljs-number">0</span>];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>Sale transactions are nothing but completed payments.
|
||||
This sample code demonstrates how you can retrieve
|
||||
details of completed Sale Transaction.
|
||||
API used: /v1/payments/sale/{sale-id}</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Payment $payment */</span>
|
||||
API used: /v1/payments/sale/{sale-id}</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Payment $payment */</span>
|
||||
<span class="hljs-variable">$payment</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../payments/CreatePayment.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Sale</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-sale-from-created-payment">Get Sale From Created Payment</h3>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>This sample code demonstrate how you can
|
||||
process a refund on a sale transaction created
|
||||
using the Payments API.
|
||||
API used: /v1/payments/sale/{sale-id}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Sale $sale */</span>
|
||||
API used: /v1/payments/sale/{sale-id}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> Sale $sale */</span>
|
||||
<span class="hljs-variable">$sale</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetSale.php'</span>;
|
||||
<span class="hljs-variable">$saleId</span> = <span class="hljs-variable">$sale</span>->getId();
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
PayPal Account based Payment.
|
||||
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Details</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Item</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ItemList</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payer</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payment</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">RedirectUrls</span>;
|
||||
@@ -17,8 +14,9 @@ To test your own implementation to verify it TLS is successfully supported in yo
|
||||
the following steps.</p>
|
||||
<ol>
|
||||
<li>Create an APIContext object as usual. (No Change Required).</li>
|
||||
<li>Add Configs as shown below to your apiContext object</li>
|
||||
</ol></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$apiContext</span>->setConfig(<span class="hljs-keyword">array</span>(<span class="hljs-string">'service.EndPoint'</span>=><span class="hljs-string">"https://test-api.sandbox.paypal.com"</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><ol>
|
||||
<li>Add Configs as shown below to your apiContext object
|
||||
Note: Explicitly disabling caching for specific testing.</li>
|
||||
</ol></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$apiContext</span>->setConfig(<span class="hljs-keyword">array</span>(<span class="hljs-string">'service.EndPoint'</span>=><span class="hljs-string">"https://test-api.sandbox.paypal.com"</span>, <span class="hljs-string">'cache.enabled'</span>=><span class="hljs-keyword">false</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><ol>
|
||||
<li>Thats it. Run your code, and see if it works as normal.</li>
|
||||
<li>You can check sdk logs to verify it is infact pointing to the above URL instead of default sandbox one.</li>
|
||||
</ol></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-a-payment-for-testing">Create a Payment for testing</h3>
|
||||
@@ -41,8 +39,8 @@ the following steps.</p>
|
||||
<span class="hljs-variable">$curl_info</span> = curl_version();
|
||||
<span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$payment</span>->create(<span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"FAILURE: SECURITY WARNING: TLSv1.2 is not supported on this system. Please upgrade your curl/openssl to enable TLSv1.2. <br /> - Your Current SSL Version is : "</span> . <span class="hljs-variable">$curl_info</span>[<span class="hljs-string">'ssl_version'</span>], <span class="hljs-string">"Payment"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$request</span>, <span class="hljs-variable">$ex</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"FAILURE: SECURITY WARNING: TLSv1.2 is not supported on this system. Please upgrade your curl to atleast 7.34.0.<br /> - Current Curl Version: "</span> . <span class="hljs-variable">$curl_info</span>[<span class="hljs-string">'version'</span>] . <span class="hljs-string">"<br /> - Current OpenSSL Version:"</span> . <span class="hljs-variable">$curl_info</span>[<span class="hljs-string">'ssl_version'</span>], <span class="hljs-string">"Payment"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$request</span>, <span class="hljs-variable">$ex</span>);
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper">ResultPrinter::printResult(<span class="hljs-string">"<b>SUCCESS</b>: Your server supports TLS protocols required for secure connection to PayPal Servers. <br /> - Your Current SSL Version is : "</span> . <span class="hljs-variable">$curl_info</span>[<span class="hljs-string">'ssl_version'</span>], <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-string">"SUCCESS. Your system supports TLSv1.2"</span>);
|
||||
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper">ResultPrinter::printResult(<span class="hljs-string">"<b>SUCCESS</b>: Your server supports TLS protocols required for secure connection to PayPal Servers. <br /> - Current Curl Version: "</span> . <span class="hljs-variable">$curl_info</span>[<span class="hljs-string">'version'</span>] . <span class="hljs-string">"<br /> - Current OpenSSL Version:"</span> . <span class="hljs-variable">$curl_info</span>[<span class="hljs-string">'ssl_version'</span>], <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-string">"SUCCESS. Your system supports TLSv1.2"</span>);
|
||||
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$payment</span>;</div></div></div></div></body></html>
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>This sample code demonstrate how you can
|
||||
delete a saved bank account
|
||||
API used: /v1/vault/bank-accounts/{<bankAccountId>}
|
||||
NOTE: HTTP method used here is DELETE</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\BankAccount $card */</span>
|
||||
NOTE: HTTP method used here is DELETE</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\BankAccount $card */</span>
|
||||
<span class="hljs-variable">$bankAccount</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateBankAccount.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="delete-card">Delete Card</h3>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>This sample code demonstrate how you can
|
||||
delete a saved credit card.
|
||||
API used: /v1/vault/credit-card/{<creditCardId>}
|
||||
NOTE: HTTP method used here is DELETE</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> CreditCard $card */</span>
|
||||
NOTE: HTTP method used here is DELETE</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> CreditCard $card */</span>
|
||||
<span class="hljs-variable">$card</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateCreditCard.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>The Bank Account resource allows you to
|
||||
retrieve previously saved Bank Accounts.
|
||||
API called: '/v1/vault/bank-accounts'</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>The following code takes you through
|
||||
the process of retrieving a saved Bank Account</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\BankAccount $bankAccount */</span>
|
||||
the process of retrieving a saved Bank Account</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> \PayPal\Api\BankAccount $bankAccount */</span>
|
||||
<span class="hljs-variable">$bankAccount</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateBankAccount.php'</span>;
|
||||
|
||||
<span class="hljs-comment">/// ### Retrieve Bank Account</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
retrieve previously saved CreditCards.
|
||||
API called: '/v1/vault/credit-card'
|
||||
The following code takes you through
|
||||
the process of retrieving a saved CreditCard</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> CreditCard $card */</span>
|
||||
the process of retrieving a saved CreditCard</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> CreditCard $card */</span>
|
||||
<span class="hljs-variable">$card</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateCreditCard.php'</span>;
|
||||
<span class="hljs-variable">$id</span> = <span class="hljs-variable">$card</span>->getId();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<p>The CreditCard resource allows you to
|
||||
retrieve all previously saved CreditCards.
|
||||
API called: '/v1/vault/credit-cards'
|
||||
Documentation: <a href="https://developer.paypal.com/webapps/developer/docs/api/#list-credit-card-resources">https://developer.paypal.com/webapps/developer/docs/api/#list-credit-card-resources</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Creating a Credit Card just in case</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> CreditCard $card */</span>
|
||||
Documentation: <a href="https://developer.paypal.com/webapps/developer/docs/api/#list-credit-card-resources">https://developer.paypal.com/webapps/developer/docs/api/#list-credit-card-resources</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Creating a Credit Card just in case</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> CreditCard $card */</span>
|
||||
<span class="hljs-variable">$card</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateCreditCard.php'</span>;
|
||||
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
update previously saved CreditCards.
|
||||
API called: PATCH /v1/vault/credit-cards/<Credit-Card-Id>
|
||||
The following code takes you through
|
||||
the process of updating a saved CreditCard</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> CreditCard $card */</span>
|
||||
the process of updating a saved CreditCard</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/** <span class="hljs-doctag">@var</span> CreditCard $card */</span>
|
||||
<span class="hljs-variable">$card</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateCreditCard.php'</span>;
|
||||
<span class="hljs-variable">$id</span> = <span class="hljs-variable">$card</span>->getId();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user