Updated User Agent & More Samples for Billing Plans

- Fixed versioning in User Agent.
- Updated Billing Plan sample to update Payment definitions
- Docs & Tests
This commit is contained in:
japatel
2014-11-05 13:30:28 -06:00
parent d11533110b
commit f997f3277e
27 changed files with 611 additions and 439 deletions

View File

@@ -390,6 +390,46 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
]
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/billing/UpdatePlanPaymentDefinitions.php",
"projectPath": "billing/UpdatePlanPaymentDefinitions.php",
"targetPath": "billing/UpdatePlanPaymentDefinitions",
"pageTitle": "billing/UpdatePlanPaymentDefinitions",
"title": "UpdatePlanPaymentDefinitions"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 1,
"title": "Update a plan",
"slug": "update-a-plan"
},
"depth": 1,
"children": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Changing Plan Amount",
"slug": "changing-plan-amount"
},
"depth": 3
}
]
}
]
}
]
}, {

View File

@@ -55,7 +55,7 @@ Please note that the plan Id should be only set in this case.</p></div></div><di
<span class="hljs-variable">$plan</span>-&gt;setId(<span class="hljs-variable">$createdPlan</span>-&gt;getId());
<span class="hljs-variable">$agreement</span>-&gt;setPlan(<span class="hljs-variable">$plan</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer();
<span class="hljs-variable">$payer</span>-&gt;setPaymentMethod(<span class="hljs-string">'credit_card'</span>)
-&gt;setPayerInfo(<span class="hljs-keyword">new</span> PayerInfo([<span class="hljs-string">'email'</span> =&gt; <span class="hljs-string">'jaypatel512-facilitator@hotmail.com'</span>]));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Credit Card to Funding Instruments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$creditCard</span> = <span class="hljs-keyword">new</span> CreditCard();
-&gt;setPayerInfo(<span class="hljs-keyword">new</span> PayerInfo(<span class="hljs-keyword">array</span>(<span class="hljs-string">'email'</span> =&gt; <span class="hljs-string">'jaypatel512-facilitator@hotmail.com'</span>)));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Credit Card to Funding Instruments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$creditCard</span> = <span class="hljs-keyword">new</span> CreditCard();
<span class="hljs-variable">$creditCard</span>-&gt;setType(<span class="hljs-string">'visa'</span>)
-&gt;setNumber(<span class="hljs-string">'4417119669820331'</span>)
-&gt;setExpireMonth(<span class="hljs-string">'12'</span>)

View File

@@ -16,9 +16,9 @@ You should be able to see the acceptable values in the comments.</p></div></div>
-&gt;setFrequency(<span class="hljs-string">'Month'</span>)
-&gt;setFrequencyInterval(<span class="hljs-string">"2"</span>)
-&gt;setCycles(<span class="hljs-string">"12"</span>)
-&gt;setAmount(<span class="hljs-keyword">new</span> Currency([<span class="hljs-string">'value'</span> =&gt; <span class="hljs-string">'100'</span>, <span class="hljs-string">'currency'</span> =&gt; <span class="hljs-string">'USD'</span>]));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Charge Models</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$chargeModel</span> = <span class="hljs-keyword">new</span> ChargeModel();
-&gt;setAmount(<span class="hljs-keyword">new</span> Currency(<span class="hljs-keyword">array</span>(<span class="hljs-string">'value'</span> =&gt; <span class="hljs-number">100</span>, <span class="hljs-string">'currency'</span> =&gt; <span class="hljs-string">'USD'</span>)));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Charge Models</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$chargeModel</span> = <span class="hljs-keyword">new</span> ChargeModel();
<span class="hljs-variable">$chargeModel</span>-&gt;setType(<span class="hljs-string">'SHIPPING'</span>)
-&gt;setAmount(<span class="hljs-keyword">new</span> Currency([<span class="hljs-string">'value'</span> =&gt; <span class="hljs-string">'10'</span>, <span class="hljs-string">'currency'</span> =&gt; <span class="hljs-string">'USD'</span>]));
-&gt;setAmount(<span class="hljs-keyword">new</span> Currency(<span class="hljs-keyword">array</span>(<span class="hljs-string">'value'</span> =&gt; <span class="hljs-number">10</span>, <span class="hljs-string">'currency'</span> =&gt; <span class="hljs-string">'USD'</span>)));
<span class="hljs-variable">$paymentDefinition</span>-&gt;setChargeModels(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$chargeModel</span>));
@@ -29,7 +29,7 @@ You should be able to see the acceptable values in the comments.</p></div></div>
-&gt;setAutoBillAmount(<span class="hljs-string">"yes"</span>)
-&gt;setInitialFailAmountAction(<span class="hljs-string">"CONTINUE"</span>)
-&gt;setMaxFailAttempts(<span class="hljs-string">"0"</span>)
-&gt;setSetupFee(<span class="hljs-keyword">new</span> Currency([<span class="hljs-string">'value'</span> =&gt; <span class="hljs-string">'1'</span>, <span class="hljs-string">'currency'</span> =&gt; <span class="hljs-string">'USD'</span>]));
-&gt;setSetupFee(<span class="hljs-keyword">new</span> Currency(<span class="hljs-keyword">array</span>(<span class="hljs-string">'value'</span> =&gt; <span class="hljs-number">1</span>, <span class="hljs-string">'currency'</span> =&gt; <span class="hljs-string">'USD'</span>)));
<span class="hljs-variable">$plan</span>-&gt;setPaymentDefinitions(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$paymentDefinition</span>));

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html><html lang="en"><head><title>billing/UpdatePlanPaymentDefinitions</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="billing/UpdatePlanPaymentDefinitions"><meta name="groc-project-path" content="billing/UpdatePlanPaymentDefinitions.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">billing/UpdatePlanPaymentDefinitions.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="update-a-plan">Update a plan</h1>
<p>This sample code demonstrate how you can update a billing plan, as documented here at:
<a href="https://developer.paypal.com/webapps/developer/docs/api/#update-a-plan">https://developer.paypal.com/webapps/developer/docs/api/#update-a-plan</a>
API used: /v1/payments/billing-plans/<Plan-Id></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="changing-plan-amount">Changing Plan Amount</h3>
<p>This example demonstrate how you could change the plan amount</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieving the Plan object from Create Plan Sample to demonstrate the List</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Plan $createdPlan */</span>
<span class="hljs-variable">$createdPlan</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreatePlan.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Plan</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PatchRequest</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Patch</span>;
<span class="hljs-keyword">try</span> {
<span class="hljs-variable">$patch</span> = <span class="hljs-keyword">new</span> Patch();
<span class="hljs-variable">$paymentDefinitions</span> = <span class="hljs-variable">$createdPlan</span>-&gt;getPaymentDefinitions();
<span class="hljs-variable">$paymentDefinitionId</span> = <span class="hljs-variable">$paymentDefinitions</span>[<span class="hljs-number">0</span>]-&gt;getId();
<span class="hljs-variable">$patch</span>-&gt;setOp(<span class="hljs-string">'replace'</span>)
-&gt;setPath(<span class="hljs-string">'/payment-definitions/'</span> . <span class="hljs-variable">$paymentDefinitionId</span>)
-&gt;setValue(json_decode(
<span class="hljs-string">'{
"name": "Updated Payment Definition",
"frequency": "Day",
"amount": {
"currency": "USD",
"value": "50"
}
}'</span>
));
<span class="hljs-variable">$patchRequest</span> = <span class="hljs-keyword">new</span> PatchRequest();
<span class="hljs-variable">$patchRequest</span>-&gt;addPatch(<span class="hljs-variable">$patch</span>);
<span class="hljs-variable">$createdPlan</span>-&gt;update(<span class="hljs-variable">$patchRequest</span>, <span class="hljs-variable">$apiContext</span>);
<span class="hljs-variable">$plan</span> = Plan::get(<span class="hljs-variable">$createdPlan</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
ResultPrinter::printError(<span class="hljs-string">"Updated the Plan Payment Definition"</span>, <span class="hljs-string">"Plan"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$patchRequest</span>, <span class="hljs-variable">$ex</span>);
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
ResultPrinter::printResult(<span class="hljs-string">"Updated the Plan Payment Definition"</span>, <span class="hljs-string">"Plan"</span>, <span class="hljs-variable">$plan</span>-&gt;getId(), <span class="hljs-variable">$patchRequest</span>, <span class="hljs-variable">$plan</span>);
<span class="hljs-keyword">return</span> <span class="hljs-variable">$plan</span>;</div></div></div></div></body></html>

View File

@@ -14,7 +14,7 @@ with a valid ApiContext (See bootstrap.php for more on <code>ApiContext</code>)<
<span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amt</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"1.00"</span>);
-&gt;setTotal(<span class="hljs-number">1</span>);
<span class="hljs-comment">### Capture</span>
<span class="hljs-variable">$capture</span> = <span class="hljs-keyword">new</span> Capture();

View File

@@ -38,7 +38,7 @@ to correct setting. In this case, it would be &#39;authorize&#39;</p></div></div
<span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"1.00"</span>);
-&gt;setTotal(<span class="hljs-number">1</span>);
<span class="hljs-variable">$transaction</span> = <span class="hljs-keyword">new</span> Transaction();
<span class="hljs-variable">$transaction</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>)

View File

@@ -37,29 +37,29 @@ information</p></div></div><div class="code"><div class="wrapper"><span class="h
-&gt;setDescription(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">1</span>)
-&gt;setTax(<span class="hljs-string">'0.30'</span>)
-&gt;setPrice(<span class="hljs-string">'7.50'</span>);
-&gt;setTax(<span class="hljs-number">0.3</span>)
-&gt;setPrice(<span class="hljs-number">7.50</span>);
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item2</span>-&gt;setName(<span class="hljs-string">'Granola bars'</span>)
-&gt;setDescription(<span class="hljs-string">'Granola Bars with Peanuts'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">5</span>)
-&gt;setTax(<span class="hljs-string">'0.20'</span>)
-&gt;setPrice(<span class="hljs-string">'2.00'</span>);
-&gt;setTax(<span class="hljs-number">0.2</span>)
-&gt;setPrice(<span class="hljs-number">2</span>);
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
<span class="hljs-variable">$itemList</span>-&gt;setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
<p>Use this optional field to set additional
payment information such as tax, shipping
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-string">'1.20'</span>)
-&gt;setTax(<span class="hljs-string">'1.30'</span>)
-&gt;setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-number">1.2</span>)
-&gt;setTax(<span class="hljs-number">1.3</span>)
-&gt;setSubtotal(<span class="hljs-number">17.5</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<p>Lets you specify a payment amount.
You can also specify additional details
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"20.00"</span>)
-&gt;setTotal(<span class="hljs-number">20</span>)
-&gt;setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
<p>A transaction defines the contract of a
payment - what is the payment for and who

View File

@@ -19,26 +19,26 @@ information</p></div></div><div class="code"><div class="wrapper"><span class="h
<span class="hljs-variable">$item1</span>-&gt;setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">1</span>)
-&gt;setPrice(<span class="hljs-string">'7.50'</span>);
-&gt;setPrice(<span class="hljs-number">7.5</span>);
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item2</span>-&gt;setName(<span class="hljs-string">'Granola bars'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">5</span>)
-&gt;setPrice(<span class="hljs-string">'2.00'</span>);
-&gt;setPrice(<span class="hljs-number">2</span>);
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
<span class="hljs-variable">$itemList</span>-&gt;setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
<p>Use this optional field to set additional
payment information such as tax, shipping
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-string">'1.20'</span>)
-&gt;setTax(<span class="hljs-string">'1.30'</span>)
-&gt;setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-number">1.2</span>)
-&gt;setTax(<span class="hljs-number">1.3</span>)
-&gt;setSubtotal(<span class="hljs-number">17.50</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<p>Lets you specify a payment amount.
You can also specify additional details
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"20.00"</span>)
-&gt;setTotal(<span class="hljs-number">20</span>)
-&gt;setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
<p>A transaction defines the contract of a
payment - what is the payment for and who

View File

@@ -30,26 +30,26 @@ information</p></div></div><div class="code"><div class="wrapper"><span class="h
<span class="hljs-variable">$item1</span>-&gt;setName(<span class="hljs-string">'Ground Coffee 40 oz'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">1</span>)
-&gt;setPrice(<span class="hljs-string">'7.50'</span>);
-&gt;setPrice(<span class="hljs-number">7.5</span>);
<span class="hljs-variable">$item2</span> = <span class="hljs-keyword">new</span> Item();
<span class="hljs-variable">$item2</span>-&gt;setName(<span class="hljs-string">'Granola bars'</span>)
-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setQuantity(<span class="hljs-number">5</span>)
-&gt;setPrice(<span class="hljs-string">'2.00'</span>);
-&gt;setPrice(<span class="hljs-number">2</span>);
<span class="hljs-variable">$itemList</span> = <span class="hljs-keyword">new</span> ItemList();
<span class="hljs-variable">$itemList</span>-&gt;setItems(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$item1</span>, <span class="hljs-variable">$item2</span>));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="additional-payment-details">Additional payment details</h3>
<p>Use this optional field to set additional
payment information such as tax, shipping
charges etc.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$details</span> = <span class="hljs-keyword">new</span> Details();
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-string">'1.20'</span>)
-&gt;setTax(<span class="hljs-string">'1.30'</span>)
-&gt;setSubtotal(<span class="hljs-string">'17.50'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<span class="hljs-variable">$details</span>-&gt;setShipping(<span class="hljs-number">1.2</span>)
-&gt;setTax(<span class="hljs-number">1.3</span>)
-&gt;setSubtotal(<span class="hljs-number">17.5</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="amount">Amount</h3>
<p>Lets you specify a payment amount.
You can also specify additional details
such as shipping, tax.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>)
-&gt;setTotal(<span class="hljs-string">"20.00"</span>)
-&gt;setTotal(<span class="hljs-number">20</span>)
-&gt;setDetails(<span class="hljs-variable">$details</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="transaction">Transaction</h3>
<p>A transaction defines the contract of a
payment - what is the payment for and who

View File

@@ -12,7 +12,7 @@ has expired.</p></div></div><div class="code"><div class="wrapper"><span class="
<span class="hljs-variable">$amount</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amount</span>-&gt;setCurrency(<span class="hljs-string">"USD"</span>);
<span class="hljs-variable">$amount</span>-&gt;setTotal(<span class="hljs-string">"1.00"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorize-with-amount-being-reauthorized">Reauthorize with amount being reauthorized</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>);
<span class="hljs-variable">$amount</span>-&gt;setTotal(<span class="hljs-number">1</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="reauthorize-with-amount-being-reauthorized">Reauthorize with amount being reauthorized</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"> <span class="hljs-variable">$authorization</span>-&gt;setAmount(<span class="hljs-variable">$amount</span>);
<span class="hljs-variable">$reAuthorization</span> = <span class="hljs-variable">$authorization</span>-&gt;reauthorize(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {

View File

@@ -13,7 +13,7 @@ API used: /v1/payments/sale/{sale-id}/refund</p></div></div><div class="code"><d
and refunded fee (to Payee). Use the $amt-&gt;details
field to mention fees refund details.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$amt</span> = <span class="hljs-keyword">new</span> Amount();
<span class="hljs-variable">$amt</span>-&gt;setCurrency(<span class="hljs-string">'USD'</span>)
-&gt;setTotal(<span class="hljs-string">'0.01'</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="refund-object">Refund object</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-variable">$refund</span> = <span class="hljs-keyword">new</span> Refund();
-&gt;setTotal(<span class="hljs-number">0.01</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="refund-object">Refund object</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-variable">$refund</span> = <span class="hljs-keyword">new</span> Refund();
<span class="hljs-variable">$refund</span>-&gt;setAmount(<span class="hljs-variable">$amt</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="sale">Sale</h3>
<p>A sale transaction.
Create a Sale object with the