PayPal API integrating into server - java

I am trying to integrate my server with the api,
I test it on
https://devtools-paypal.com/guide/openid/java?interactive=OFF&env=sandbox
in the third step, when I copy the code from the redirectUri, paste it instead AUTH-CODE and press the "try it" button, I get the message "invalid Json response recieved"..
I don't understand why, what Is wrong?

paypal api is very restricted. You need to have all products with prices, tax, shipping method and much more.
best will be if you can add json request so we can check it.
PS. you have your auth codes? That ones are only examples.

Related

Google reCaptcha test without frontend

Im trying to integrate google reCaptcha into our backend. I'm getting always invalid-input-response. I'm using testing secret key, post or get doesn't matter. It is said it will accept any response, but do they think any response at all or any user generated response? It seams that I need to create proper page with captcha to test it. Not just some curl http://localhost:8080/app/register --data "g-recaptcha-response=aaaa"
Is the g-recaptcha-response some identifier of "captcha try" as there is no text to be send, that user enters, in case of the new "I'm not robot" captcha.
You understand that the purpose of recaptcha is to force human interaction? google recaptcha wil prompt the human user for some input (lke identify objects in pictures) and save the result in a cookie. without the interactive part, there is no way to test the feature

Paypal Express Checkout used on Sandbox, Security header is not valid, no error in API credential

In my GWT-RPC project I want to use Paypal Express Checkout on Sandbox. I run my project on eclipse as GWT Super Dev Mode to test it.
Using the paypal integration wizard I've added the paypalfunctions.java class on my server side that permit calling PayPal API. On my server-side I have this AsyncCall, the log part is for debugging:
/**
* PayPal Operations
*/
#SuppressWarnings("rawtypes")
public HashMap setCheckoutExpress(DatiPaypalCheckoutExpress paypal){
paypalfunctions api=new paypalfunctions();
HashMap response=api.CallMarkExpressCheckout(((Double) paypal.getTOT()).toString(),
"http://127.0.0.1:8888/MovieUniverse.html#order_confirmed",
"http://127.0.0.1:8888/MovieUniverse.html#order_cancelled",
"", "", "", "", "",
"", "", "");
// response=api.CallShortcutExpressCheckout("10.00",
// "http://127.0.0.1:8888/MovieUniverse.html#order_confirmed",
// "http://127.0.0.1:8888/MovieUniverse.html#order_cancelled");
if(response!=null){
GWT.log("Server: setCheckoutExpress() HashMap: "+response.toString());
}else
GWT.log("Server: setCheckoutExpress() HashMap: null");
return response;
}
the commented part, CallShortcutExpressCheckout works. But when I use the CallMarkExpressCheckout I receive in response
{L_LONGMESSAGE0=Security header is not valid, VERSION=93, BUILD=17329237, L_ERRORCODE0=10002, ACK=Failure, CORRELATIONID=9ce80c51dc8a5, TIMESTAMP=2015-07-09T16:25:14Z, L_SEVERITYCODE0=Error, L_SHORTMESSAGE0=Security error}
There aren't spaces in API credentials and the example method works so paypal endpoints are written right.
I don't know how to solve it. Thanks a lot!
Sometimes people confuse API USERNAME and API PASSWORD with regular paypal username and password of same paypal account and this also causes error 10002.
For example you might have provided API USERNAME but by mistake you provided regular password in SetExpressCheckout API call.
In sandbox mode API PASSWORD is given under "API Credentials" tab after you click "profile" link below "paypal-buyer#****.***" account record.
That error does not happen unless the credentials are wrong in some way. It could be the values themselves, or it could be that you're sending sandbox credentials to the live server or vice-verse.
If you're absolutely sure the values themselves are correct, make sure you're using the correct values with the correct endpoints.
At the end I didn't resolve in that way. I used the paypal sdk merchant
and to understand how use it, I used the great API Explorer Paypal that is very useful to understand which and how set objects of sdk. On the how's to I've seen what sdk's object I need to set. I suggest this way to use API Paypal

How to get SMTP-ID in sendgrid API through json?

How to get SMTP-ID in sendgrid API through json? Example :
In the API tutorial they have mentioned to execute
http(s)://username:password#domain/foo.php
and the result will be (in json):
"email": "john.doe#sendgrid.com",
"timestamp": 1337197600,
"smtp-id": "<4FB4041F.6080505#sendgrid.com>",
"event": "processed"
But actually we need the perfect url to get json.
for eg :
https://sendgrid.com/api/bounces.get.json
for bounce mails
similarly , is there anything to get the above sample json.
Thanks in advance..
If you send an Email to SendGrid through the Web API, you won't have an SMTP-ID. That will be generated by the SendGrid server that translates the API call to an SMTP object. So you're right, the SMTP-ID that comes back in the Event POST isn't helpful.
However, you can add Unique Args to your API call using the x-smtpapi argument in the mail.send call. This will let you define whatever tracking metric(s) you want to the message, and it will all come back on the Event POST.
If you are going to use Unique Args feature, please do remember that they will appear in the most Event notifications but not all of them. Please refer for the details to the sendgrid forum topics which include "missing unique_args" and similar. So, think twice before "building the entire infrastructure" around this feature like some of us did :(
I got my answer .
Actually we can try event API using a callback url, that receives POST request having every details about the email delivered, bounced in json format. Whenever some event is triggered we get a request from Sendgrid. Thats cool.
We can keep these details for further Filtering.
Anyway , thanks jacobmovingfwd

Posting to a wall of a facebook user using the graph api

i am new to facebook app development and i am trying to post a simple text on the wall of the user using the https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN&message=hello but this does not seem to be working..Any thoughts as to where i might be going wrong?
Check if you have permissions to post from the app.
Add app_id to your call.
If you’re just calling the URL you mentioned, that would be a GET request. To post a message to the user’s wall you have to use method POST. You can test it in the Graph API Explorer – change the method to POST via the dropdown, click „add a field” and use name=message and value=your_message …

How to retrieve home timeline from twitter in the form of .xml or JSON using java?

I want to get a home timeline from twitter and I was able to get the home timeline using twitter4j and oauth authentication method
ConfigurationBuilder confBuilder = new ConfigurationBuilder();
confBuilder.setOAuthAccessToken(accessToken.getToken())
.setOAuthAccessTokenSecret(accessToken.getTokenSecret())
.setOAuthConsumerKey(key)
.setOAuthConsumerSecret(secret);
Twitter twit = new TwitterFactory(confBuilder.build()).getInstance();
User user = twitter.verifyCredentials();
List<Status> statuses = twitter.getHomeTimeline();
but the result is not in the form of .xml or JSON. i also tried
WebResource resource = client.resource("https://api.twitter.com/1/statuses/user_timeline.json");
but all I get is GET https://api.twitter.com/1/statuses/user_timeline.json returned a response status of 401 Unauthorized
I googled many times but I just cant get it right. Please I need a sample java code of how to do it. Complete code that can run right away would be really helpful as I got a lot of partially coded program and just couldnt get it to work. thank you in advance
OK, so after looking at the release notes for the 2.2.x versions, it appears there is a way to get the JSON representation from Twitter4J, but it's disabled by default since it uses some extra memory.
So, you need to:
Enable the JSONStore using the jsonStoreEnabled config option
Get the JSON representation of a request using the getRawJson method
Sorry there's no code example, I haven't tried it myself.
401 Unauthorized:
Authentication credentials were missing or incorrect.
You need to authenticate before you perform the query.

Categories