SetExpressCheckout Minimum Variables - variables

I am getting an error 10413 "The totals of the cart item amounts do not match order amounts. I can't find what totals are different, so I want to eliminate the variables that I do not need in order to simplify and find the variables that aren't matching. What are the absolute minimun variables needed to complete a transaction in paypal sandbox?

The following must be true in your API request.
ITEMAMT + SHIPPINGAMT + HANDLINGAMT + TAXAMT = AMT
If that math does not work out then you will get the error you are seeing.
You can eliminate all of those and just send an AMT on its own, but then you can't include line item details. If that's not important, then you'd be just fine. I always prefer to send line item details, though, so that I have it available in the PayPal transaction details.
So again, as long as that math works out then you would be fine. You need to look at your request and see what values you have for those, add them up, and you'll probably find that they don't equal the AMT value you sent.

Related

binance futures how to close a position at market price (the same as the "market" button under "close positions") via API

This question is about binance FUTURES api (not spot exchange, but futures).
GOAL : have the same behaviour that the button "market" under "close positions" that closes a position.
NOTE : please don't reply the endpoit : DELETE /fapi/v1/allOpenOrders ==>> this is CANCELLING only orders NOT FILLED / (not opened) positions.
I want to CLOSE a actual OPENED position.
(don't forget that the buttons buy/long and sell/short are opening positions) in futures, sell is not the same as a sell in spot trading. in futures, sell actually open a position. to take profit we have to close (not cancel) the position.
I search all over forums and it's very hard to find a correct working answer to this.
** I can OPEN a position at market price with this:
symbol=BTCUSDT&side=SELL&positionSide=SHORT&type=MARKET&quantity=0.01
** But when I try to CLOSE it with those parameters, I always get an error NOT matter what I try
symbol=BTCUSDT&side=SELL&type=STOP_MARKET&closePosition=true
I get Stop price less than zero.
symbol=BTCUSDT&side=SELL&type=STOP_MARKET&closePosition=true&stopPrice=30895.00
I get Order’s position side does not match user’s setting.
symbol=BTCUSDT&side=SELL&type=STOP&closePosition=true&stopPrice=30895.00
ProfitTarget strategy invalid for orderType STOP
symbol=BTCUSDT&side=SELL&quantity=0.01&type=MARKET
Order's position side does not match user's setting.
symbol=BTCUSDT&side=SELL&type=MARKET&closePosition=true
Target strategy invalid for orderType MARKET,closePosition true
symbol=BTCUSDT&side=SELL&type=STOP&closePosition=true
Target strategy invalid for orderType STOP,closePosition true
symbol=BTCUSDT&side=SELL&type=STOP_MARKET&closePosition=true
Stop price less than zero.
symbol=BTCUSDT&side=SELL&type=STOP_MARKET&closePosition=true&stopPrice=30158.30
Order's position side does not match user's setting.
symbol=BTCUSDT&side=SELL&type=TAKE_PROFIT_MARKET&closePosition=true&stopPrice=30131.30
Order's position side does not match user's setting.
symbol=BTCUSDT&side=SELL&positionSide=SHORT&type=TAKE_PROFIT_MARKET&closePosition=true&stopPrice=30271.60
Combination of optional parameters invalid.
!!!!!!!!!! what’s wrong or what parameter I’m missing ???
it's a bit frustrating....
does anyone know the correct parameters ???
I mixed the BUY SELL stuff
OPEN SHORT
symbol=BTCUSDT&side=SELL&positionSide=SHORT&type=MARKET&quantity=0.01
CLOSE SHORT
symbol=BTCUSDT&side=BUY&positionSide=SHORT&type=MARKET&quantity=0.01
OPEN LONG
symbol=BTCUSDT&side=BUY&positionSide=LONG&type=MARKET&quantity=0.01
CLOSE LONG
symbol=BTCUSDT&side=SELL&positionSide=LONG&type=MARKET&quantity=0.01
I was running into the same issue and worked out that it can be done without the need for a socket connection to monitor whether or not one of the TP/SL has been filled in order to cancel the other.
It does require three separate calls to the API to create each as the solved answer points out, but the parameters sent in the calls can be set such that one will cancel the other two if it executes.
For example, the SL being hit will cancel the original order and the TP and the TP being hit will cancel the original order and the SL, etc. Here are the parameters I used in each call to achieve this (with example values):
Original order -
symbol=BNBUSDT
side=BUY
positionSide=BOTH
type=MARKET
quantity=1
reduceOnly=false
SL Order -
symbol=BNBUSDT
side=SELL
positionSide=BOTH
type=STOP_MARKET
timeInForce= GTE_GTC
quantity=1
reduceOnly=true
stopPrice=(your stop price)
workingType= MARK_PRICE
TP Order -
symbol=BNBUSDT
side=SELL
positionSide=BOTH
type=TAKE_PROFIT_MARKET
timeInForce= GTE_GTC
quantity=1
reduceOnly=true
stopPrice=(your take profit price)
workingType= MARK_PRICE
Hopefully, this helps anyone else running into this issue

eBay API: get watch count for the particular item

I want to retrieve a number of watchers for the particular item using eBay API. I tried setting IncludeWatchCount to true in GetSingleItem request, but it appears that it works only for the seller of the item. Is it possible to get the number of watchers without being a seller?
I literally just joined in on SO with a new account because I lost my previous email with which I had the old one just to answer your question.
Anyway, If you call findItemsAdvanced, under listingInfo there is a watchCount field. It only works with findItemsAdvanced and not with any other.
[NOTE] The watchCount variable is not in the documentation. You should dump the response given by findItemsAdvanced, find listingInfo and it will be there

How to get maximum number of tweets on an user

i have this code
("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser.'&count=500'
But it is giving me only 200 records , I found in twitter document that it will give 3200 tweets.Is i am doing wrong what should i do to get that much tweet.
Since there is no page system in twitter 's API, to go throught timelines, you must use the "max_id" parameter.
Here is an helpful link that explains how to work with timelines with nice illustrations: https://dev.twitter.com/rest/public/timelines.
Edit: here is how you do it.
"To use max_id correctly, an application’s first request to a timeline endpoint should only specify a count."
Make your request "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser.'&count=500 (you can put 200).
Then when you get all your data, " keep track of the lowest ID received" and use it as parameter (the same way you do for the count) for your next request. it will give you the 200 next posts with a lower id than the one you specified. Do it again until you reach the end.

eBay API change currency of returned price

Is there a way to get an item in another currency using the eBay API?
Very simple. All you have to do is change the site ID parameter. Since you didn't specify a language, I'm going to assume you're doing this HTTP-GET and just parsing the XML. The same principles will apply regardless of how you do it, programatically or not.
For a URL:
"http://open.api.ebay.com/shopping"
?callname=GetSingleItem
&responseencoding=XML
&appid=[APPID]
&siteid=2 <------------This, for example, is Canada's siteid. 0 is US. This will change the currency returned under < ConvertedCurrentPrice>
&version=839
&ItemID=181195344321
Put it all together and you get this copy/paste-friendly "http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=[APPID]&siteid=2&version=839&ItemID=181195344321"
Make sure to use your app ID as the parameter.
You can use this call for currency change:
Currency type can be changed in Ebay while listing an item using Add Item call in Ebay's trading API.
http://developer.ebay.com/devzone/xml/docs/Reference/eBay/extra/additms.rqst.additmrqstcntnr.itm.crrncy.html
Thanks CedCommerce
You can and it's actually very simple. You can use the Shopping API GetSingleItem.
Depending on what currency you are interested in, all you have to do is change the SiteID on which you are making the call. For example, if you want to get the price in EUR, you can set the SiteID to 3(UK), or 77(Germany). You will also have to set the IncludeSelector to "Details". This way, you will get a response that will contain the following fields.
<ConvertedCurrentPrice currencyID="GBP">68.55</ConvertedCurrentPrice>
<CurrentPrice currencyID="USD">92.9</CurrentPrice>
where the CurrentPrice is the original price of the listing, on the ebay site the listing was made, and the ConvertedCurrentPrice is the price of the listing on the site that corresponds to the SiteID you supplied.
You can see a full list of SiteIDs with the currencies they are using here

Magento API creates simple product correct -> but afterwards tells "101 Product not exists"

I try to add some pictures to a simple product, which was created (without error) by the API. The product is shown in frontend its functional with all wanted attributes. But if I check afterwards
$client->call($sessionId, 'product.info', '123456');
I get Soap Error: "101: Product doesn't exists". But its definitivly reachable over back- and frontend. (Cache cleared, Index refreshed)
Same issue, when I try to add media informations. On Confugurable Products the error don't show up and the pictures are added whithout any problems.
Maybe I messed something up with the attributes or the attribut sets... I don't know, where to watch first.
I'm at my php’s end!
Using Magento 1.6.0.0
Thank your for clarify me.
Best regards.
Since the ame API function ("product.info" in this case) receive as a parameter both SKU and ID, there is a problem if your are looking for SKU's which is numeric values.
To avoid this problem, we always adding space to the end of SKU before sending it to the API. For example, if your SKU is "123456" you should send "123456 " to the API.
Have you tried this call with your product id instead of the sku? I had some problems in the past with product calls and the sku.
I've installed 2 magentos and we always use numeric SKUs and I've always had this problem.
I've solved it by modifying the file:
app/code/core/Mage/Catalog/Model/Api/Resource.php
About line 122 that reads:
$product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), $identifierType);
I've changed it to:
$product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), 'sku');
This way the function always expects an SKU.