Quickbooks API: How to generate purchase order against the orders placed by guest in quickbooks using api? - api

I have developed eCommerce website with OpenCart framework where when customer places order purchase order should be created in QuickBooks.
I have referred this documentation https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/purchaseorder
The api to create a purchase order accepts following json input
{
"PurchaseOrder": {
"DocNumber": "1005",
"SyncToken": "0",
"domain": "QBO",
"APAccountRef": {
"name": "Accounts Payable (A/P)",
"value": "33"
},
"CurrencyRef": {
"name": "United States Dollar",
"value": "USD"
},
"TxnDate": "2015-07-28",
"TotalAmt": 25.0,
"ShipAddr": {
"Line4": "Half Moon Bay, CA 94213",
"Line3": "65 Ocean Dr.",
"Id": "121",
"Line1": "Grace Pariente",
"Line2": "Cool Cars"
},
"VendorAddr": {
"Line4": "Middlefield, CA 94303",
"Line3": "42 Main St.",
"Id": "120",
"Line1": "Geoff Hicks",
"Line2": "Hicks Hardware"
},
"POStatus": "Open",
"sparse": false,
"VendorRef": {
"name": "Hicks Hardware",
"value": "41"
},
"Line": [
{
"DetailType": "ItemBasedExpenseLineDetail",
"Amount": 25.0,
"Id": "1",
"ItemBasedExpenseLineDetail": {
"ItemRef": {
"name": "Garden Supplies",
"value": "38"
},
"CustomerRef": {
"name": "Cool Cars",
"value": "3"
},
"Qty": 1,
"TaxCodeRef": {
"value": "NON"
},
"BillableStatus": "NotBillable",
"UnitPrice": 25
}
}
],
"CustomField": [
{
"DefinitionId": "1",
"Type": "StringType",
"Name": "Crew #"
},
{
"DefinitionId": "2",
"Type": "StringType",
"Name": "Sales Rep"
}
],
"Id": "257",
"MetaData": {
"CreateTime": "2015-07-28T16:01:47-07:00",
"LastUpdatedTime": "2015-07-28T16:01:47-07:00"
}
},
"time": "2015-07-28T16:04:49.874-07:00"
}
My website has a guest checkout so I need to know how to generate purchase order for guests as the above json format expects customer id to be sent. Since it is guest who is placing order I do not have customer id to pass for the api

Related

QuickBooks Online API - Sales tax: trying to override automatic sales tax, but it's not respecting my inputs

QBOnline API: Problems with overriding Sales Tax - passed in values not respected on Invoice (AST seems to override my override)
Hi all,
Yes, I'm new to the API. Diving in head first! :)
I'm trying to troubleshoot a problem with my app. It's submitting new Invoices to the QBOnline API, and passing in all the line item information. We aren't trying to use the AST system - so I was trying to set the override values. (Documentation: https://developer.intuit.com/app/developer/qbo/docs/workflows/manage-sales-tax-for-us-locales#specifying-sales-tax)
I think that I am providing the values correctly, but the system is still calculating it's own sales tax amount.
Target API URL:
https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365232674520/Invoice?minorversion=4
Here's an example of the object we are passing in (edited for privacy, expanded for human readability):
{
"BillAddr": {
"City": "AnywhereVille",
"Country": "USA",
"CountrySubDivisionCode": "CA",
"Line1": "",
"Line2": "Customer Name LLP",
"Line3": "45 E. Pacific Coast Highway",
"Line4": "",
"PostalCode": "90804"
},
"CustomField": [{
"DefinitionId": "1",
"Name": "P.O. Number",
"StringValue": "",
"Type": "StringType"
}, {
"DefinitionId": "2",
"Name": "Sales Rep",
"StringValue": "TY",
"Type": "StringType"
}],
"CustomerMemo": {
"value": "Pay your invoice online at: ..."
},
"CustomerRef": {
"value": "60"
},
"DocNumber": "11111",
"DueDate": "2022-08-01",
"Line": [{
"Amount": 576,
"Description": "",
"DetailType": "SalesItemLineDetail",
"LineNum": 1,
"SalesItemLineDetail": {
"ClassRef": {
"name": "3 Studios",
"value": "1111111111111"
},
"ItemRef": {
"name": "16GBUSBFLASH",
"value": "21"
},
"Qty": 48,
"TaxCodeRef": {
"value": "TAX"
},
"UnitPrice": 12
}
}, {
"Amount": 168,
"Description": "",
"DetailType": "SalesItemLineDetail",
"LineNum": 4,
"SalesItemLineDetail": {
"ClassRef": {
"name": "3 Studios",
"value": "1111111111111"
},
"ItemRef": {
"name": "DVDMEDIA",
"value": "23"
},
"Qty": 12,
"TaxCodeRef": {
"value": "TAX"
},
"UnitPrice": 14
}
}, {
"Amount": 600,
"Description": "",
"DetailType": "SalesItemLineDetail",
"LineNum": 6,
"SalesItemLineDetail": {
"ClassRef": {
"name": "3 Studios",
"value": "1111111111111"
},
"ItemRef": {
"name": "DIGITALDEL30",
"value": "25"
},
"Qty": 12,
"TaxCodeRef": {
"value": "TAX"
},
"UnitPrice": 50
}
}],
"SalesTermRef": {
"value": "8"
},
"TxnDate": "2022-08-01",
"TxnTaxDetail": {
"TaxLine": [{
"Amount": 130.98,
"DetailType": "TaxLineDetail",
"TaxLineDetail": {
"NetAmountTaxable": 576,
"PercentBased": true,
"TaxPercent": 0.0925,
"TaxRateRef": {
"value": "4"
}
}
}],
"TotalTax": 130.98,
"TxnTaxCodeRef": {
"value": "4"
}
}
}

When using the Quickbooks API explorer, read a vendor endpoint returns additional fields. How do I get these fields in actual API results?

Response from API via API explorer(by Intuit)
{
"Vendor": {
"BillAddr": {
"Id": "9",
"Line1": "31/2-34/2B, G01, Ground Floor (P V Enclave, V-Step Road)",
"Line2": "Kempapura",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "karnataka",
"PostalCode": "560037"
},
"BusinessNumber": "ABPFA3772K",
"Balance": 12960,
"BillRate": 0,
"Vendor1099": false,
"CurrencyRef": {
"value": "INR",
"name": "Indian Rupee"
},
"TDSEnabled": true,
"TDSEntityTypeId": 2,
"TDSSectionTypeId": 20,
"TDSOverrideThreshold": false,
"GSTIN": "29ABPFA3772K1ZT",
"GSTRegistrationType": "GST_REG_REG",
"CostRate": 0,
"domain": "QBO",
"sparse": false,
"Id": "5",
"SyncToken": "3",
"MetaData": {
"CreateTime": "2021-11-29T04:13:02-08:00",
"LastUpdatedTime": "2022-06-19T11:18:01-07:00"
},
"CompanyName": "Asyncauto",
"DisplayName": "Asyncauto",
"PrintOnCheckName": "Asyncauto",
"Active": true,
"V4IDPseudonym": "002085e0c7fca007484293913d58943f84b215",
"PrimaryPhone": {
"FreeFormNumber": "1231231234"
},
"PrimaryEmailAddr": {
"Address": "123123#mralbert.in"
}
},
"time": "2022-06-19T19:00:23.349-07:00"
}
Response from the actual API endpoint (quickbooks.api.intuit.com)
{
"Vendor": {
"BillAddr": {
"Id": "9",
"Line1": "31/2-34/2B, G01, Ground Floor (P V Enclave, V-Step Road)",
"Line2": "Kempapura",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "karnataka",
"PostalCode": "560037"
},
"BusinessNumber": "ABPFA3772K",
"Balance": 12960.00,
"Vendor1099": false,
"CurrencyRef": {
"value": "INR",
"name": "Indian Rupee"
},
"domain": "QBO",
"sparse": false,
"Id": "5",
"SyncToken": "3",
"MetaData": {
"CreateTime": "2021-11-29T04:13:02-08:00",
"LastUpdatedTime": "2022-06-19T11:18:01-07:00"
},
"CompanyName": "Asyncauto",
"DisplayName": "Asyncauto",
"PrintOnCheckName": "Asyncauto",
"Active": true,
"PrimaryPhone": {
"FreeFormNumber": "1231231234"
},
"PrimaryEmailAddr": {
"Address": "123123#mralbert.in"
}
},
"time": "2022-06-19T19:04:59.703-07:00"
}
Notice that in the second case these fields - "TDSEnabled","TDSEntityTypeId","TDSSectionTypeId","TDSOverrideThreshold","GSTIN","GSTRegistrationType", are missing.
How do I get these fields in the regular production endpoint?
Try using Postman and see if issue persist then you need to talk with quickbooks support.
I have found that in indian edition of quickbooks still has many issue open.

Amadeus Flight Offers Different Prices

We're using flight offers search api and ready to move to prod. But when we search flights with ECONOMY class the prices are not even close to "amadeus.net" search engine results or TK (Turkish Airlines) web site prices. If we use BUSINESS class as a parameter the api results are closer to real prices. How can we solve this issue?
The sample query is: (IST - CGN 25th May ECONOMY and TK Opearated flight departures 16:05 )
/v2/shopping/flight-offers?originLocationCode=IST&destinationLocationCode=CGN&departureDate=2021-05-25&adults=1&travelClass=ECONOMY&includedAirlineCodes=TK&nonStop=true&max=250
The api result is: €206.55
TK Web Site: €121
Amadeus.net €103
Detailed API result:
{
"meta": {
"count": 2,
"links": {
"self": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=IST&destinationLocationCode=CGN&departureDate=2021-05-25&adults=1&travelClass=ECONOMY&includedAirlineCodes=TK&nonStop=true&max=250"
}
},
"data": [
{
"type": "flight-offer",
"id": "2",
"source": "GDS",
"instantTicketingRequired": false,
"nonHomogeneous": false,
"oneWay": false,
"lastTicketingDate": "2021-05-25",
"numberOfBookableSeats": 9,
"itineraries": [
{
"duration": "PT3H20M",
"segments": [
{
"departure": {
"iataCode": "IST",
"at": "2021-05-25T16:05:00"
},
"arrival": {
"iataCode": "CGN",
"terminal": "2",
"at": "2021-05-25T18:25:00"
},
"carrierCode": "TK",
"number": "1675",
"aircraft": {
"code": "321"
},
"operating": {
"carrierCode": "TK"
},
"duration": "PT3H20M",
"id": "2",
"numberOfStops": 0,
"blacklistedInEU": false
}
]
}
],
"price": {
"currency": "EUR",
"total": "206.55",
"base": "134.00",
"fees": [
{
"amount": "0.00",
"type": "SUPPLIER"
},
{
"amount": "0.00",
"type": "TICKETING"
}
],
"grandTotal": "206.55"
},
"pricingOptions": {
"fareType": [
"PUBLISHED"
],
"includedCheckedBagsOnly": true
},
"validatingAirlineCodes": [
"TK"
],
"travelerPricings": [
{
"travelerId": "1",
"fareOption": "STANDARD",
"travelerType": "ADULT",
"price": {
"currency": "EUR",
"total": "206.55",
"base": "134.00"
},
"fareDetailsBySegment": [
{
"segmentId": "2",
"cabin": "ECONOMY",
"fareBasis": "QT2PXOW",
"class": "Q",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
}
]
}
]
}
],
"dictionaries": {
"locations": {
"SAW": {
"cityCode": "IST",
"countryCode": "TR"
},
"CGN": {
"cityCode": "CGN",
"countryCode": "DE"
},
"IST": {
"cityCode": "IST",
"countryCode": "TR"
}
},
"aircraft": {
"321": "AIRBUS A321",
"738": "BOEING 737-800"
},
"currencies": {
"EUR": "EURO"
},
"carriers": {
"TK": "TURKISH AIRLINES"
}
}
}
Thanks in advance
There are two reasons why you see different prices:
The Self-Service APIs return published airfares coming from the GDS and not any negotiated ones. That means the flights returned by the APIs can be more expensive than the ones you find in OTAs or airline websites.
In the test environment that you are using, you get access to cached flight data which might be different from the live prices.

Bot duplicates user messages when I use DirectLine channel

I am using bot framework v4. I have developed a chatbot using .Net Core. The bot is integrated with LUIS and Qna Maker. One issue I am facing is that the bot duplicates the message that comes from the user. Please look at the screenshot below:
The replies I get from the bot are perfectly fine. The flow of the bot is as intended. I just cannot figure out why the message from user is being duplicated. I am using DirectLine for this. I will share whatever code part is needed.
{
"activities": [
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000000",
"timestamp": "2019-12-02T19:41:57.1284328Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"size": "large",
"url": "https://i.imgur.com/ViaEUnA.png"
}
]
}
],
"horizontalAlignment": "Center"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "TextBlock",
"size": "large",
"weight": "bolder",
"color": "light",
"text": "Welcome to CIVIC Financial Services",
"wrap": true
},
{
"type": "TextBlock",
"size": "large",
"weight": "bolder",
"color": "light",
"text": "I am S.U.E",
"wrap": true
},
{
"type": "TextBlock",
"color": "light",
"text": "I can help you answer your questions. Familiarize yourself with CIVIC Financial Services.",
"wrap": true
},
{
"type": "TextBlock",
"color": "light",
"text": "If you want to talk to a Customer Service Agent, just type \"I want to talk to a Customer Service Agent\".",
"wrap": true
}
],
"separator": true,
"horizontalAlignment": "Left"
}
]
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"data": {
"action": "aboutCivic"
},
"title": "About CIVIC"
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"actions": [
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "We are open from Monday through Friday from 8:00am to 6:00pm.",
"wrap": true
}
],
"style": "emphasis"
},
"title": "When are you open?"
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Image",
"size": "stretch",
"url": "https://i.imgur.com/gBVgI25.png",
"horizontalAlignment": "center"
},
{
"type": "TextBlock",
"text": "AZ, CA, CO, FL, GA, HI, NC, NV, OR, SC, TN, TX, UT, VA & WA",
"wrap": true
}
],
"style": "emphasis"
},
"title": "Do you have an office near me? "
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "8 to 10 days, it all depends on how it takes to get access to the property.",
"wrap": true
}
],
"style": "emphasis"
},
"title": "How quickly can we close? "
}
],
"style": "emphasis"
},
"title": "FAQs"
}
]
}
}
],
"entities": [],
"replyToId": "8WGOnspSxN3"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000001",
"timestamp": "2019-12-02T19:43:39.96502Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"entities": [
{
"type": "ClientCapabilities",
"requiresBotState": true,
"supportsListening": true,
"supportsTts": true
}
],
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000002",
"timestamp": "2019-12-02T19:43:41.7278914Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Sorry, I didn't understand. Consider rephrasing your question or contacting a customer agent",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000001"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000003",
"timestamp": "2019-12-02T20:00:25.784598Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "helo",
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000004",
"timestamp": "2019-12-02T20:00:26.5739342Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Sorry, I didn't understand. Consider rephrasing your question or contacting a customer agent",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000003"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000005",
"timestamp": "2019-12-02T20:00:27.3293896Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "hello",
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000006",
"timestamp": "2019-12-02T20:00:27.6064185Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Hello",
"inputHint": "acceptingInput",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000005"
}
],
"watermark": "6"
}

Get list of users with the "send on behalf of" permission

Using the V2 DocuSign REST API, is it possible to get a list of users who have the "send on behalf of" and "account wide" permission?
Looking through the docs, I see that the Get User List method does not return any permission info. The Get User Information method returns a little more but nothing permission specific, other than a permissionProfileId for each group.
So is it possible to get permission info with user data? Or is there a method I can call using the permissionProfileId to check if a user has those permissions?
What I am ultimately trying to do is get a list of users who are able to use the "Send on behalf of" feature which requires the "send on behalf of" and "account-wide rights" permissions.
You can get a list of all users and their User Settings with below rest method as an DS Admin:
https://demo.docusign.net/restapi/v2/accounts/[accountid]/users/?additional_info=true
Sample output below:
{
"users": [
{
"userName": "DocuSignTest2 User-2",
"userId": "b67aa83b-2b3e-4669-a897-89e44b5724c2",
"userType": "CompanyUser",
"isAdmin": "False",
"userStatus": "Created",
"uri": "/users/b67aa83b-2b3e-4669-a897-89e44b5724c2",
"email": "youremail#yourdoman.com",
"firstName": "DocuSignTest2",
"lastName": "User-2",
"userSettings": [
{
"name": "canManageAccount",
"value": "false"
},
{
"name": "canSendEnvelope",
"value": "true"
},
{
"name": "locale",
"value": "en"
},
{
"name": "canSendAPIRequests",
"value": "false"
},
{
"name": "apiAccountWideAccess",
"value": "false"
},
{
"name": "enableVaulting",
"value": "false"
},
{
"name": "vaultingMode",
"value": "none"
},
{
"name": "enableTransactionPoint",
"value": "true"
},
{
"name": "enableSequentialSigningAPI",
"value": "true"
},
{
"name": "enableSquentialSigningUI",
"value": "true"
},
{
"name": "enableDSPro",
"value": "false"
},
{
"name": "powerFormAdmin",
"value": "false"
},
{
"name": "powerFormUser",
"value": "true"
},
{
"name": "canEditSharedAddressbook",
"value": "use_private_and_shared"
},
{
"name": "canManageTemplates",
"value": "create"
},
{
"name": "enableSignOnPaperOverride",
"value": "false"
},
{
"name": "enableSignerAttachments",
"value": "true"
},
{
"name": "allowSendOnBehalfOf",
"value": "false"
},
{
"name": "allowRecipientLanguageSelection",
"value": "true"
},
{
"name": "selfSignedRecipientEmailDocument",
"value": "include_pdf"
}
],
"sendActivationOnInvalidLogin": "false",
"enableConnectForUser": "false",
"groupList": [
{
"groupId": "128693",
"groupName": "Everyone",
"groupType": "everyoneGroup"
}
],
"workAddress": {
"address1": "",
"address2": "",
"city": "",
"stateOrProvince": "",
"postalCode": "",
"phone": "",
"country": ""
},
"homeAddress": {
"address1": "",
"address2": "",
"city": "",
"stateOrProvince": "",
"postalCode": "",
"phone": "",
"country": ""
}
},
[rest removed for sake of example]
There is not one call that can complete this task.
My recommendation is to put all of these users in a Group and then you can query who is in the group through the API.
Example get list of user's per group:
GET https://{server}.docusign.net/restapi/v2/accounts/{accountId}/groups/{groupId}/users
If you want to audit the group or see who you need to move into the group you can get a list of users and then look at user details per user (loop through programmaticaly).
Example get user settings to check userSettings->allowSendOnBehalfOf :
GET https://{server}.docusign.net/restapi/v2/accounts/{accountId}/users/{userId}