i want to retrieve shipping address with amazon pay express method - amazon

I want to make a php code to retreive shipping addres. I found docs here[https://pay.amazon.com/us/developer/documentation/express/201797700] and
they tell us to call this http post request..bellow, can you help me to make php code to post that request, please.. make a code to run php or jquery, how I can run this to return result..
POST /OffAmazonPayments/2013-01-01 HTTP/1.1
Content-Type: x-www-form-urlencoded
Host: mws.amazonservices.com
User-Agent:
AWSAccessKeyId=AKIAJKYFSJU7PEXAMPLE
&Action=GetOrderReferenceDetails
&AccessToken=YOUR_ACCESS_TOKEN
&AmazonOrderReferenceId=P01-1234-56
&MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE &SellerId='YOUR_SELLER_ID_HERE'
&SignatureMethod = 'HmacSHA256'
&SignatureVersion=2
&Timestamp='2012-11-05'
&Version=2013-01-01
&Signature=CLZOdtJGjAo81IxaLoE7af6HqK0EXAMPLE

welcome to SO :)
I suggest to have a look at the example on github
To receive the shipping address you have to set the shippingAddressRequired-flag (data-ap-shipping-address-required) to "yes" like it is mentioned here
Afterwards you can to a GetOrderReferenceDetails-Api-call find the documentation here. Id use the php-sdk from github for that call. The request is defnied in the client class

Related

Stripe webhook test error 302

I am trying to test a stripe webhook for subscription trial ending. When I go to send the test even to my webhook receiving route I get error 302. I am using a middleware called stripe-webhook-middleware. My route looks like this:
app.post('/stripe/events',
stripeWebhook.middleware,
stripeEvents
);
I know that route goes against what they docs say but I did get it directly from the package creator. So it should work, then I have the stripe-events.js from the package. I am just adding in a console.log to the route to find the correct data I need.
I tried different webhooks and all give the same error, it has to be in how I have it set up. I hope anyways.
Edit **
I have also done a new route that is just a basic post route with a console.log and still getting the 302 error. What could possible causes be? I can't post a github because of a credential I accidentally leaked.
I am/was using cloud9.io as my development environment and had my test site as private. That was causing stripe to need to login in order to do anything. I made it public and now it works. I had completely forgotten I had to login to see the site because I always was logged in to cloud 9 when I accessed the site. If you are getting a 302 error, make sure you don't need to log in to get to that route.
Just in case anyone sees this 302 error with Codeigniter 3, my webhook route was pointing to a Subscription controller that always exits the constructor if a user isn't logged in and authorised - so I moved the method to my Home controller (used for registration, login etc) thus:
$route['webhook']['post'] = 'home/webhook';
and the 302 error went away. I hope this helps a tired CI dev down the road.
Just in case someone receives this error with dJango, my webhook route was pointing to a language redirection. You can investigate it with curl -IvL http://localhost:8000/webhooks/stripe as #duck suggested above.
Here was my output:
HTTP/1.1 302 Found
...
* Issue another request to this URL: 'http://localhost:8000/en/webhooks/stripe/'
...
You can see the redirected URL in the output.
So, when I let Stripe CLI listen to that URL, it works:
stripe listen --forward-to localhost:8000/en/webhooks/stripe/

POST for Azure Mobile/Web App (working from Arduino)

I want to find samples of how to work with Mobile/Web App by sending POST.
Previously in Mobile Services it was possible to send POST like this:
POST /tables/table_name HTTP/1.1
Host: http://arduinounoserver.azure-mobile.net/
X-ZUMO-APPLICATION: YaRWxxxxzKGRxxxxLPiNxxxxXYOvxxxx
{"value": 234}
But now authentication was absolutely changed.
How to do it now and is it possible to find somewhere POST samples?
Have found only Table Service REST API but it's still not clear for me
you can still use next URL notation to access tables:
https://yoursite/tables/tablename
but, you can get an error:
{"error":"An invalid API version was specified in the request, this request needs to specify a ZUMO-API-VERSION of 2.0.0."}
so with Web App Easy Table you should use next ZUMO-header, for example
POST https://vyutest.azurewebsites.net/Tables/Test HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 49
ZUMO-API-VERSION: 2.0.0
Host: vyutest.azurewebsites.net
{"text":"Complete the tutorial","complete":false}
It works.

HTTP Error 405.0 - Method Not Allowed while Form Post

I posted a request to payu server via form submit using angularjs now once payment is completed payu will return a response with hash.But when it hits my success page i get "HTTP Error 405.0 - Method Not Allowed".I found many solutions online but none of that solved my issue.What i understood is that static html do not allow post by default.But my staticFile in IIS is like below
Request Path : *
Module : StaticFileModule
Name : staticFile
Request Restriction >Verb > All Verbs & Access > Script & Invoke > Files and folders
My question now in how to allow POST method for html page.I am using angular and if i change my success url to other than mine it works fine.I think there is some changes to be made to the web config but i tried my best but failed.Any help would be much appreciated.Also lets assume that the page successfully redirects to my success page how to capture the response that payu sends me online.
Thanks in advance if more input is needed from my side kindly ask in reply.
It's not that HTML does not allow POST by default, it's that HTML does not handle POST, period. (Not even if the HTML file contains JavaScript.) POST sends data to a script that runs on your server, and the script has to be smart enough to know what to do with the data. HTML isn't that smart. The only thing your server can do with HTML is to send the HTML back to whatever is requesting it. You need a server-side script that knows how to parse payu's response, do something appropriate with the hash, and then generate some HTML to display in the user's browser.

How to send POST variables with Nipple on NodeJS

I am trying to use nipple to post to an url within my nodejs application, which itself is running on hapi.js
The documentation essentially doesn't seem to spell it out.
(https://www.npmjs.com/package/nipple)
I tried passing it as payload inside options but that, while not returning an error, returns a 400. Can someone provide a correct example doing a post using nipple?
Essentially, I have two variables that I need to send - let's call the var1 and var2.
Thanks!
That link says that the project has been renamed to wreck. On wreck's github, several of the tests are for a post requests, including this one:
https://github.com/hapijs/wreck/blob/master/test/index.js#L68
If you are still scratching your head, you could also try using curl or postman to sanity check your URL, regardless of any nipple/wreck errors. If that also gives you a 400, nipple/wreck may not be the culprit.

how to send post data on the chrome.downloads.download method?

Im trying to use the chrome.downloads.download method and i need to send post data to the server, i use options.body="?keyName=value" on the download options but it doesn't work. Maybe someone knows better the api, the documentation is not very explicit about this subject.
'cause Chrome doesn't set request content-type for you, you can verify this through this script:
<?php
header('Content-Type: text/plain; charset="utf-8"');
var_dump($_SERVER['REQUEST_METHOD']);
var_dump($_GET);
var_dump($_POST);
var_dump($_SERVER['CONTENT_TYPE']);
var_dump(file_get_contents('php://input')); // $HTTP_RAW_POST_DATA
?>
So, you should use parse_str($HTTP_RAW_POST_DATA, $post_params) to get the values of the parameters. PHP won't parse the post body if content-type is not properly set. (application/x-www-form-urlencoded, application/www-url-encoded, etc.)

Resources