forked from LiveCarta/PayPal-PHP-SDK
Adding Discount to Invoice Samples
This commit is contained in:
@@ -118,45 +118,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/CreatePlan",
|
||||
"title": "CreatePlan"
|
||||
},
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Create Plan Sample",
|
||||
"slug": "create-plan-sample"
|
||||
},
|
||||
"depth": 1
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Basic Information",
|
||||
"slug": "basic-information"
|
||||
},
|
||||
"depth": 1
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Payment definitions for this billing plan.",
|
||||
"slug": "payment-definitions-for-this-billing-plan"
|
||||
},
|
||||
"depth": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Create Plan",
|
||||
"slug": "create-plan"
|
||||
},
|
||||
"depth": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -336,29 +298,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/UpdatePlan",
|
||||
"title": "UpdatePlan"
|
||||
},
|
||||
"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": "Making Plan Active",
|
||||
"slug": "making-plan-active"
|
||||
},
|
||||
"depth": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -422,7 +362,112 @@ 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": "invoice/CreateInvoice",
|
||||
"title": "CreateInvoice"
|
||||
},
|
||||
"depth": 2
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Create Invoice Sample",
|
||||
"slug": "create-invoice-sample"
|
||||
},
|
||||
"depth": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Invoice Info",
|
||||
"slug": "invoice-info"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Merchant Info",
|
||||
"slug": "merchant-info"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Address Information",
|
||||
"slug": "address-information"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Billing Information",
|
||||
"slug": "billing-information"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Items List",
|
||||
"slug": "items-list"
|
||||
},
|
||||
"depth": 3,
|
||||
"children": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 4,
|
||||
"title": "Tax Item",
|
||||
"slug": "tax-item"
|
||||
},
|
||||
"depth": 4
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 4,
|
||||
"title": "Tax Item",
|
||||
"slug": "tax-item"
|
||||
},
|
||||
"depth": 4
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 4,
|
||||
"title": "Final Discount",
|
||||
"slug": "final-discount"
|
||||
},
|
||||
"depth": 4
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Shipping Information",
|
||||
"slug": "shipping-information"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Logo",
|
||||
"slug": "logo"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Create Invoice",
|
||||
"slug": "create-invoice"
|
||||
},
|
||||
"depth": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -1156,93 +1201,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/CreatePaymentUsingPayPal",
|
||||
"title": "CreatePaymentUsingPayPal"
|
||||
},
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Create Payment using PayPal as payment method",
|
||||
"slug": "create-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": "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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -1260,93 +1219,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/CreatePaymentUsingSavedCard",
|
||||
"title": "CreatePaymentUsingSavedCard"
|
||||
},
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Create payment using a saved credit card",
|
||||
"slug": "create-payment-using-a-saved-credit-card"
|
||||
},
|
||||
"depth": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Credit card token",
|
||||
"slug": "credit-card-token"
|
||||
},
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -1364,37 +1237,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/ExecutePayment",
|
||||
"title": "ExecutePayment"
|
||||
},
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Execute Payment Sample",
|
||||
"slug": "execute-payment-sample"
|
||||
},
|
||||
"depth": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Approval Status",
|
||||
"slug": "approval-status"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Payment Execute",
|
||||
"slug": "payment-execute"
|
||||
},
|
||||
"depth": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -1448,29 +1291,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",
|
||||
"title": "GetPayment"
|
||||
},
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -1488,29 +1309,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/ListPayments",
|
||||
"title": "ListPayments"
|
||||
},
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "GetPaymentList",
|
||||
"slug": "getpaymentlist"
|
||||
},
|
||||
"depth": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Retrieve payment",
|
||||
"slug": "retrieve-payment"
|
||||
},
|
||||
"depth": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -1546,53 +1345,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/OrderCapture",
|
||||
"title": "OrderCapture"
|
||||
},
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Capture Order Sample",
|
||||
"slug": "capture-order-sample"
|
||||
},
|
||||
"depth": 1,
|
||||
"children": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Approval Status",
|
||||
"slug": "approval-status"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Retrieve the order",
|
||||
"slug": "retrieve-the-order"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Create Capture Object",
|
||||
"slug": "create-capture-object"
|
||||
},
|
||||
"depth": 3
|
||||
}, {
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 3,
|
||||
"title": "Capture Order",
|
||||
"slug": "capture-order"
|
||||
},
|
||||
"depth": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
@@ -2074,18 +1827,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": "vault/GetCreditCard",
|
||||
"title": "GetCreditCard"
|
||||
},
|
||||
"depth": 2,
|
||||
"outline": [
|
||||
{
|
||||
"type": "heading",
|
||||
"data": {
|
||||
"level": 1,
|
||||
"title": "Get Credit Card Sample",
|
||||
"slug": "get-credit-card-sample"
|
||||
},
|
||||
"depth": 1
|
||||
}
|
||||
]
|
||||
"depth": 2
|
||||
}, {
|
||||
"type": "file",
|
||||
"data": {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/CreateInvoice</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/CreateInvoice"><meta name="groc-project-path" content="invoice/CreateInvoice.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/CreateInvoice.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 create
|
||||
an invoice.</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">Cost</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">MerchantInfo</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>;
|
||||
@@ -65,10 +66,12 @@ detailed breakdown of invoice</p></div></div><div class="code"><div class="wrapp
|
||||
->setValue(<span class="hljs-number">5</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h4 id="tax-item">Tax Item</h4>
|
||||
<p>You could provide Tax information to each item.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$tax</span> = <span class="hljs-keyword">new</span> \PayPal\Api\Tax();
|
||||
<span class="hljs-variable">$tax</span>->setPercent(<span class="hljs-number">1</span>)->setName(<span class="hljs-string">"Local Tax on Sutures"</span>);
|
||||
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>]->setTax(<span class="hljs-variable">$tax</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Second Item</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$items</span>[<span class="hljs-number">1</span>] = <span class="hljs-keyword">new</span> InvoiceItem();
|
||||
<span class="hljs-variable">$items</span>[<span class="hljs-number">0</span>]->setTax(<span class="hljs-variable">$tax</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Second Item</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$items</span>[<span class="hljs-number">1</span>] = <span class="hljs-keyword">new</span> InvoiceItem();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Lets add some discount to this item.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$item1discount</span> = <span class="hljs-keyword">new</span> Cost();
|
||||
<span class="hljs-variable">$item1discount</span>->setPercent(<span class="hljs-string">"3"</span>);
|
||||
<span class="hljs-variable">$items</span>[<span class="hljs-number">1</span>]
|
||||
->setName(<span class="hljs-string">"Injection"</span>)
|
||||
->setQuantity(<span class="hljs-number">5</span>)
|
||||
->setDiscount(<span class="hljs-variable">$item1discount</span>)
|
||||
->setUnitPrice(<span class="hljs-keyword">new</span> Currency());
|
||||
|
||||
<span class="hljs-variable">$items</span>[<span class="hljs-number">1</span>]->getUnitPrice()
|
||||
@@ -78,7 +81,10 @@ detailed breakdown of invoice</p></div></div><div class="code"><div class="wrapp
|
||||
<span class="hljs-variable">$tax2</span>->setPercent(<span class="hljs-number">3</span>)->setName(<span class="hljs-string">"Local Tax on Injection"</span>);
|
||||
<span class="hljs-variable">$items</span>[<span class="hljs-number">1</span>]->setTax(<span class="hljs-variable">$tax2</span>);
|
||||
|
||||
<span class="hljs-variable">$invoice</span>->setItems(<span class="hljs-variable">$items</span>);
|
||||
<span class="hljs-variable">$invoice</span>->setItems(<span class="hljs-variable">$items</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h4 id="final-discount">Final Discount</h4>
|
||||
<p>You can add final discount to the invoice as shown below. You could either use "percent" or "value" when providing the discount</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$cost</span> = <span class="hljs-keyword">new</span> Cost();
|
||||
<span class="hljs-variable">$cost</span>->setPercent(<span class="hljs-string">"2"</span>);
|
||||
<span class="hljs-variable">$invoice</span>->setDiscount(<span class="hljs-variable">$cost</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"><h3 id="shipping-information">Shipping Information</h3></div></div></div><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>->getShippingInfo()
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// an invoice.
|
||||
|
||||
require __DIR__ . '/../bootstrap.php';
|
||||
use PayPal\Api\Cost;
|
||||
use PayPal\Api\Invoice;
|
||||
use PayPal\Api\MerchantInfo;
|
||||
use PayPal\Api\BillingInfo;
|
||||
@@ -91,9 +92,13 @@ $items[0]->setTax($tax);
|
||||
|
||||
// Second Item
|
||||
$items[1] = new InvoiceItem();
|
||||
// Lets add some discount to this item.
|
||||
$item1discount = new Cost();
|
||||
$item1discount->setPercent("3");
|
||||
$items[1]
|
||||
->setName("Injection")
|
||||
->setQuantity(5)
|
||||
->setDiscount($item1discount)
|
||||
->setUnitPrice(new Currency());
|
||||
|
||||
$items[1]->getUnitPrice()
|
||||
@@ -108,6 +113,12 @@ $items[1]->setTax($tax2);
|
||||
|
||||
$invoice->setItems($items);
|
||||
|
||||
// #### Final Discount
|
||||
// You can add final discount to the invoice as shown below. You could either use "percent" or "value" when providing the discount
|
||||
$cost = new Cost();
|
||||
$cost->setPercent("2");
|
||||
$invoice->setDiscount($cost);
|
||||
|
||||
$invoice->getPaymentTerm()
|
||||
->setTermType("NET_45");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user