Update Payment Experience samples

This commit is contained in:
mrak and stevecoffey
2016-10-10 11:24:09 -07:00
parent 3f909f7f5e
commit a7e934e33a
6 changed files with 319 additions and 3101 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,11 +4,8 @@ an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="h
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</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> <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>-&gt;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> <p>Lets update some information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;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>
<p>sample, to get past the bug in PayPal APIs. <p>sample, to get past the bug in PayPal APIs.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setDiscount(<span class="hljs-keyword">null</span>);
There is already an internal ticket #PPTIPS-1932 created for it.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setDiscount(<span class="hljs-keyword">null</span>); <span class="hljs-variable">$invoice</span>-&gt;getItems()[<span class="hljs-number">1</span>]-&gt;setDiscount(<span class="hljs-keyword">null</span>);
<span class="hljs-variable">$billingInfo</span> = <span class="hljs-variable">$invoice</span>-&gt;getBillingInfo()[<span class="hljs-number">0</span>];
<span class="hljs-variable">$billingInfo</span>-&gt;setAddress(<span class="hljs-keyword">null</span>);
<span class="hljs-variable">$invoice</span>-&gt;getPaymentTerm()-&gt;setDueDate(<span class="hljs-keyword">null</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3> <span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3>
<p>Update an invoice by calling the invoice-&gt;update() method <p>Update an invoice by calling the invoice-&gt;update() method

File diff suppressed because one or more lines are too long

View File

@@ -13,6 +13,10 @@ $flowConfig = new \PayPal\Api\FlowConfig();
$flowConfig->setLandingPageType("Billing"); $flowConfig->setLandingPageType("Billing");
// The URL on the merchant site for transferring to after a bank transfer payment. // The URL on the merchant site for transferring to after a bank transfer payment.
$flowConfig->setBankTxnPendingUrl("http://www.yeowza.com/"); $flowConfig->setBankTxnPendingUrl("http://www.yeowza.com/");
// When set to "commit", the buyer is shown an amount, and the button text will read "Pay Now" on the checkout page.
$flowConfig->setUserAction("commit");
// Defines the HTTP method to use to redirect the user to a return URL. A valid value is `GET` or `POST`.
$flowConfig->setReturnUriHttpMethod("GET");
// Parameters for style and presentation. // Parameters for style and presentation.
$presentation = new \PayPal\Api\Presentation(); $presentation = new \PayPal\Api\Presentation();
@@ -22,7 +26,11 @@ $presentation->setLogoImage("http://www.yeowza.com/favico.ico")
// A label that overrides the business name in the PayPal account on the PayPal pages. // A label that overrides the business name in the PayPal account on the PayPal pages.
->setBrandName("YeowZa! Paypal") ->setBrandName("YeowZa! Paypal")
// Locale of pages displayed by PayPal payment experience. // Locale of pages displayed by PayPal payment experience.
->setLocaleCode("US"); ->setLocaleCode("US")
// A label to use as hypertext for the return to merchant link.
->setReturnUrlLabel("Return")
// A label to use as the title for the note to seller field. Used only when `allow_note` is `1`.
->setNoteToSellerLabel("Thanks!");
// Parameters for input fields customization. // Parameters for input fields customization.
$inputFields = new \PayPal\Api\InputFields(); $inputFields = new \PayPal\Api\InputFields();
@@ -43,7 +51,9 @@ $webProfile->setName("YeowZa! T-Shirt Shop" . uniqid())
// Parameters for style and presentation. // Parameters for style and presentation.
->setPresentation($presentation) ->setPresentation($presentation)
// Parameters for input field customization. // Parameters for input field customization.
->setInputFields($inputFields); ->setInputFields($inputFields)
// Indicates whether the profile persists for three hours or permanently. Set to `false` to persist the profile permanently. Set to `true` to persist the profile for three hours.
->setTemporary(true);
// For Sample Purposes Only. // For Sample Purposes Only.
$request = clone $webProfile; $request = clone $webProfile;