I'm trying to add company name when I add a new customer, anyone can help?
By the way, where is the documentation for quickboos-php devkit , I can't find it as well.
The below is the code:
$CustomerService = new QuickBooks_IPP_Service_Customer();
//add basic info
$Customer = new QuickBooks_IPP_Object_Customer();
$Customer->setTitle($title);
$Customer->setGivenName($given_name);
$Customer->setMiddleName($middel_name);
$Customer->setFamilyName($family_name);
$Customer->setDisplayName($display_name);
// Phone #
$PrimaryPhone = new QuickBooks_IPP_Object_PrimaryPhone();
$PrimaryPhone->setFreeFormNumber($primary_phone);
$Customer->setPrimaryPhone($PrimaryPhone);
// Mobile #
$Mobile = new QuickBooks_IPP_Object_Mobile();
$Mobile->setFreeFormNumber($mobile);
$Customer->setMobile($Mobile);
// Bill address
$BillAddr = new QuickBooks_IPP_Object_BillAddr();
$BillAddr->setLine1($bill_address);
$BillAddr->setCity($bill_city);
$BillAddr->setCountrySubDivisionCode($bill_state);
$BillAddr->setCountry($bill_country);
$BillAddr->setPostalCode($bill_zip_code);
$Customer->setBillAddr($BillAddr);
// Shipping address
$ShipAddr = new QuickBooks_IPP_Object_ShipAddr();
$ShipAddr->setLine1($address_1);
$ShipAddr->setLine2($address_2);
$ShipAddr->setCity($city);
$ShipAddr->setCountrySubDivisionCode($province);
$ShipAddr->setCountry($country);
$ShipAddr->setPostalCode($postal_code);
$Customer->setShipAddr($ShipAddr);
$customer_id = $CustomerService->add($Context, $realm, $Customer);
The list of available fields for Customer objects is on Intuit's website:
https://developer.intuit.com/docs/api/accounting/customer
You're probably looking for:
CompanyName:
optional
String, maximum of 50 chars, filterable, sortable, default is null
The name of the company associated with the person or organization.
Unsurprisingly, there's a couple of corresponding methods:
$Customer->setCompanyName($v);
$v = $Customer->getCompanyName();
Related
I'm currently using square/connect-php-sdk createOrder to create a Square Order.
$api_config = new SquareConnect\Configuration();
$api_config->setAccessToken($access_token);
$api_config->setHost($host);
$api_client = new SquareConnect\ApiClient($api_config);
$apiInstance = new SquareConnect\Api\OrdersApi($api_client);
$orderRequest = new SquareConnect\Model\CreateOrderRequest();
$orderRequest->setIdempotencyKey(uniqid());
$order = new SquareConnect\Model\Order();
$money = new SquareConnect\Model\Money();
$money->setAmount(intval(500))
->setCurrency("USD");
$line_item = new SquareConnect\Model\OrderLineItem();
$line_item->setCatalogObjectId(<square item id>)
->setQuantity("1")
->setBasePriceMoney($money);
$line_items[] = $line_item;
$order->setLineItems($line_items);
$orderRequest->setOrder($order);
$result = $apiInstance->createOrder($location_id, $orderRequest);
This returns an Order ID (along with other order data) which I store locally.
I then process a credit card using the Square Payment Form: https://developer.squareup.com/docs/payment-form/payment-form-walkthrough
This gives me a nonce which I then send with the Order ID and the price.
$apiInstance = new SquareConnect\Api\PaymentsApi($api_client);
$paymentRequest = new SquareConnect\Model\CreatePaymentRequest();
$paymentRequest->setIdempotencyKey(uniqid());
$paymentRequest->setLocationId($location_id);
$money = new SquareConnect\Model\Money();
$money->setAmount(intval($total_cost))
->setCurrency("USD");
$paymentRequest->setAmountMoney($money);
$paymentRequest->setOrderId($sq_order_id);
$paymentRequest->setSourceId($nonce);
$result = $apiInstance->createPayment($paymentRequest);
This gives me a Payment ID (along with other payment data).
On the Square Dashboard, I am able to see the transaction in the Transactions section, but the Orders section of the dashboard is empty.
My question is How do I get it to show in the Orders section?
In order for the order to show up in your dashboard you need to do two things:
1. Pay for the order (it sounds like you did this part)
2. Include a fulfillments parameter in the CreateOrder request: https://developer.squareup.com/docs/orders-api/order-ahead-usecase#add-fulfillment-information-to-make-a-pickup-order
I can't seem to get this to work:
I have a parent company called
"XYZ Parent Company"
and a sub company called
"XYZ sub Company"
The Parent company exists in quickbooks already. I need to add the sub company with the parent know. I try this and it does not add the child only makes new customer. I am sure I am missing two things but I can't find what???
include 'blah blah directoty/example_app_ipp_v3/config.php';
// Set up the IPP instance
$IPP = new QuickBooks_IPP($dsn);
// Get our OAuth credentials from the database
$creds = $IntuitAnywhere->load($the_username, $the_tenant);
// Tell the framework to load some data from the OAuth store
$IPP->authMode(
QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds);
// Print the credentials we're using
//print_r($creds);
// This is our current realm
$realm = $creds['qb_realm'];
// Load the OAuth information from the database
if ($Context = $IPP->context())
{
// Set the IPP version to v3
$IPP->version(QuickBooks_IPP_IDS::VERSION_3);
$CustomerService = new QuickBooks_IPP_Service_Customer();
$Customer = new QuickBooks_IPP_Object_Customer();
$Customer->setName('99999');
//$Customer->setPhone('860-634-1602');
//$Customer->setEmail('keith#uglyslug.com');
$Customer->setCompanyName('XYZ Sub Company Name');
$Customer->setDisplayName('XYZ Sub Company Name');
$Customer->setFirstName('Bill');
$Customer->setLastName('Gates');
// Set the parent of the customer
$Customer->setParentFullName('XYZ Existing Parent Company Name');
This is incorrect:
// Set the parent of the customer
$Customer->setParentFullName('XYZ Existing Parent Company Name');
Per the QuickBooks API docs (http://developer.intuit.com/) you must specify the parent Id value to add a sub-customer underneath the parent customer. You can not specify the FullName (FullName isn't even a valid field name for the REST APIs, not sure where you got that from...).
You should be specifying:
$Customer->setParentRef(1234);
Where 1234 is the Id of the parent customer.
If you don't know the Id of the parent customer, you can query it like this:
$customers = $CustomerService->query($Context, $realm, "SELECT * FROM Customer WHERE FullyQualifiedName = 'your parent customer name here');
$Id = $customers[0]->getId();
I'm creating an invoice with multiple lines. Sales tax is set up in QuickBooks for multiple provinces. I've read through https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/global_tax_model to get an idea of how to properly integrate, but it's very confusing. I have to follow the international instructions because I am in Canada.
What I understand is that each SalesItemLineDetail gets set a TaxCode that I have to query for. How do I query for a specific GST rate? (Currently set up is GST and HST ON)
I also need tax to be exclusive. I could not find where to set this.
Do I need to add a TaxLine, or is that automatically done for me by QuickBooks?
Current snippet of my code looks like this:
// Set the IPP version to v3
$IPP->version(QuickBooks_IPP_IDS::VERSION_3);
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
$Invoice = new QuickBooks_IPP_Object_Invoice();
$Invoice->setDocNumber("DVL-".$invoice_id);
$Invoice->setTxnDate($orderdate);
$Line = new QuickBooks_IPP_Object_Line();
$Line->setDetailType('SalesItemLineDetail');
$Line->setDescription($service['name']);
$Line->setAmount($service['price']);
$orderTotal += $service['price'];
$SalesItemLineDetail = new QuickBooks_IPP_Object_SalesItemLineDetail();
$SalesItemLineDetail->setUnitPrice($service['price']);
$SalesItemLineDetail->setQty(1);
//set sales tax here?
$Line->addSalesItemLineDetail($SalesItemLineDetail);
$Invoice->addLine($Line);
So I figured it out. At least, what I have now works.
$TaxCodeService = new QuickBooks_IPP_Service_TaxCode();
if($property_details['province'] == "ON" || $property_details['province'] == "Ontario"){
$tax_name = "HST ON";
} else {
$tax_name = "GST";
}
$taxcodes = $TaxCodeService->query($Context, $realm, "SELECT * FROM TaxCode WHERE name = '".$tax_name."'");
$this_tax_code = "";
foreach ($taxcodes as $TaxCode)
{
$this_tax_code = $TaxCode->getId();
}
This gives me the ID of the rate that I want, and then when setting the SalesItemLineDetail simply:
$SalesItemLineDetail->setTaxCodeRef($this_tax_code);
I am working of CIM (Customer information manager) and i have created customer profile using CIM function. But i want to get customer profile using customer id instead of customer profile id.
$cim = new AuthnetCIM('***MASKED***', '***MASKED***', AuthnetCIM::USE_DEVELOPMENT_SERVER);
$cim->setParameter('email', 'fakeemail#example.com');
$cim->setParameter('description', 'Profile for Joe Smith'); // Optional
$cim->setParameter('merchantCustomerId', '7789812');
//create profile function
$ss=$cim->createCustomerProfile();
//and get profile by..
$profile_id = $cim->getProfileID();
You can't. You can only get the profile using the profile ID. This means you'll want to store that ID in your database and associate it with the customer's record so whenever you need to get their profile you know what their Profile ID is.
Actually it is possible if you must, however I would still recommend storing it if possible, but this alternative might be of help.
Authorize.Net defines a unique customer profile by the composite key (Merchant Customer Id, Email, and Description), thus you must ensure this is unique. The CreateCustomerProfile(..) API method will enforce uniqueness and return an error if you attempt to create the same composite key again, as it should. However, the message in this response will contain the conflicting customer profile id, and since your composite key is unique, and Authorize.Net enforces uniqueness of this composite key, then this must be the Authorize.Net customer profile id of your customer.
Code sample in C#
private long customerProfileId = 0;
var customerProfile = new AuthorizeNet.CustomerProfileType()
{
merchantCustomerId = "123456789",
email = "user#domain.com",
description = "John Smith",
};
var cpResponse = authorize.CreateCustomerProfile(merchantAuthentication, customerProfile, ValidationModeEnum.none);
if (cpResponse.resultCode == MessageTypeEnum.Ok)
{
customerProfileId = cpResponse.customerProfileId;
}
else
{
var regex = new Regex("^A duplicate record with ID (?<profileId>[0-9]+) already exists.$", RegexOptions.ExplicitCapture);
Match match = regex.Match(cpResponse.messages[0].text);
if (match.Success)
customerProfileId = long.Parse(match.Groups["profileId"].Value);
else
//Raise error.
}
Using the latest NetSuite PHP Toolkit v2012_2, how can I get the contents of lists and in particular custom lists?
For example, we have a custom list with options for how the customer heard about us. We modify this list from time to time. When a visitor to our site gets to our registration screen we’d like to pull in from NetSuite the list items for the custom list with id 3 (along with each list item’s id) so we can fill a drop-down box for use when creating a contact in NetSuite. This way we can maintain a single list in NetSuite and it will always be current in the website.
Credit and thanks to Saqib!
For reference, here is an example of the code that is now working:
$service = new NetSuiteService();
$service->setSearchPreferences(false, 20);
$recordRef = new RecordRef();
$recordRef->internalId = 1;
$searchField = new SearchMultiSelectField();
$searchField->operator = "anyOf";
$searchField->searchValue = $recordRef;
$search = new CustomListSearchBasic();
$search->internalId = $searchField;
$request = new SearchRequest();
$request->searchRecord = $search;
$searchResponse = $service->search($request);
var_dump($searchResponse);
die();
Perhaps http://tellsaqib.github.com/NSPHP-Doc/ could help you in coding it yourself.