forked from LiveCarta/PayPal-PHP-SDK
@@ -30,29 +30,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
|
|||||||
"pageTitle": "billing/CreateBillingAgreementWithCreditCard",
|
"pageTitle": "billing/CreateBillingAgreementWithCreditCard",
|
||||||
"title": "CreateBillingAgreementWithCreditCard"
|
"title": "CreateBillingAgreementWithCreditCard"
|
||||||
},
|
},
|
||||||
"depth": 2,
|
"depth": 2
|
||||||
"outline": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 1,
|
|
||||||
"title": "Create Billing Agreement with Credit Card as Payment Source",
|
|
||||||
"slug": "create-billing-agreement-with-credit-card-as-payment-source"
|
|
||||||
},
|
|
||||||
"depth": 1,
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Create Agreement",
|
|
||||||
"slug": "create-agreement"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
}, {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"data": {
|
"data": {
|
||||||
@@ -505,6 +483,54 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
|
|||||||
"title": "GetNextInvoiceNumber"
|
"title": "GetNextInvoiceNumber"
|
||||||
},
|
},
|
||||||
"depth": 2
|
"depth": 2
|
||||||
|
}, {
|
||||||
|
"type": "file",
|
||||||
|
"data": {
|
||||||
|
"language": {
|
||||||
|
"nameMatchers": [{}, ".fbp"],
|
||||||
|
"pygmentsLexer": "php",
|
||||||
|
"singleLineComment": ["//"],
|
||||||
|
"ignorePrefix": "}",
|
||||||
|
"foldPrefix": "^",
|
||||||
|
"name": "PHP"
|
||||||
|
},
|
||||||
|
"sourcePath": "/Users/japatel/paypal/github/PayPal-PHP-SDK/sample/invoice/GetThirdPartyInvoice.php",
|
||||||
|
"projectPath": "invoice/GetThirdPartyInvoice.php",
|
||||||
|
"targetPath": "invoice/GetThirdPartyInvoice",
|
||||||
|
"pageTitle": "invoice/GetThirdPartyInvoice",
|
||||||
|
"title": "GetThirdPartyInvoice"
|
||||||
|
},
|
||||||
|
"depth": 2,
|
||||||
|
"outline": [
|
||||||
|
{
|
||||||
|
"type": "heading",
|
||||||
|
"data": {
|
||||||
|
"level": 1,
|
||||||
|
"title": "Get Third Invoice Sample",
|
||||||
|
"slug": "get-third-invoice-sample"
|
||||||
|
},
|
||||||
|
"depth": 1,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "heading",
|
||||||
|
"data": {
|
||||||
|
"level": 3,
|
||||||
|
"title": "Step 2",
|
||||||
|
"slug": "step-2"
|
||||||
|
},
|
||||||
|
"depth": 3
|
||||||
|
}, {
|
||||||
|
"type": "heading",
|
||||||
|
"data": {
|
||||||
|
"level": 3,
|
||||||
|
"title": "Retrieve Invoice",
|
||||||
|
"slug": "retrieve-invoice"
|
||||||
|
},
|
||||||
|
"depth": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"data": {
|
"data": {
|
||||||
@@ -1138,93 +1164,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
|
|||||||
"pageTitle": "payments/CreatePayment",
|
"pageTitle": "payments/CreatePayment",
|
||||||
"title": "CreatePayment"
|
"title": "CreatePayment"
|
||||||
},
|
},
|
||||||
"depth": 2,
|
"depth": 2
|
||||||
"outline": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 1,
|
|
||||||
"title": "CreatePaymentSample",
|
|
||||||
"slug": "createpaymentsample"
|
|
||||||
},
|
|
||||||
"depth": 1,
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "PaymentCard",
|
|
||||||
"slug": "paymentcard"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "FundingInstrument",
|
|
||||||
"slug": "fundinginstrument"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Payer",
|
|
||||||
"slug": "payer"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Itemized information",
|
|
||||||
"slug": "itemized-information"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Additional payment details",
|
|
||||||
"slug": "additional-payment-details"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Amount",
|
|
||||||
"slug": "amount"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Transaction",
|
|
||||||
"slug": "transaction"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Payment",
|
|
||||||
"slug": "payment"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Create Payment",
|
|
||||||
"slug": "create-payment"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
}, {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"data": {
|
"data": {
|
||||||
@@ -1278,101 +1218,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
|
|||||||
"pageTitle": "payments/CreateThirdPartyPayment",
|
"pageTitle": "payments/CreateThirdPartyPayment",
|
||||||
"title": "CreateThirdPartyPayment"
|
"title": "CreateThirdPartyPayment"
|
||||||
},
|
},
|
||||||
"depth": 2,
|
"depth": 2
|
||||||
"outline": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 1,
|
|
||||||
"title": "Create Third Party Payment using PayPal as payment method",
|
|
||||||
"slug": "create-third-party-payment-using-paypal-as-payment-method"
|
|
||||||
},
|
|
||||||
"depth": 1,
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Payer",
|
|
||||||
"slug": "payer"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Itemized information",
|
|
||||||
"slug": "itemized-information"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Additional payment details",
|
|
||||||
"slug": "additional-payment-details"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Amount",
|
|
||||||
"slug": "amount"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Payee",
|
|
||||||
"slug": "payee"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Transaction",
|
|
||||||
"slug": "transaction"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Redirect urls",
|
|
||||||
"slug": "redirect-urls"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Payment",
|
|
||||||
"slug": "payment"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Create Payment",
|
|
||||||
"slug": "create-payment"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Get redirect url",
|
|
||||||
"slug": "get-redirect-url"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
}, {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"data": {
|
"data": {
|
||||||
@@ -1444,29 +1290,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
|
|||||||
"pageTitle": "payments/GetPayment",
|
"pageTitle": "payments/GetPayment",
|
||||||
"title": "GetPayment"
|
"title": "GetPayment"
|
||||||
},
|
},
|
||||||
"depth": 2,
|
"depth": 2
|
||||||
"outline": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 1,
|
|
||||||
"title": "GetPaymentSample",
|
|
||||||
"slug": "getpaymentsample"
|
|
||||||
},
|
|
||||||
"depth": 1,
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Retrieve payment",
|
|
||||||
"slug": "retrieve-payment"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
}, {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"data": {
|
"data": {
|
||||||
@@ -1664,29 +1488,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
|
|||||||
"pageTitle": "payments/RefundCapture",
|
"pageTitle": "payments/RefundCapture",
|
||||||
"title": "RefundCapture"
|
"title": "RefundCapture"
|
||||||
},
|
},
|
||||||
"depth": 2,
|
"depth": 2
|
||||||
"outline": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 1,
|
|
||||||
"title": "Refund Capture Sample",
|
|
||||||
"slug": "refund-capture-sample"
|
|
||||||
},
|
|
||||||
"depth": 1,
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Refund",
|
|
||||||
"slug": "refund"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
}, {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"data": {
|
"data": {
|
||||||
@@ -1850,37 +1652,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
|
|||||||
"pageTitle": "sale/GetSale",
|
"pageTitle": "sale/GetSale",
|
||||||
"title": "GetSale"
|
"title": "GetSale"
|
||||||
},
|
},
|
||||||
"depth": 2,
|
"depth": 2
|
||||||
"outline": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 1,
|
|
||||||
"title": "Get Sale sample",
|
|
||||||
"slug": "get-sale-sample"
|
|
||||||
},
|
|
||||||
"depth": 1,
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Get Sale From Created Payment",
|
|
||||||
"slug": "get-sale-from-created-payment"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Retrieve the sale object",
|
|
||||||
"slug": "retrieve-the-sale-object"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, {
|
}, {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"data": {
|
"data": {
|
||||||
@@ -1898,45 +1670,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
|
|||||||
"pageTitle": "sale/RefundSale",
|
"pageTitle": "sale/RefundSale",
|
||||||
"title": "RefundSale"
|
"title": "RefundSale"
|
||||||
},
|
},
|
||||||
"depth": 2,
|
"depth": 2
|
||||||
"outline": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 1,
|
|
||||||
"title": "Sale Refund Sample",
|
|
||||||
"slug": "sale-refund-sample"
|
|
||||||
},
|
|
||||||
"depth": 1,
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Refund amount",
|
|
||||||
"slug": "refund-amount"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Refund object",
|
|
||||||
"slug": "refund-object"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}, {
|
|
||||||
"type": "heading",
|
|
||||||
"data": {
|
|
||||||
"level": 3,
|
|
||||||
"title": "Sale",
|
|
||||||
"slug": "sale"
|
|
||||||
},
|
|
||||||
"depth": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!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>
|
<!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.
|
<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.
|
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.
|
You need the email address of the third party. This can be retrieved using the refresh token obtained from previous call. Please refer 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>;
|
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">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">Currency</span>;
|
||||||
@@ -10,9 +10,10 @@ Please make sure to use <code>merchantInfo.email</code> as the email address of
|
|||||||
<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">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">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">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-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ShippingInfo</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Step 1. 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>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Step 2. Get the email address of third party merchant who you want to create this invoice for.
|
||||||
|
This can be retrieved using the refresh token obtained from previous call. Please refer 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.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$thirdPartyMerchant</span> = <span class="hljs-string">"developer@sample.com"</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>
|
</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Step 3. Create an invoice object.
|
||||||
|
Make sure to set <code>$invoice->getMerchantInfo()->setEmail()</code> with the third party merchant email you retrieved from Step 2.</p></div></div><div class="code"><div class="wrapper"><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
|
<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>
|
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())
|
->setMerchantInfo(<span class="hljs-keyword">new</span> MerchantInfo())
|
||||||
@@ -20,7 +21,7 @@ required for invoice APIs</p></div></div><div class="code"><div class="wrapper">
|
|||||||
->setNote(<span class="hljs-string">"Medical Invoice 16 Jul, 2013 PST"</span>)
|
->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>
|
->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
|
<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>)
|
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-variable">$thirdPartyMerchant</span>)
|
||||||
->setFirstName(<span class="hljs-string">"Dennis"</span>)
|
->setFirstName(<span class="hljs-string">"Dennis"</span>)
|
||||||
->setLastName(<span class="hljs-string">"Doctor"</span>)
|
->setLastName(<span class="hljs-string">"Doctor"</span>)
|
||||||
->setbusinessName(<span class="hljs-string">"Medical Professionals, LLC"</span>)
|
->setbusinessName(<span class="hljs-string">"Medical Professionals, LLC"</span>)
|
||||||
@@ -58,18 +59,18 @@ detailed breakdown of invoice</p></div></div><div class="code"><div class="wrapp
|
|||||||
->setValue(<span class="hljs-number">5</span>);
|
->setValue(<span class="hljs-number">5</span>);
|
||||||
|
|
||||||
<span class="hljs-variable">$invoice</span>->getPaymentTerm()
|
<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>;
|
->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>;
|
||||||
|
|
||||||
<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>
|
|
||||||
|
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="use-refresh-token-obtained-from-step-1">Use Refresh Token obtained from Step 1.</h3></div></div></div><div class="segment"><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
|
<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>);
|
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">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 Third Party 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>);
|
<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>);
|
}</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 Third Party 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-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">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 Third Party 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>);
|
<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>);
|
}</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 Third Party 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>
|
||||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$invoice</span>;</div></div></div></div></body></html>
|
|
||||||
@@ -15,4 +15,4 @@ Invoice ID
|
|||||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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">"Get Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-variable">$invoice</span>->getId(), <span class="hljs-variable">$invoiceId</span>, <span class="hljs-variable">$invoice</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">"Get Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-variable">$invoice</span>->getId(), <span class="hljs-variable">$invoiceId</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>
|
<span class="hljs-keyword">return</span> <span class="hljs-variable">$invoice</span>;</div></div></div></div></body></html>
|
||||||
21
sample/doc/invoice/GetThirdPartyInvoice.html
Normal file
21
sample/doc/invoice/GetThirdPartyInvoice.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html><html lang="en"><head><title>invoice/GetThirdPartyInvoice</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/GetThirdPartyInvoice"><meta name="groc-project-path" content="invoice/GetThirdPartyInvoice.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/GetThirdPartyInvoice.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-third-invoice-sample">Get Third Invoice Sample</h1>
|
||||||
|
<p>This sample code demonstrate how you can retrieve
|
||||||
|
a third party 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">'CreateThirdPartyInvoice.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-variable">$invoiceId</span> = <span class="hljs-variable">$invoice</span>->getId();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Step 1. 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="step-2">Step 2</h3>
|
||||||
|
<p>Update your apiContext with refresh token obtained from Step 1.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$apiContext</span>->getCredential()->updateAccessToken(<span class="hljs-variable">$apiContext</span>->getConfig(), <span class="hljs-variable">$refreshToken</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-invoice">Retrieve Invoice</h3>
|
||||||
|
<p>Retrieve the invoice object by calling the
|
||||||
|
static <code>get</code> method
|
||||||
|
on the Invoice class by passing a valid
|
||||||
|
Invoice ID
|
||||||
|
(See bootstrap.php for more on <code>ApiContext</code>)
|
||||||
|
Similar calls can be done to search invoices, delete, and update.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$retrievedInvoice</span> = Invoice::get(<span class="hljs-variable">$invoiceId</span>, <span class="hljs-variable">$apiContext</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">"Get Third Party Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-variable">$retrievedInvoice</span>->getId(), <span class="hljs-variable">$invoiceId</span>, <span class="hljs-variable">$retrievedInvoice</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">"Get Third Party Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-variable">$invoiceId</span>, <span class="hljs-variable">$invoiceId</span>, <span class="hljs-variable">$ex</span>);
|
||||||
|
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="hljs-keyword">return</span> <span class="hljs-variable">$retrievedInvoice</span>;</div></div></div></div></body></html>
|
||||||
@@ -22,4 +22,4 @@ Refer the method doc for valid values for keys
|
|||||||
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoices</span> = Invoice::search(<span class="hljs-variable">$search</span>, <span class="hljs-variable">$apiContext</span>);
|
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$invoices</span> = Invoice::search(<span class="hljs-variable">$search</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">"Search Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</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">"Search Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$ex</span>);
|
||||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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">"Search Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$search</span>, <span class="hljs-variable">$invoices</span>);</div></div></div></div></body></html>
|
}</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">"Search Invoice"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$search</span>, <span class="hljs-variable">$invoices</span>);</div></div></div></div></body></html>
|
||||||
@@ -23,4 +23,4 @@ with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)<
|
|||||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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">"Capture Payment"</span>, <span class="hljs-string">"Authorization"</span>, <span class="hljs-variable">$getCapture</span>->getId(), <span class="hljs-variable">$capture</span>, <span class="hljs-variable">$getCapture</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">"Capture Payment"</span>, <span class="hljs-string">"Authorization"</span>, <span class="hljs-variable">$getCapture</span>->getId(), <span class="hljs-variable">$capture</span>, <span class="hljs-variable">$getCapture</span>);
|
||||||
|
|
||||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$getCapture</span>;</div></div></div></div></body></html>
|
<span class="hljs-keyword">return</span> <span class="hljs-variable">$getCapture</span>;</div></div></div></div></body></html>
|
||||||
@@ -74,4 +74,4 @@ for payment approval</p></div></div><div class="code"><div class="wrapper"><span
|
|||||||
the buyer to. Retrieve the url from the $payment->getApprovalLink()
|
the buyer to. Retrieve the url from the $payment->getApprovalLink()
|
||||||
method</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$approvalUrl</span> = <span class="hljs-variable">$payment</span>->getApprovalLink();</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">"Created Payment Using PayPal. Please visit the URL to Approve."</span>, <span class="hljs-string">"Payment"</span>, <span class="hljs-string">"<a href='$approvalUrl' >$approvalUrl</a>"</span>, <span class="hljs-variable">$request</span>, <span class="hljs-variable">$payment</span>);
|
method</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$approvalUrl</span> = <span class="hljs-variable">$payment</span>->getApprovalLink();</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">"Created Payment Using PayPal. Please visit the URL to Approve."</span>, <span class="hljs-string">"Payment"</span>, <span class="hljs-string">"<a href='$approvalUrl' >$approvalUrl</a>"</span>, <span class="hljs-variable">$request</span>, <span class="hljs-variable">$payment</span>);
|
||||||
|
|
||||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$payment</span>;</div></div></div></div></body></html>
|
<span class="hljs-keyword">return</span> <span class="hljs-variable">$payment</span>;</div></div></div></div></body></html>
|
||||||
@@ -13,4 +13,4 @@ The return object contains the authorization state.</p></div></div><div class="c
|
|||||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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">"Get Authorization"</span>, <span class="hljs-string">"Authorization"</span>, <span class="hljs-variable">$authorizationId</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$result</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">"Get Authorization"</span>, <span class="hljs-string">"Authorization"</span>, <span class="hljs-variable">$authorizationId</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$result</span>);
|
||||||
|
|
||||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$result</span>;</div></div></div></div></body></html>
|
<span class="hljs-keyword">return</span> <span class="hljs-variable">$result</span>;</div></div></div></div></body></html>
|
||||||
@@ -20,4 +20,4 @@ Payment ID
|
|||||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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">"Get Payment"</span>, <span class="hljs-string">"Payment"</span>, <span class="hljs-variable">$payment</span>->getId(), <span class="hljs-keyword">null</span>, <span class="hljs-variable">$payment</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">"Get Payment"</span>, <span class="hljs-string">"Payment"</span>, <span class="hljs-variable">$payment</span>->getId(), <span class="hljs-keyword">null</span>, <span class="hljs-variable">$payment</span>);
|
||||||
|
|
||||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$payment</span>;</div></div></div></div></body></html>
|
<span class="hljs-keyword">return</span> <span class="hljs-variable">$payment</span>;</div></div></div></div></body></html>
|
||||||
@@ -1218,6 +1218,17 @@ if (PHP_SAPI == 'cli') {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8"><h5>Get Third Party Invoice</h5></div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<a href="invoice/GetThirdPartyInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
|
||||||
|
class="fa fa-play-circle-o"></i></a>
|
||||||
|
<a href="doc/invoice/GetThirdPartyInvoice.html" class="btn btn-default pull-right">Source <i
|
||||||
|
class="fa fa-file-code-o"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8"><h5>Send an Invoice</h5></div>
|
<div class="col-md-8"><h5>Send an Invoice</h5></div>
|
||||||
|
|||||||
@@ -105,12 +105,12 @@ try {
|
|||||||
$invoice->create($apiContext);
|
$invoice->create($apiContext);
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||||
ResultPrinter::printError("Create Invoice", "Invoice", null, $request, $ex);
|
ResultPrinter::printError("Create Third Party Invoice", "Invoice", null, $request, $ex);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||||
ResultPrinter::printResult("Create Invoice", "Invoice", $invoice->getId(), $request, $invoice);
|
ResultPrinter::printResult("Create Third Party Invoice", "Invoice", $invoice->getId(), $request, $invoice);
|
||||||
|
|
||||||
|
|
||||||
// ### Send Invoice
|
// ### Send Invoice
|
||||||
@@ -121,12 +121,11 @@ try {
|
|||||||
$invoice = Invoice::get($invoice->getId(), $apiContext);
|
$invoice = Invoice::get($invoice->getId(), $apiContext);
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||||
ResultPrinter::printError("Send Invoice", "Invoice", null, $request, $ex);
|
ResultPrinter::printError("Send Third Party Invoice", "Invoice", null, $request, $ex);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||||
ResultPrinter::printResult("Send Invoice", "Invoice", $invoice->getId(), $request, $invoice);
|
ResultPrinter::printResult("Send Third Party Invoice", "Invoice", $invoice->getId(), $request, $invoice);
|
||||||
|
|
||||||
|
|
||||||
return $invoice;
|
return $invoice;
|
||||||
|
|||||||
38
sample/invoice/GetThirdPartyInvoice.php
Normal file
38
sample/invoice/GetThirdPartyInvoice.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// # Get Third Invoice Sample
|
||||||
|
// This sample code demonstrate how you can retrieve
|
||||||
|
// a third party invoice.
|
||||||
|
|
||||||
|
/** @var Invoice $invoice */
|
||||||
|
$invoice = require 'CreateThirdPartyInvoice.php';
|
||||||
|
use PayPal\Api\Invoice;
|
||||||
|
|
||||||
|
$invoiceId = $invoice->getId();
|
||||||
|
|
||||||
|
// Step 1. This would be refresh token retrieved from http://paypal.github.io/PayPal-PHP-SDK/sample/doc/lipp/ObtainUserConsent.html
|
||||||
|
$refreshToken = "SCNWVZfdg43XaOmoEicazpkXyda32CGnP208EkuQ_QBIrXCYMhlvORFHHyoXPT0VbEMIHYVJEm0gVf1Vf72YgJzPScBenKoVPq__y1QRT7wwJo3WYADwUW4Q5ic";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// ### Step 2
|
||||||
|
// Update your apiContext with refresh token obtained from Step 1.
|
||||||
|
$apiContext->getCredential()->updateAccessToken($apiContext->getConfig(), $refreshToken);
|
||||||
|
|
||||||
|
// ### Retrieve Invoice
|
||||||
|
// Retrieve the invoice object by calling the
|
||||||
|
// static `get` method
|
||||||
|
// on the Invoice class by passing a valid
|
||||||
|
// Invoice ID
|
||||||
|
// (See bootstrap.php for more on `ApiContext`)
|
||||||
|
// Similar calls can be done to search invoices, delete, and update.
|
||||||
|
$retrievedInvoice = Invoice::get($invoiceId, $apiContext);
|
||||||
|
|
||||||
|
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||||
|
ResultPrinter::printResult("Get Third Party Invoice", "Invoice", $retrievedInvoice->getId(), $invoiceId, $retrievedInvoice);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||||
|
ResultPrinter::printError("Get Third Party Invoice", "Invoice", $invoiceId, $invoiceId, $ex);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $retrievedInvoice;
|
||||||
Reference in New Issue
Block a user