I'm using UPS api(JSON) refer from the ups.com developer kit.
1)I need shipment rating list with "Residential Shipment".
2)I need Add shipment with "Residential Address".
I am add ResidentialAddressIndicator as 1 in ShipTo address.(I am refer from UPS doc.)
But it's failed.
2)Sample code:
...........
...........
"ShipTo": {
"Name": "Ship To Name",
"AttentionName": "Ship To Attn Name",
"Phone": {
"Number": "1234567890"
},
"Address": {
"AddressLine": "195 N main st",
"City": "Sebastopol",
"StateProvinceCode": "CA",
"PostalCode": "95472",
"CountryCode": "US",
"ResidentialAddressIndicator":"1" //I am refer from UPS doc.
}
},
..........
..........
Your answers are highly appreciated!
in the <ShipTo> element add <Residential Address/>, you can find this in the Shipping Package XML Developers Guide that UPS provides.
Related
I have been trying to build a custom Woocommerce Cart API endpoint, I implemented the add to cart feature but I have ended up facing an issue with shipping taxes.
I want to calculate shipping taxes (especially for flexible_shipping_single) but my code isn't working :
$shippings = [];
if (isset($request["shipping_lines"]) && !empty($request["shipping_lines"])) {
foreach ($request["shipping_lines"] as $shipping_line) {
$shippings[] = $shipping_line["method_id"];
}
WC()->session->set('chosen_shipping_methods', $shippings);
}
$cart->calculate_totals();
Here's my request (I removed some lines to minimize the size)
{
"line_items": [
{
"product_id": 15071,
"variation_id": 0,
"quantity": 9
}
],
"shipping": {
"first_name": "John",
"last_name": "Doe",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US"
},
"shipping_lines": [
{
"method_id": "flexible_shipping_single",
"method_title": "Flexible Shipping"
}
]
}
The issue:
The issue was in the param "state": CA that doesn't exist in the state's list of the shipping zones, So the calculate_shipping() couldn't find the shipping package related to the shipping method selected by the user and its rates, which means that the flexible_shipping_single won't work, instead, it sets back the default shipping method, in my case wc_pickup_store
My sandbox account return this error when creating a payout
{
"name": "PAYOUT_NOT_AVAILABLE",
"message": "You live in a country that is not allowed to send this payout.",
}
This error is not listed in https://developer.paypal.com/docs/api/payments.payouts-batch/#errors
The account is configured in México (MX) and the official documentation includes MX in the payouts docs.
Am I missing something? Can't find any doc that excludes specific countries.
Just some exceptions for Argentina, Brazil and Malaysia.
It also defiens Mexican currency in the features
https://developer.paypal.com/docs/payouts/#payouts-features
I happened to find a similar endpoint but the weird thing is that it's not listed in the main APIs menu but it seems to be working, for reference check:
https://developer.paypal.com/docs/payouts/test
Update: it seems to be related to the test data that's used in the note field, even if using batch payouts the following changed the result status:
{
"sender_batch_header": {
"sender_batch_id": "Payouts_2018_100007",
"email_subject": "You have a payout!",
"email_message": "You have received a payout! Thanks for using our service!"
},
"items":[
{
"recipient_type": "EMAIL",
"amount": {
"value": "500",
"currency": "MXN"
},
"note": "POSPYO001",
"sender_item_id": "201403140001",
"receiver": "ss36#business.example.com",
"alternate_notification_method": {
"phone": {
"country_code": "52",
"national_number": "4491110560"
}
},
"notification_language": "sp-SP"
}
]
}
A single payout looks like this:
{
"sender_payout_header":
{
"sender_batch_id": "1524086406556",
"email_subject": "This email is related to simulation"
},
"items": [
{
"recipient_type": "EMAIL",
"receiver": "payouts-simulator-receiver#paypal.com",
"note": "POSPYO001",
"sender_item_id": "15240864065560",
"amount":
{
"currency": "USD",
"value": "1.00"
}
}]
}
I was having the same issue and it was because my country(India) name is present in supported countries list of PayPal but i got to know about PayPal Commerce Platform availability where it is not supporting India. Check below link
https://developer.paypal.com/docs/api/reference/country-codes/?mark=countries#paypal-commerce-platform-availability
My work is only on sandbox account of paypal for testing so i simply created new test account of country US.
Possibly your paypal account is from any country listed in above link. Please check country of your main paypal account.
i want get Country Code , State Code, city name, by ip address
You can use third party services like https://www.ip2location.com which will provide you all details you require. you have to call rest api of such services and that service will return data to you
You can use this API to get information like country_code,country_name, region_code,region_name, city,zipcode,latitude, longitude,metro_code,areacode
$location = file_get_contents('http://freegeoip.net/json/'.$_SERVER['REMOTE_ADDR']);
print_r($location);
{ "ip": "77.99.179.98",
"country_code": "GB",
"country_name": "United Kingdom",
"region_code": "H9",
"region_name": "London, City of",
"city": "London",
"zipcode": "",
"latitude": 51.5142,
"longitude": -0.0931,
"metro_code": "",
"areacode": "" }
Is there any API or anything which provides city,state and country name when pincode is given.Please share if you have any solution
Thanks in Advance
Hello. there are many more sites which provides this kind of
information i will show you two of them.
Third Party API
Google API
try this url with your pincode. this will gives you data in json format like below one. i have removed some of data to show you so it was not exactly as per return response of third party api.
{
"Message": "Number of Post office(s) found: 1",
"Status": "Success",
"PostOffice": [
{
"Name": "I E Bapunagar",
"Description": "",
"BranchType": "Sub Post Office",
"DeliveryStatus": "Delivery",
"Taluk": "Ahmadabad City",
"Circle": "Ahmadabad City",
"District": "Ahmedabad",
"Division": "Ahmedabad City",
"Region": "Ahmedabad HQ",
"State": "Gujarat",
"Country": "India"
}
]
}
check it, and if you want any help,you can ask.
Use the GeoCoding API
For example, to lookup zip 626134 use a request like this:
http://maps.googleapis.com/maps/api/geocode/json?address=626134&sensor=true
When i create an event with the graph api i need to specify the venue and i would like also to show the map.
I do
$fb_event['name'] = "THis is to test latitude";
$fb_event['description'] = "And longitude!!!!";
$fb_event['start_time'] = date( "c", Ai1ec_Facebook_Event::get_facebook_start_time($event->start));
$fb_event['location'] = "Where you want";
$fb_event['street'] = "Via andrea del sarto 9";
$fb_event['city'] = "Milan";
$fb_event['latitude'] = 45.444975793404;
$fb_event['longitude'] = 9.2119209654715;
$facebook = $this->facebook_instance_factory();
try {
$result = $facebook->api( "/me/events", "POST", $fb_event );
} catch (FacebookApiException $e) {
fb($e);
}
This produce this event which show the correct street and city, but no map. If i edit the event and save, the map "Magically" appears using the street and city correctly.
In any case latitude and longitude are ignored.
What am i doing wrong?
If you compare your two test events in the Graph API explorer you'll see that Event ID 239298922846828 does not have its latitude and longitude populated, while 245655182207213 does. I'm assuming 245655182207213 is an event you've edited.
Looking at your code, you seem to be doing everything as described in the documentation. However, I've found that what is described does not always work.
What I've been seeing is that events populated from within Facebook that occur at a known venue are no longer allowing you to specify an address. Instead all they save is a venue id within Facebook which you can then drill into to get the address, etc.
Take a look at one of my events. For this event, there is no way to edit the details of this location from within Facebook, nor does the event venue details get returned with an API call. I'm using the API to pull the event details to an external website. This change caused me days of frustration.
I started seeing this behavior in late April. I haven't found any official documentation announcing this change.
When some documentation appears, what I expect the new event venue workflow will be is something like:
Query the area where your event will take place to see if a venue exists already.
If yes, get save its id.
If not, create a new community page for your venue and save its id.
Use this ID to populate the event venue.
In the end this is a known facebook bug
https://developers.facebook.com/bugs/173095916131752
Two different formats when create using the same parameters.
When create event through gql
{
"id": "xxxxxxxxxxxxxx",
"owner": {
"name": "xxxxxxxxxx",
"id": "xxxxxxxxx"
},
"name": "W1112",
"start_time": "2013-10-22",
"is_date_only": true,
"location": "Tulsa, OK, United States",
"venue": {
"latitude": 36.131388888889,
"longitude": -95.937222222222,
"street": "",
"zip": "",
"id": "109436565740998"
},
"privacy": "SECRET",
"updated_time": "2013-09-19T12:23:26+0000"
}
When create event through fb
{
"id": "xxxxxxxxxxxxxx",
"owner": {
"name": "xxxxxx",
"id": "xxxxxxxx"
},
"name": "1234",
"start_time": "2013-10-09T21:26:00+1100",
"end_time": "2013-10-25T00:26:00+1100",
"timezone": "Australia/Sydney",
"is_date_only": false,
"location": "Maroubra Junction",
"venue": {
"latitude": -33.940804216453,
"longitude": 151.23876752992,
"city": "Maroubra",
"state": "NSW",
"country": "Australia",
"id": "153993547968514",
"street": "832 anzac Parade ",
"zip": "2035"
},
"privacy": "SECRET",
"updated_time": "2013-09-19T10:50:14+0000"
}