Predicting WorldPay transaction ID with Shopify - shopify

We're using the WorldPay payment processor with Shopify.
When a transaction is created in WorldPay it's given an ID based on its order number in Shopify. For example:
#1010.1 for order number 1010
#1011.1 for order number 1011
#1013.2 for order number 1013
For most orders the number after the dot is a "1". But for at least one it's "2". Is there any way of predicting what this number is, or of fetching it via the API?

The part after the #1013 is the transaction number. If the transaction fails for whatever reason that number is incremented when the user attempts the transaction again. You can retrieve the transactions for an order using the transactions endpoint. http://api.shopify.com/transactions.html

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.

Update draft invoice from API, Unbalanced exception

Our customers have a subscription on our services.
The subscription generates an draft invoice and one of the product on the draft I want to change the quantity off. This product quantity is different every month and our external software know this number.
What I’ve do through the API/XMLRPC.
We find the draft in the 'account.move' model then search the 'account.move.line' for our product. Then here we change the amount and we write the 'account.move.line' back.
Here we get an exception 'Cannot create unbalanced journal entry. <...>.'.
I can’t believe we have the recalculate all the financial values. Isn’t this something the API should do?

Shopify API get Total Returns/Refunds

I am trying to get the Net Sales of orders of our Shopify store on daily basis. I can do it with the Orders API, but there seems to be a mismatch for the refunds returned by the API and the refunds/returns that show up in the dashboard.
In fact, the API doesnt show any refunds for the orders at all but there does seem to be some amount deducted from the Total Sales of Orders which make the actual Net Sales for that particular day.
I can retrieve the orders for one day by this example URL. I iterate through all the orders and add up each Order's amount which gives an exact number of Total Sales which match up to the number in the dashboard. But this Total Sales value doesnt take into account the refunds/returns.
/admin/api/2021-07/orders.json?status=any&created_at_min=2021-08-17T00:00:00-04:00&created_at_max=2021-08-18T00:00:00-04:00&limit=250
There is a refunds in the returned json for each order as well in the above call but that is empty for all the objects.
I have explicitly tried to retrieve the refunds as well by following API call but it also returns empty for all the orders.
/admin/api/2021-07/orders/{order_id}/refunds.json
You may have a look at the Dashboard Sales image for one day. Please note in this image, I can get the exact value for Total Orders from the API but can not retrieve a single refund/return for any of the order.
Would you be having an idea what are these Refunds/Returns shown in the Dashboard? If so, is there a way how can I accurately calculate the Refunds/Returns by the API as well, so I can accurately calculate the Total Sales for one day?
You should be working with Transactions. Specifically, the refund transactions. An Order has many transactions. So given some order, you can get at the interesting transactions, and calculate your important values, like Net. I have aced this for many clients, as Shopify does not report this type of value very well. So I generate reports with Net, refunds, taxes, etc, providing much clearer guidance than the standard Shopify reports.

Transaction by receipt number

I looked through the Squareup.com API v2 for a method to retrieve a transaction using the receipt number on the printed receipt (It is 4 characters) but I found nothing documented for this method.
Is this possible?
I know I can get the transaction details using transaction ID but that's not what I want.
No, you cannot query the API by receipt number at this time.
If you needed to look up by receipt number, you could keep a separate store of the receipts indexed by the receipt code, but that might be more trouble than it is worth.
The 4-digit receipt ID you are referring to is the same as the first four characters of the selected tender ID for the transaction. You could accomplish this by retrieving all transactions for the given location and searching the first four characters. You may need additional details, such as the payment total to guarantee against duplicates.

get pending orders price using Amazon MWS API

I am trying to process the orders from certain Amazon store. But was faced with a problem:
I can not get total price (or total amount) for orders with 'Pending' status. This field is empty. This info can not be retrieved even via OrderItems.
Amazon API docs says:
Note: When an order is in the Pending state (the order has been placed but payment has not been authorized), the ListOrderItems operation does not return information about pricing, taxes, shipping charges, gift wrapping, or promotions for the order items in the order. After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped, Partially Shipped, or Shipped state, the ListOrderItems operation returns information about pricing, taxes, shipping charges, gift wrapping, and promotions for the order items in the order.
But I really need it. In addition I saw some apps, which can 'see' OrderAmount for pending orders.
Maybe anyone have already resolved this question? Any help is highly appreciated.
Thanks.
I use the SellerSKU along with a Amazon price stored in my database to calculate the order value. It is an estimate, though, since the price may have been updated recently (and the order might not reflect the new price) and I cannot calculate the shipping price - neither the price nor the address is known for pending orders.
At least in my usage, I don't see a reason for trying to get the exact amount before the order actually leaves the Pending state. Quantities and SKUs are known, so you can reserve stock accordingly which is the only task I actually need to know pending orders for.