setMerchantInfo() public method

Information about the merchant who is sending the invoice.
public setMerchantInfo ( PayPal\Api\MerchantInfo $merchant_info )
$merchant_info PayPal\Api\MerchantInfo
use PayPal\Api\Address;
use PayPal\Api\BillingInfo;
use PayPal\Api\Cost;
use PayPal\Api\Currency;
use PayPal\Api\Invoice;
use PayPal\Api\InvoiceAddress;
use PayPal\Api\InvoiceItem;
use PayPal\Api\MerchantInfo;
use PayPal\Api\PaymentTerm;
use PayPal\Api\Phone;
use PayPal\Api\ShippingInfo;
$invoice = new Invoice();
// ### Invoice Info
// Fill in all the information that is
// required for invoice APIs
$invoice->setMerchantInfo(new MerchantInfo())->setBillingInfo(array(new BillingInfo()))->setNote("Medical Invoice 16 Jul, 2013 PST")->setPaymentTerm(new PaymentTerm())->setShippingInfo(new ShippingInfo());
// ### Merchant Info
// A resource representing merchant information that can be
// used to identify merchant
$invoice->getMerchantInfo()->setEmail("*****@*****.**")->setFirstName("Dennis")->setLastName("Doctor")->setbusinessName("Medical Professionals, LLC")->setPhone(new Phone())->setAddress(new Address());
$invoice->getMerchantInfo()->getPhone()->setCountryCode("001")->setNationalNumber("5032141716");
// ### Address Information
// The address used for creating the invoice
$invoice->getMerchantInfo()->getAddress()->setLine1("1234 Main St.")->setCity("Portland")->setState("OR")->setPostalCode("97217")->setCountryCode("US");
// ### Billing Information
// Set the email address for each billing
$billing = $invoice->getBillingInfo();
$billing[0]->setEmail("*****@*****.**");
$billing[0]->setBusinessName("Jay Inc")->setAdditionalInfo("This is the billing Info")->setAddress(new InvoiceAddress());
$billing[0]->getAddress()->setLine1("1234 Main St.")->setCity("Portland")->setState("OR")->setPostalCode("97217")->setCountryCode("US");
// ### Items List
Example #2
0
 public function createInvoice($params = null)
 {
     if (!$params) {
         return false;
     }
     $invoice = new Invoice();
     // ### Invoice Info
     // Fill in all the information that is
     // required for invoice APIs
     $invoice->setMerchantInfo(new MerchantInfo())->setBillingInfo(array(new BillingInfo()));
     // ### Merchant Info
     // A resource representing merchant information that can be
     // used to identify merchant
     $owner_email = $this->_credentials['business_owner'];
     $invoice->getMerchantInfo()->setEmail($owner_email);
     // ### Billing Information
     // Set the email address for each billing
     $billing = $invoice->getBillingInfo();
     $billing[0]->setEmail($params['email']);
     $items = [];
     foreach ($params['items'] as $key => $item) {
         # code...
         $items[$key] = new InvoiceItem();
         $items[$key]->setName($item['name'])->setQuantity($item['quantity'])->setUnitPrice(new Currency());
         $items[$key]->getUnitPrice()->setCurrency($params['currency'])->setValue((double) $item['price']);
     }
     // ### Items List
     $invoice->setItems($items);
     $request = clone $invoice;
     try {
         $invoice->create($this->config);
     } catch (\Exception $ex) {
         return $ex;
     }
     return $invoice;
 }