Change status in Invoice using API - Quickbooks - api

I am working on Integrating Invoices to Quickbooks. I would like to change the Invoice status to Paid when creating/updating Invoice to Quickbook.
I don't find any way to update the Status of Invoice.
Any help would be really appreciated.

Invoices get marked paid in QuickBooks by applying a payment to the invoice.
Thus, you should review the documentation on creating PAYMENTS in QuickBooks:
https://developer.intuit.com/docs/api/accounting/payment

I noticed that when adding an invoice using the API its marked as paid / deposited even though i didn't add any payment.
To create an unpaid invoice I added: "LinkedTxn" => [],
so my request looks like this:
$theResourceObj = Invoice::create([
"Line" => $lineArray,
"DocNumber" => $invoiceid,
"GlobalTaxCalculation" => "TaxExcluded",
"ExchangeRate" => $exchangerate, #0.856164,
"LinkedTxn" => [],
"TxnDate" => $date, #2019-11-15
"DueDate" => $duedate,#2019-12-21
"InvoiceLink" => "https://my.webshop.com/?invoice=".$invoiceid,
"CustomerRef"=> [
"value"=> $quickbID
],
"CurrencyRef"=> [
"value"=> $currencycode #EUR
]
]);
Once invoice is added you should add the payment/s.
this will mark payment as paid.

Related

Prestashop 1.7 - which hook to use in a module to get the used edited product quantity

I am building a simple module where I need to catch a backoffice quantity modification event (for product or variations) in real time and send the new quantity to an external API.
I am struggling in understanding which hook to use to get the actual user inserted quantity and not the "previous" product quantity.
If I use the static method StockAvailable::getQuantityAvailableByProduct inside the hookActionProductUpdate in my module, I am getting the original product quantity and not the new one, probably because the hook is called before the actual DB update.
Any clue ?
Try with: actionUpdateQuantity
You can pass the next parameters:
array(
'id_product' => (int) Product ID,
'id_product_attribute' => (int) Product attribute ID,
'quantity' => (int) New product quantity
);
List of hook here : https://devdocs.prestashop.com/1.7/modules/concepts/hooks/list-of-hooks/

Adding a sales receipt to Quickbooks Online with .NET using the IPP SDK API

This probably has a really obvious answer, but I've been stuck searching for it for a few hours now.
I'm trying to figure out how to create the sales receipt using the sdk api, for linking a payment made by a customer to his invoice. As far as I can tell, if I don't do this, the payment will get deposited to the account but the invoice will never be updated.
I'm able to read invoices, make credit card or echeck payments, and read the customer record.
But I'm trying to create a sales receipt, and I'm not quite sure how to do it.
I can read the customer record but how do I add it to the sales receipt?
This just gives me a syntax error:
Customer customer = readCustomerUsingEmail(email);
SalesReceipt salesReceipt = new SalesReceipt();
salesReceipt.CustomerRef = Customer;
When I hover over customer, it states "Cannot implicitly convert type 'Intuit.Ipp.Data.Customer' to 'Intuit.Ipp.Data.ReferenceType'".
Edit: Ok. I'm now using the Payment object instead of the SalesReceipt object.
I think I've figured out the answer but I haven't run it yet. It just doesn't show a syntax error.
ReferenceType customerRef = new ReferenceType()
{
Value = customerData.Customer.Id,
name = customerData.Customer.DisplayName
};
payment.CustomerRef = customerRef;
You're attempting to do something very wrong here: create the sales receipt using the sdk api, for linking a payment made by a customer to his invoice
That is not what a sales receipt does.
Invoice - Indicates a customer owes you money.
Payment - Indicates a customer paid you money -- this is essentially the "other side" of an invoice. You create an invoice to indicate they owe money, and you create a payment to pay off the invoice.
Sales Receipt - Indicates a customer both owed you money and already paid. e.g. this is essentially an invoice and a payment combined into one object, for use when both the invoice and payment happened at the same time.
Soooo...
A sales receipt can not link to an invoice
A sales receipt is not used to link a payment to an invoice
What you should be doing is just creating a payment, and linking the payment directly to the invoice. To create a payment, you need to supply at minimum:
The customer (the CustomerRef field)
The total amount (the TotalAmt field)
A Line object (for use linking to an invoice)
The line Amount (if it's a payment for a single invoice this generally be equal to the TotalAmt field
A LinkedTxn node, which a link to the Invoice to pay (the TxnId field)
See the examples of creating a payment and additional docs here: https://developer.intuit.com/docs/api/accounting/payment
Example:
{
"CustomerRef":
{
"value": "20",
"name": "Red Rock Diner"
},
"TotalAmt": 55.00,
"Line": [
{
"Amount": 55.00,
"LinkedTxn": [
{
"TxnId": "69",
"TxnType": "Invoice"
}]
}]
}
There's tons of sample code here:
https://developer.intuit.com/docs/00_quickbooks_online/2_build/40_sdks/01_.net/0004_sample_code_and_sample_apps
And one specific to Payments here:
https://github.com/IntuitDeveloper/SampleApp-CRUD-.Net/blob/master/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/TransactionEntities/Payment.cs

How to change the next billing date with Braintree

I've looked over the docs (https://www.braintreepayments.com/docs/ruby/subscriptions/overview) and cannot see if it's possible to change the next billing date of an active subscription.
We want the ability to pause our user's subscriptions without cancelling their subscription. So I'm hoping we can update the user's next billing date by 1, 3, or 6 months at a time.
I work at Braintree. If you have trouble finding anything else in our docs, please feel free to reach out to our support team.
The list of updateable fields on subscriptions is:
subscription id
price
plan
payment method token
add-on and discount details
number of billing cycles
merchant account
The next billing date is calculated, and so can't be changed.
Instead, you can add a discount that will reduce the price to zero for a number of months:
result = Braintree::Subscription.update(
"the_subscription_id",
:discounts => {
:add => [
{
:inherited_from_id => "discount_id_1",
:amount => BigDecimal.new("7.00"),
:number_of_billing_cycles => 3
}
]
}
)

Amazon Product Advertising API - How I can fetch more than 100 results with ItemSearch?

does the ItemSearch operation have parameters like offset? I need to fetch more than 100 results, I don't mind if I have to execute more queries.
The parameters I use are the following:
'Service' => "AWSECommerceService",
'AssociateTag' => [TAG],
'AWSAccessKeyId' => [ID],
'Operation' => "ItemSearch",
'BrowseNode' => "2445220011",
'Condition' => "All",
'ItemPage' => $_GET["p"],
'Timestamp' => date("Y-m-d\TH:i:s.\\0\\0\\0\\Z"),
'ResponseGroup' => "ItemAttributes",
'SearchIndex' => "VideoGames"
You can add parameters like MinPrice & MaxPrice and send your request in different price ranges to get more that 100 results. But still you end up having 100 products for that price range.
You can even add Keyword parameter i your request and can send different closely related values for this parameter.
Per the documentation:
ItemSearch returns up to ten search results per page.
The ItemPage parameter enables you to return a specified page of results. The maximum ItemPage number that can be returned is 10.
This is seemingly impossible, and your only option is likely to capture MoreSearchResultsURL out of the response:
MoreSearchResultsURL: The URL where the complete search results are displayed. The URLs provided in the search results are the exact ones that you should use when you link back to Amazon.com. They are tagged with your Associate tag and contain other tracking information to increase your hourly request limit as the sales that you generate increase.
Source: http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html
We can use Manufacturer parameter(Panasonic,Sony etc) to retrieve more results from specific category using Amazon Product Advertising API,
'Service' => "AWSECommerceService",
'AssociateTag' => [TAG],
'AWSAccessKeyId' => [ID],
'Operation' => "ItemSearch",
'BrowseNode' => "2445220011",
'Manufacturer' => "Panasonic",
'ItemPage' => $_GET["p"],
'Timestamp' => date("Y-m-d\TH:i:s.\0\0\0\Z"),
'ResponseGroup' => "Large",
'SearchIndex' => "Electronics"

Add additional information to a order after payment in Big Commerce

I would like to add additional information to a customers order after they have made the payment and landed on the confirmation page.
I sell products that have to be installed into the customers car. I would like to capture the customers car make model and year of registration (perferably after the order have been taken to not distract from the sale process).
I was hoping this could be done with the Bigcommerce API; where I could present the customer with a form they can fill in, after they have purchased, on the Order confirmation page and the data can get added to the customers order somehow.
Is this possible or would it be easier to caputre the car details in the cart or checkout?
BTW: not all products will come with vehicle installation.
Has anyone done anything similar using the Big Commerce API?
You can have the customer add it in as a note during check-out, this might be the most economical route.
Not as of today. The PUT request for orders does not allow the same fields as POST (order creation) - http://developer.bigcommerce.com/api/orders#put-ordersidjson
But, this is slated to be pushed in the coming weeks. Then you will be able to simply execute a PUT request on a captured order to update the "staff_notes" or "customer_message" field.
However, if you want to capture this during order creation via API, you can already do something like the following -
$createFields = array('customer_id'=>0, 'date_created' => 'Tue, 20 Nov 2012 00:00:00 +0000','status_id'=>1,'billing_address' => array( "first_name"=> "Trisha", "last_name"=> "McLaughlin", "company"=> "", "street_1"=> "12345 W Anderson Ln", "street_2"=> "", "city"=> "Austin", "state"=> "Texas", "zip"=> "78757", "country"=> "United States", "country_iso2"=> "US", "phone"=> "", "email"=> "elsie#example.com" ), "shipping_addresses" => array(), "external_source" => "POS", "products" => array(), "staff_notes" => "some notes here" );
print_r(Bigcommerce::createOrder($createFields));