Mapping payments in IIF to QBXML - intuit-partner-platform

For having deprecated IIF, you'd think Intuit would make it easier to map the calls but I've found myself in something of a corner.
I have a fairly old script mapping our stuff to IIF.
!TRNS TRNSTYPE DATE ACCNT NAME AMOUNT DOCNUM MEMO CLEAR REP PAYMETH ADDR1 ADDR2 ADDR3 ADDR4
!SPL TRNSTYPE DATE ACCNT NAME AMOUNT DOCNUM MEMO CLEAR QNTY PRICE INVITEM PAYMETH EXTRA
!ENDTRNS
TRNS PAYMENT 1/21/2010 Paypal Account Dear Customer 1230.9 PAYPAL - Invoice123 N PAYPAL Dear Customer 123 Dear Dr
SPL PAYMENT 1/21/2010 Accounts Receivable Dear Customer -1230.9 Invoice123 PAYPAL - Invoice123 N PAYPAL
ENDTRNS
TRNS CHECK 1/21/2010 Paypal Account Paypal Account -29.84 Transaction Fees - Invoice123 N
SPL CHECK 1/21/2010 Fees:Paypal Fees Dear Customer 29.84 Transaction Fees - Invoice123 N
ENDTRNS
Now, I have a script that handles the customer and finding the right record in QB but I'm trying to find the right call to put all these records in. It looks like the first two can fit into ReceivePaymentAddRq but it's less clear on the second set.
Then I have another set that starts with BILL
TRNS BILL 5/15/2014 Accounts Payable Our Vendor -344.81 450608 N 6/14/2014 Net 30
SPL BILL 5/15/2014 Cost of Goods Sold:Purchases Dear Customer 344.81 450608 Invoice123 N
ENDTRNS
I think both fall under BillAdd but that COGS line could also fall under ChargeAdd

The transaction type PAYMENT would indeed be a ReceivePaymentAddRq. The CHECK type would be a CheckAddRq as you are not effecting an Accounts Receivable account. The transaction type of BILL would be a BillAddRq, as you are wanting to effect Accounts Payable. The ChargeAddRq is used for a customer charge, which is not the same as a CreditCardChargeAddRq.
It helps to have used QuickBooks manually a bit to understand the types of transactions that are used, but here's a quick little reference (these include the AddRq, QueryRq and ModRq where applicable). Note that this is not 100% as there are situations where you might use a different transaction type, but it's a good starting point:
Effect Accounts Receivable:
Invoice
ReceivePayment
Charge
CreditMemo
Effect Accounts Payable:
Bill
ItemReceipt
VendorCredit
BillPaymentCheck
BillPaymentCreditCard
Effect Bank Account:
Check
Deposit
Effect Credit Card Account:
CreditCardCharge
CreditCardCredit

Related

Passing the Billing Address to Paypal Express API

I am working on a small membership site in WordPress. We already have the users Name and Address and wish to pass that information to PayPal Express to prepopulate the Billing Information if the user chooses to pay by Debit or Credit Card. The site only sells to 5 countries at present (UK, US, AU, CA, NZ).
Using the Paypal Sandbox I can get the Billing information across to CA, AU and NZ but using the same nvp string (with variations for currency / country code) I can't pass it to the UK or US.
Here's my Working CA String:
&PAYMENTREQUEST_0_ITEMAMT=250.00
&PAYMENTREQUEST_0_CURRENCYCODE=CAD
&PAYMENTREQUEST_0_SHIPTONAME=Test User
&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=CA
&PAYMENTREQUEST_0_SHIPTOPHONENUM=01234567890
&PAYMENTREQUEST_0_SHIPTOSTREET=Test Address 1
&PAYMENTREQUEST_0_SHIPTOSTREET2=Test Address 2
&PAYMENTREQUEST_0_SHIPTOCITY=Test City
&PAYMENTREQUEST_0_SHIPTOSTATE=Test State
&PAYMENTREQUEST_0_SHIPTOZIP=123456
&DESC=Example+Description
&NOTIFYURL=http%3A%2F%2Fwww.example.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dipnhandler
&PAYMENTREQUEST_0_SHIPPINGAMT=30.00
&NOSHIPPING=0
&PAYMENTREQUEST_0_AMT=280
&L_BILLINGAGREEMENTDESCRIPTION0=Billing+Description
&L_PAYMENTTYPE0=Any
&ReturnUrl=http%3A%2F%2Fwww.example.com%2Freturnurl
&CANCELURL=http%3A%2F%2Fwww.example.com%2Fcancelurl
&SOLUTIONTYPE=Sole
&LANDINGPAGE=Billing
And here's my non-working UK string:
&PAYMENTREQUEST_0_ITEMAMT=135.00
&PAYMENTREQUEST_0_CURRENCYCODE=GBP
&PAYMENTREQUEST_0_SHIPTONAME=User Name
&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=UK
&PAYMENTREQUEST_0_SHIPTOPHONENUM=01234567890
&PAYMENTREQUEST_0_SHIPTOSTREET=Test Address 1
&PAYMENTREQUEST_0_SHIPTOSTREET2=Test Address 2
&PAYMENTREQUEST_0_SHIPTOCITY=Test City
&PAYMENTREQUEST_0_SHIPTOSTATE=Test State
&PAYMENTREQUEST_0_SHIPTOZIP=123456
&DESC=Example+Description
&NOTIFYURL=http%3A%2F%2Fwww.example.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dipnhandler
&PAYMENTREQUEST_0_SHIPPINGAMT=20.00
&NOSHIPPING=0
&PAYMENTREQUEST_0_AMT=155
&L_BILLINGAGREEMENTDESCRIPTION0=Billing+Description
&L_PAYMENTTYPE0=Any
&ReturnUrl=http%3A%2F%2Fwww.example.com%2Freturnurl
&CANCELURL=http%3A%2F%2Fwww.example.com%2Fcancelurl
&SOLUTIONTYPE=Sole
&LANDINGPAGE=Billing
As you can see virtually identical. The country does get populated correctly in all cases, just not the actual address info. What fundamental thing am I missing??
UK country code is not UK it is GB

Having a paypal calculating VAT issue?

I am developing a simple shopping cart with paypal checkout, but i am stuck with the VAT processing part on paypal's side.
Paypal seems to add up total +VAT+ shipping. But when i substract the VAT from the $grandtotal variable in my shopping cart i get the error message:
The totals of the cart item amounts do not match order amounts.
I am using Paypal's SetExpressCheckout.
My questions:
1/ for parameter PAYMENTREQUEST_0_AMT should i use the total with or without the VAT
2/ should i use parameter PAYMENTREQUEST_0_TAXAMT? if so how do i prevent paypal from adding it up
regards
Please see the following extracts from the PayPal site :
PAYMENTREQUEST_n_AMT - (Required) Total cost of the transaction to the
buyer. If shipping cost and tax charges are known, include them in
this value. If not, this value should be the current sub-total of the
order. If the transaction includes one or more one-time purchases,
this field must be equal to the sum of the purchases. Set this field
to 0 if the transaction does not include a one-time purchase such as
when you set up a billing agreement for a recurring payment that is
not immediately charged. When the field is set to 0, purchase-specific
fields are ignored.
PAYMENTREQUEST_n_ITEMAMT - Sum of cost of all items in this order. For digital goods, this field is required. You can specify up to 10
payments, where n is a digit between 0 and 9, inclusive; except for
digital goods, which supports single payments only.
PAYMENTREQUEST_n_TAXAMT - (Optional) Sum of tax for all items in this order. You can specify up to 10 payments, where n is a digit
between 0 and 9, inclusive; except for digital goods, which supports
single payments only.
AMT = item amt + tax amt + shipping amt + handle amt - discount.
So if your item amt already includes tax, then don't use tax amt, otherwise, make sure item amt doesn't include tax and put tax in tax amt.

Recurring payments: how to specify an initial payment TAX value different than the subsequent cycles?

If I do a request with the INITAMT equal to the recurring payment amount, it works.
But if I try to bill a different INITAMT (and so different TAX), I get this error:
Tax calculation mismatch. The tax amount for the regular non-trial billing period is different than the sum of the tax for each item in the cart.
My actual request:
I have an initial payment of 4.84€ including 0.84€ of VAT tax.
The next month the amount to bill should be 25.09€ (including 6.09€ VAT).
The request I send is basically this:
Method: CreateRecurringPaymentsProfile
"CURRENCYCODE":"EUR",
"INITAMT":4.84,
"TAXAMT":0.84,
"DESC":"Subscription",
"BILLINGPERIOD":"Month",
"BILLINGFREQUENCY":1,
"AMT":29,
"L_PAYMENTREQUEST_0_ITEMCATEGORY0":"Digital",
"L_PAYMENTREQUEST_0_NAME0":"Subscription",
"L_PAYMENTREQUEST_0_AMT0":29,
"L_PAYMENTREQUEST_0_TAXAMT0":6.09,
"L_PAYMENTREQUEST_0_QTY0":1
"PROFILEREFERENCE":"51a1f8f4732baf580a000031",
"PAYMENTREQUEST_0_INVNUM":"51a1f8f4732baf580a000031",
"INVNUM":"51a1f8f4732baf580a000031",
"PROFILESTARTDATE":"2013-06-26T11:59:12+0000",
And the response:
"TIMESTAMP":"2013-05-27T10:55:46Z",
"CORRELATIONID":"969d07e2cef8a",
"ACK":"Failure",
"VERSION":"74",
"BUILD":"5908853",
"L_ERRORCODE0":"10004",
"L_SHORTMESSAGE0":"Tax calculation mismatch.",
"L_LONGMESSAGE0":"Tax calculation mismatch. The tax amount for the regular non-trial billing period is different than the sum of the tax for each item in the cart.",
"L_SEVERITYCODE0":"Error"
I'd like to do this with the INITAMT value, so that the user can see the two purchases as correlated in the Paypal private area (ie: a subscription with an inital payment).
Otherwise I'll have to do a separate DoExpressCheckout for the initial payment.
What's happening is that you cannot (I believe) set a tax amount for the Initial Amount.
The TAXAMT is for the recurring payment, not the Initial Amount.
Your statement is saying "Billing 29€ with a tax of 0.84€".
However your item list says the tax should be 6.09€
Change your TAXAMT to 6.09€ and it should be fine.

PayPal Charge Tax on shipping (not just items)

I am using the PayPal url approach which works well but when I try charge tax it only seems to apply the tax to the total value of all of the goods, whereas I would like to charge Tax on the Total goods + Shipping, ie
Goods $100.00,
Shipping $20.00,
SubTotal $120.00,
Tax (10%) $12.00,
Grand Total $132.00
This is what I have
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_cart&business=xxxxxxxxxxxxxx_biz#gmail.com&button_subtype=services&upload=1&no_note=1&currency_code=USD&rm=1&item_name_1=Product1&amount_1=200.00&quantity_1=2&item_name_2=Product2&amount_2=200.00&quantity_2=22&shipping_2=6&tax_1=10&tax_2=10&return=http://staging.xxxx.com/store/success.aspx&cancel_return=http://staging.xxxx.com/store/failed.aspx
I made a change to the tax variable to apply a rate rather than an amount. At this time PayPal doesn't charge tax including shipping as services are typically not taxable.
If this is a requirement I'd recommend calculating the total tax amount on your site before sending the Post to PayPal. The value can be entered in the tax_1 field. I've shown an example of this in the second post.
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_cart
&business=xxxxxxxxxxxxxx_biz#gmail.com
&button_subtype=services
&upload=1
&no_note=1
&currency_code=USD
&rm=1
&item_name_1=Product1
&amount_1=200.00
&quantity_1=2
&item_name_2=Product2
&amount_2=200.00
&quantity_2=2
&shipping_2=6
&tax_rate_1=10
&tax_rate_2=10
&return=http://staging.xxxx.com/store/success.aspx
&cancel_return=http://staging.xxxx.com/store/failed.aspx
Here's an example with you calculating the amount. Notice you're only sending one tax amount rather than a tax amount for each item. PayPal doesn't show itemized tax amounts to the customer so there is no impact on the customer's end.
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_cart
&business=xxxxxxxxxxxxxx_biz#gmail.com
&button_subtype=services
&upload=1
&no_note=1
&currency_code=USD
&rm=1
&item_name_1=Product1
&amount_1=200.00
&quantity_1=2
&item_name_2=Product2
&amount_2=200.00
&quantity_2=2
&shipping_2=6
&tax_1=10
&return=http://staging.xxxx.com/store/success.aspx
&cancel_return=http://staging.xxxx.com/store/failed.aspx

PayPal (ExpressCheckoutAPI) Shipping Tax

Okay, so I've searched, and asked on the PayPal forum but no one will respond. My problem is as follows. When specifiying the Shipping Cost in the PaymentDetails sent to paypal, PayPal will not accept the Tax on this in the Tax and Order totals.
For example:
Item Cost = £1
Item Tax = £0.20
Shipping Cost = £1
Shipping Tax = £0.20
I would send these values:
PaymentDetailsType paymentDetails = new PaymentDetailsType()
{
ItemTotal = ItemCost
ShippingTotal = ShippingCost,
TaxTotal = ItemTax + ShippingTax,
OrderTotal = ItemCost + ShippingCost + ItemTax + ShippingTax,
};
However, PayPal will say the item totals dont match.. This is because it will not accept ShippingTax to be added?
Has anyone got a work around for this? I need to show customers what portion of their shipping is cost, and what the total vat is on the paypal page? Not sending the shipping tax in TaxTotal and OrderTotal gets round the error, but then the tax is not shown or charged!
Getting desperate on this issue... please lend a hand if you use PayPal express checkout.
In the end, PayPal responded and said they do not support this scenario of charging tax on shipping. Very poor for an international payment provider.
I have changed my code to now put through an item of Web Order with the total, and the vat on this.
I will be changing PayPal out for something else better as soon as possible.