how to retrieve the bill list from xero api - xero-api

I am working on xero-api and have successfully retrieved the invoice, contact and payment from the api. But am unable to list out the list out bills from the api.

Bills are also retrieved from the Invoices endpoint so you might be already retrieving them. Bills have a Type of ACCPAY and sales invoices have a type of ACCREC.
So you could make a request like GET /Invoices?where=Type=="ACCPAY" to retrieve only the Bills.

Related

How to fetch all transactions of a customer using Paystack api

I integrated the Paystack API into my mobile app, and it works fine instead of fetching the customer's transactions from Paystack. I want to check the customer's history of transactions on launch and unlock locked features if the last transaction is active.
https://api.paystack.co/customer/customer#gmail.com
The URL above was to fetch the customer's data along with transactions and subscriptions, but no transactions were fetched along with the data returned. It is in test mode. Please what do you suggest obtaining the customer's transactions?
You can fetch transactions for a specific customer by calling the GET /transaction endpoint and passing the customer ID as a query parameter. For example,
GET https://api.paystack.co/transaction?customer=113957392
will fetch all transactions for the customer with ID=113957392. You can get the customer ID by fetching the customer object from GET /customer.

How to get returns/refund value from shopify api

I am trying to calculate the total sales of orders overtime similar to shopify reports dashboard. I tried using the transactions api and calculated the total sales by subtracting the refund value from sale value but the value I calculated and the one in shopify reports dashboard seems different but when I tried subtracting the returns value in the shopify dashboard and sale value from the transactions api I got the same value as in shopify dashboard.
So where can I find the returns data in shopify api ? or How can I calculate the returns value through shopify api?
For refund amount check Order API and Order object
You will find there field refunds that will contain transactions and refund_line_items.
I hope that will contain all information that will be required.

Is it possible to retrive the 'account' associated with a xero bank transaction

I'm using Xero's private API to export bank transactions (so I can automate a bunch of financial reporting).
Retrieving the transactions works well (as documented here https://developer.xero.com/documentation/api/banktransactions) but this endpoint doesn't return the account field associated with each transaction, which I want to use to group the transactions into e.g. "Cost of sale", "Operating expenses" and so on.
Does anyone know of a way to find the account for a given transaction via the API?
Further info:
If the transaction contains line items, then the account associated with each line item is returned by the endpoint above. I'm mostly interested in transactions that do not include line items (the LineItems field is an empty array)
Most of the transactions i'm working with are of the "Spend Money" type
I'm currently using pyxero SDK, but open to other options
The account field is present in Xero's web interface, and on the CSV export available from the web interface.
Our contacts in Xero don't have default accounts.
It is the LineItems of Bank Transactions that have AccountCodes associated with them and I've not been able to find a bank transaction record without a line item in the data I have available to me.
Is it possible that you are not implementing paging? From the bank transactions documentation you linked to above:
Paging BankTransactions (recommended)
To utilise paging, append a page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.
By using paging all the line item details for each bank transaction are returned which may avoid the need to retrieve each individual bank transaction.
I'm not familiar with the pyXero implementation, but it looks like they support Xero paging. From the pyXero readme:
# Grab 100 invoices created after 01-01-2013
xero.invoices.filter(since=datetime(2013, 1, 1), page=1)

How to retrieve Square orderIds for Call to BatchRetrieveORders

I want to retrieve a list of orders using the Square API. The call to retrieve orders is a POST call with a String array of order_ids however I'm not sure where I can get this information. In the docs they said I can use the ListTransactions endpoint to get this information but I'm not able to find the order_id within the response.
The documentation to retrieve Orders located at: https://docs.connect.squareup.com/api/connect/v2#endpoint-batchretrieveorders
see sample response of ListTransactions: https://docs.connect.squareup.com/api/connect/v2#endpoint-listtransactions
The Orders API does not support listing of orders. To access order
details, you will need to fetch the order's ID by querying
transactions using the ListTransactions and RetrieveTransaction
endpoints, and then fetching the order using the BatchRetrieveOrders
endpoint
Reference: https://docs.connect.squareup.com/articles/orders-api-overview
The goal is to get a list of recent transactions/orders that list out exactly what was purchased. The Transactions model doesn't contain Items whereas the Orders model does.
The Transaction object will include an order_id field if you included it during the Charge request. If you did not pass the order_id to the Charge request, then it will not show up.
Furthermore - just for clarity's sake, if you use Square Point of Sale, or if you haven't included the order_id previously but still would like to view itemizations for transactions, please look at V1 ListPayments which will include it even if there's no order_id.
References:
https://docs.connect.squareup.com/api/connect/v2#type-transaction
https://docs.connect.squareup.com/api/connect/v1#get-payments

Retrieval of all the invoices of particular contact id in xero

In xero, if we create a contact. Using that contact we perform couple of sales invoice and purchase bills and few of them get paid. Now I want to obtain the list of the invoices groupedBy ContactID in php
Xero have recently released functionality that allows this in an easy way.
You can use the ContactIDs query parameter on the invoices endpoint like the following:
GET ../Invoices?ContactIDs=623e392d-7402-40e4-a54c-fdf29783e9a4
You can also do this for more than one ContactID by supplying a comma separated list of ContactIDs.
You can find more information about this in this handy blog post