Adding a sales receipt to Quickbooks Online with .NET using the IPP SDK API - 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

Related

Bill Reference Number not populating in Xero API

I'm creating a bill (supplier invoice) in Xero API (C# .Net). Everything populates perfectly except for the Reference number which remains blank.
Excerpt:
var invoiceObject = new Invoice
{
Reference = "TEST123",
Contact = contact,
Date = DateTime.Now,
DueDate = DateTime.Now,
ExpectedPaymentDate = DateTime.Now,
Status = Xero.Api.Core.Model.Status.InvoiceStatus.Draft,
LineItems = lineItems,
Type = Xero.Api.Core.Model.Types.InvoiceType.AccountsPayable
};
var invoice = api.Invoices.Create(invoiceObject);
The following screenshot demonstrates the issue:
Every other field, lineitem, tax code, etc. populates perfectly.
I've tried different combinations of upper and lowercase characters, numbers, etc. but it doesn't work.
If I log in to Xero, open the Invoice and manually enter TEST123 an save the invoice, it works perfectly.
I've also tried saving the invoice, then editing it and re-saving in the API and the reference still does not populate.
How can I set the reference in the API?
Quick answer
Xero Invoice API docs indicate that you can't set the reference value for an ACCPAY invoice, but that whatever you put for the Invoice Number (which is a non-unique field on ACCPAY Invoices) will also appear in the reference field.
Explanation
I ran into this same issue. I found this comment on Xero's support forum:
https://community.xero.com/developer/discussion/40489223
... which says this:
Reference is presently slightly differently based on whether the
invoice is a sales invoice (ACCREC) or a purchase invoice/bill
(ACCPAY). For a bill the reference is presented in the InvoiceNumber
element, check our documentation on invoices here where we explain
this in more detail.
From the linked to docs
All that said, the screenshot you include in your post does have a "reference" input on it, but that's not an input for the invoice's reference value - that's an input for a possible reference value for a payment you enter against the invoice. The reference value for an invoice appears at the top next to the due date:
I have the exact same issue. I'm using Python Xero but hopefully, it is the same for Javascript.
In my case, I have to use InvoiceNumber instead of Reference for bills.

How I get the Customer from payouts data in Shopify? Using payouts Id

I want to do the integration Shopify to NetSuite.In the enter image description here giving the detail of my payouts api and response data.using that payout id I want pull the customer for that payout to generate the Netsuite deposit record against that customer which is already present in Netsuite account.please suggest me using that id how and which API needs to call to get the customer.
Following is my Response using API
GET/admin/shopify_payments/payouts.json?status=paid
Response :
{
"payouts": [
{
"id": 23420993582,
"status": "paid",
"date": "2019-01-29",
"currency": "USD",
"amount": "46050.05",
"summary": {
"adjustments_fee_amount": "0.00",
"adjustments_gross_amount": "20.62",
"charges_fee_amount": "1122.23",
"charges_gross_amount": "48097.76",
"refunds_fee_amount": "0.00",
"refunds_gross_amount": "-946.10",
"reserved_funds_fee_amount": "0.00",
"reserved_funds_gross_amount": "0.00",
"retried_payouts_fee_amount": "0.00",
"retried_payouts_gross_amount": "0.00"
}
}
]
}
enter image description here
This means that you have one payout with id 23420993582. What you need to do now is lookup all the transactions related to this payout. These are available at the following resource:
GET/admin/shopify_payments/payouts/23420993582/transactions.json
This will return a property in the response called transactions which is an array of all the transactions with a payout_id of 23420993582. The first entry (index 0) is not a sales transaction -- it is a summary of the payout (note the type).
You can iterate of this array and use the source_order_id of each object to lookup the original order. In that order is where you will find the customer. Note the type of each item in the array. You will see charge, refund, payout, etc).
I also use NetSuite and for me, I was not really interested in finding the customer but rather the order_id. Since my NetSuite cash sales and refunds have the order_id on them (when they are created) i can match up existing sales and refunds to the NetSuite deposit. When you link the NetSuite transaction (in payment sublist of the deposit record)
Any discrepancies (commissions to shopify, etc) I log in the "other deposits" or "cash back" area of the NetSuite deposit.
Because the NetSuite deposit should have the exact same amount it is wise to total up the NetSuite transaction amount AND the shopify transaction amount. They should be the same, but things like currency conversion or edits or mistakes can cause the totals to be different and any difference will cause the deposit to not be saved.
If you have any discrepancy in the totals then programmatically create an additional cash back / other deposit entry to offset it.
if you have something to fix it is now clear in the transaction. You can always delete a deposit and redo it after fixing.

how to set currency code in square payment gateway? and what types of currency it support.?

i have integrate payment gateway in my web application on PHP and i want to use CAD or GBP for currency so how to use that currency and what types of currency support it.
I have to set as below:
$request_body2 = array("amount_money" => array (
"amount" => (int)$total_ammount,
"currency" => "USD"
));`);
You can find all of Square's supported currencies here.
In order to charge a card in a specific currency, your location must support that currency. See Square's documentation on Charge for v2 in the section for amount_money.
The value of currency must match the currency associated with the business that is charging the card.
You can also only create locations for the country with which you had registered your Square account. So if you had registered in the US, you can only create US locations and process USD on your Square account.
If you're processing payments on behalf of other Square accounts (using OAuth), then you could process the payment in the currency that matches that Square account's country.

How can I use Stripe to delay charging a customer until a physical item is shipped?

I'm in the process of building an online marketplace which sells shippable goods. The site will be similar to Etsy, which will connect merchants with buyers.
I'd like to be able to charge a customer's card ONLY when an item is shipped by a merchant to avoid chargebacks and provide an Amazon-like payment experience. This will also help us avoid chargebacks and payment disputes in case a merchant is slow to ship or flakes out. In some cases, the goods will take more than 7 days to be custom manufactured and shipped out
Here's an example timeline:
1/1/2014 - Customer adds $75 worth of items to their cart and clicks "buy". Enters credit card info.
1/1/2014 - Customer's card is verified and a $75 temporary hold is placed on their card. Order is sent to merchant for fulfillment.
1/14/2014 - Merchant ships goods to customer and adds shipping tracking info
1/14/2014 - Customer's card is charged for the full amount and merchant receives $75 minus fees.
I plan to use Stripe Connect for payment processing, but am not sure how to delay capturing a payment for more than 7 days. Any thoughts? I don't want to aggregate the funds under my own account and use payouts since this will likely run afoul of money transmission laws. Any help would be appreciated!
EDIT: It looks like Quora has a similar question here , but the answers don't seem to deal with the case where a merchant ships out the item but the payment fails.
After further research, it seems there's no way to delay capturing a charge past the 7 day authorization window.
But here's one way to delay a charge:
Tokenize a credit card using the stripe.js library
Create a new stripe customer passing in the token as the "card" param
An example from the Stripe FAQ: https://support.stripe.com/questions/can-i-save-a-card-and-charge-it-later
Note that the longer you wait between tokenizing a card and actually charging it, the more likely your charge will be declined for various reasons (expired card, lack of funds, fraud, etc). This also adds a layer of complexity (and lost sales) since you'll need to ask a buyer to resubmit payment info.
I'd still like to confirm that a certain amount can be charged (like a "preauthorization"), but this lets me at least charge the card at a later date.
Celery has built a service to help you do this with Stripe. They are very easy to use, but note that they charge 2% per transaction.
actually you can save user token and pay later with tracking info
# get the credit card details submitted by the form or app
token = params[:stripeToken]
# create a Customer
customer = Stripe::Customer.create(
card: token,
description: 'description for payinguser#example.com',
email: 'payinguser#example.com'
)
# charge the Customer instead of the card
Stripe::Charge.create(
amount: 1000, # in cents
currency: 'usd',
customer: customer.id
)
# save the customer ID in your database so you can use it later
save_stripe_customer_id(user, customer.id)
# later
customer_id = get_stripe_customer_id(user)
Stripe::Charge.create(
amount: 1500, # $15.00 this time
currency: 'usd',
customer: customer_id
)
Stripe release a delay method to place a hold without charging. https://stripe.com/docs/payments/capture-later
<?php
require_once('stripe-php/init.php');
\Stripe\Stripe::setApiKey('your stripe key');
$token = $_POST['stripeToken'];
$stripeinfo = \Stripe\Token::retrieve($token);
$email = $stripeinfo->email;
$customer = \Stripe\Customer::create(array(
"source" => $token,
"email" => $email)
);
?>

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));