I want to use paypal express checkout in paypal to get the token ID to send the ID to the server. At the moment I am using the general paypal and I get a response like this:
{
"payment": {
"short_description": "Coffee Payment",
"amount": "24",
"currency_code": "AUD"
},
"client": {
"platform": "Android",
"paypal_sdk_version": "1.2.3",
"product_name": "PayPal Android SDK; ",
"environment": "sandbox"
},
"proof_of_payment": {
"adaptive_payment": {
"timestamp": "2014-03-26T03:22:09+0000",
"payment_exec_status": "COMPLETED",
"app_id": "APP-80W284485P519543T",
"pay_key": "AP-6N7046464K788532B"
}
}
}
But I need to get the token using paypal express. I would greatly appreciate if the way to do this can be shown.
That sample is using Adaptive Payments. The Express Checkout portion of the REST CreatePayment API is what you're after.
i have done implementation. If you have read the docs in the paypal developer page, the only problem you should be having is generating the access token. The access token is generated as follows:
<?php
require_once ("include/braintree_init.php");
require_once 'vendor/braintree/braintree_php/lib/Braintree.php';
/*if(file_exists(__DIR__ . "/../.env")) {
$dotenv = new Dotenv\Dotenv(__DIR__ . "/../");
$dotenv->load();
}*/
$clientToken = $gateway->clientToken()->generate();
$output = json_encode(array("response" =>$clientToken)) ;
echo $output;
After send the output to your android. And that's it. But you will have to have the include files that i have included.
Related
We have an external bot configured to use MS Teams channel using message end point web hook. The following is the message posted to the Ms Teams channel by the external bot. This response gets rendered as expected when MS Teams is accessed via web browser or MS Teams application on desktop computer. However, the card is not rendered (seeing an empty line/block without any content) when used with Teams application on an android mobile phone. Would like to know what is going wrong here?Is this feature not supported on mobile? or are we missing something?
"channelData":{
"tenant":{
"id":"xxxxxxxxxxxxxx"
}
},
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"content":{
"fallbackText":"Adaptive card version not supported",
"type":"AdaptiveCards",
"body":[
{
"text":"Here is an adaptive card with a link to a task module",
"type":"TextBlock"
},
{
"type":"Image",
"url":"http://adaptivecards.io/content/cats/1.png"
}
],
"version":"1.0",
"actions":[
{
"type":"Action.OpenUrl",
"title":"Open Link",
"url":"https://teams.microsoft.com/l/task/xxxxx?url=https%3A%2F%2Fwww.wikipedia.com%0A&height=large&width=large&title=Wikipedia-Embed"
}
]
}
}
],
"replyToId":"xxxxxx",
"serviceUrl":"https://smba.trafficmanager.net/amer/",
"recipient":{
"name":"xxxx xxxx",
"aadObjectId":"xxxxx",
"id":"xx:xxxxxxxx"
},
"localTimestamp":"2020-02-14T15:21:41.1360000-08:00",
"channelType":"msteams",
"from":{
"name":"xxxxxx",
"id":"xx:xxxxx"
},
"type":"message",
"conversation":{
"conversationType":"personal",
"tenantId":"xxxxxx",
"id":"x:xxxxxx"
}
}```
You need to make sure the card's "type" is "AdaptiveCard" and not "AdaptiveCards".
{
"fallbackText":"Adaptive card version not supported",
"type":"AdaptiveCard",
"body":[
{
"text":"Here is an adaptive card with a link to a task module",
"type":"TextBlock"
},
{
"type":"Image",
"url":"http://adaptivecards.io/content/cats/1.png"
}
],
"version":"1.0",
"actions":[
{
"type":"Action.OpenUrl",
"title":"Open Link",
"url":"https://teams.microsoft.com/l/task/xxxxx?url=https%3A%2F%2Fwww.wikipedia.com%0A&height=large&width=large&title=Wikipedia-Embed"
}
]
}
We are planning on migrating to using topics through FCM for our application.
I have done some tests and have noticed a weird behaviour (looks very much like a bug).
When receiving a new token for the same InstanceID the https://iid.googleapis.com/iid/info/ endpoint still shows previously active topic subscriptions for this instance id.
But notifications sent to this topic do not arrive on the device.
These are the steps I took:
Get a token in the Android SDK
FirebaseInstanceId.getInstance().getToken(projectId, scope) => ABC:123
Subscribe to a topic in the Android SDK
FirebaseMessaging.getInstance().subscribeToTopic(topicName)
Verify the topic was subscribed to using the API call: https://iid.googleapis.com/iid/info/ABC:123?details=true
{
"applicationVersion": "1",
"connectDate": "2019-02-18",
"attestStatus": "UNKNOWN",
"application": "com.foo.bar",
"scope": "*",
"authorizedEntity": "12345",
"rel": {
"topics": {
"topicName": {
"addDate": "2019-02-18"
}
}
},
"connectionType": "WIFI",
"appSigner": "XXXXXXX",
"platform": "ANDROID"
}
Send a notification to the topic => notification arrives
Delete the token in the Android SDK
FirebaseInstanceId.getInstance().deleteToken(projectId, scope)
Get a new token in the Android SDK
FirebaseInstanceId.getInstance().getToken(projectId, scope) => ABC:456
Verify the topic was subscribed to using the API call: https://iid.googleapis.com/iid/info/ABC:456?details=true
{
"applicationVersion": "1",
"connectDate": "2019-02-18",
"attestStatus": "UNKNOWN",
"application": "com.foo.bar",
"scope": "*",
"authorizedEntity": "12345",
"rel": {
"topics": {
"topicName": {
"addDate": "2019-02-18"
}
}
},
"connectionType": "WIFI",
"appSigner": "XXXXXXX",
"platform": "ANDROID"
}
Just to verify this is the new response for the deleted token.
https://iid.googleapis.com/iid/info/ABC:123?details=true
{ "error": "No information found about this instance id." }
Send a notification to the topic => notification does not arrive!
This behavior does not restore. (We waited a full day).
Why does the info endpoint show that the new token was subscribed to the topic, but in reality is not registered at all?
The only fix seems to be re-subscribing the new token on the topic.
Thanks in advance.
I am developing a navigation application which uses Google Maps. I am trying to implement "my nearby user location" with the application.
I want to use the Algolia service for searching geo-locations using GeoFire with Android & Firebase.
I have successfully stored latitude and longitude information in my Algolia index with their documentation's guidance.
But I don't understand how I can automatically fetch the list and map the location (like in sample project of algolia instant search) based on my current location without entering the place name or any address. Here's my current code:
com.algolia.search.saas.Query query = new com.algolia.search.saas.Query().setAroundLatLng(new com.algolia.search.saas.Query.LatLng(lat,lng)).setAroundRadius(5000);
index.searchAsync(query, new CompletionHandler() {
#Override
public void requestCompleted(JSONObject jsonObject, AlgoliaException e) {
}
});
What's the problem you are facing? Are you blocked on what to do next? The jsonObject you get in requestCompleted is going to be something like:
{
"hits": [
{
"firstname": "Jimmie",
"lastname": "Barninger",
"objectID": "433",
"_highlightResult": {
"firstname": {
"value": "<em>Jimmie</em>",
"matchLevel": "partial"
},
"lastname": {
"value": "Barninger",
"matchLevel": "none"
},
"company": {
"value": "California <em>Paint</em> & Wlpaper Str",
"matchLevel": "partial"
}
}
}
],
"page": 0,
"nbHits": 1,
"nbPages": 1,
"hitsPerPage": 20,
"processingTimeMS": 1,
"query": "jimmie paint"
}
In Java you can access it like jsonObject.getObject("hits").
Are you using instantsearch-android or algoliasearch-client-android ? You should use the instantsearch-android one, is easier to link the search with your UI. Here's an example with GoogleMaps.
i am doing a bar code scanner application.I am trying to get Google book details from the bar code ISBN number in android application. Also i got all the book details from API result successfully. But if i try to access the buy link from API result, i am unable to access the buy link of the book. It says 404 error. Can anyone help me, how to access the buy link to buy a book.? Thanks in advance.
Here is the buy link of book got from below result:
http://books.google.co.in/books?id=xqxBtXmxqV4C&dq=isbn:9781849699327&hl=&buy=&source=gbs_api
Here is the API result:
"saleInfo": {
"country": "IN",
"saleability": "FOR_SALE",
"isEbook": true,
"listPrice": {
"amount": 162.0,
"currencyCode": "INR"
},
"retailPrice": {
"amount": 113.4,
"currencyCode": "INR"
},
"buyLink": "http://books.google.co.in/books?id=xqxBtXmxqV4C&dq=isbn:9781849699327&hl=&buy=&source=gbs_api",
"offers": [
{
"finskyOfferType": 1,
"listPrice": {
"amountInMicros": 1.62E8,
"currencyCode": "INR"
},
"retailPrice": {
"amountInMicros": 1.134E8,
"currencyCode": "INR"
}
}
]
I would like to integrate Facebook's comment social plugin
( https://developers.facebook.com/docs/reference/plugins/comments/ to comment on url) into my android application.
I tried to use webview (use this answer Android unable to implement facebook comment in a webview due to default browser ) and it's work, but hard to customize, for example: I want to have a bigger Textbox for user to type the comment. My question is: "is there any solution to integrate something like "Facebook's comment social plugin" into android application by facebook sdk, java code,... to comment on url?
Thanks & best regards
As far as I understand you have some URL page where you've embedded your facebook social plugin with comments and you want to parse this and display as you want. If I'm right, then unfortunately I haven't found easy solution via triggering appropriated methods from Facebook SDK. You have to use Graph API.
First of all we need to take a look into docs - https://developers.facebook.com/docs/graph-api/reference/v2.3/object/comments
Here there is a example of call
/* make the API call */
new Request(
session,
"/{object-id}/comments",
null,
HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
For getting {object_id} you need to send similar call to the Graph API, but for retrieving id:
GET-> ?id=http%3A%2F%2Fwww.imdb.com%2Ftitle%2Ftt2015381%2F
And you will receive response which looks like
{
"og_object": {
"id": "10150298925420108",
"description": "Directed by James Gunn. With Chris Pratt, Vin Diesel, Bradley Cooper, Zoe Saldana. A group of intergalactic criminals are forced to work together to stop a fanatical warrior from taking control of the universe.",
"title": "Guardians of the Galaxy (2014)",
"type": "video.movie",
"updated_time": "2015-05-15T14:52:46+0000",
"url": "http://www.imdb.com/title/tt2015381/"
},
"share": {
"comment_count": 4,
"share_count": 91073
},
"id": "http://www.imdb.com/title/tt2015381/"
}
10150298925420108 is our object_id
So next query looks like GET -> 10150298925420108/comments
and response
{
"data": [
{
"id": "10150298925420108_10152457293990108",
"can_remove": false,
"created_time": "2014-10-28T18:12:15+0000",
"from": {
"id": "1513986108857171",
"name": "ซอโซ่ สระอา ยอยัก"
},
"like_count": 2,
"message": "สนุกมากค่ะ",
"user_likes": false
},
{
"id": "10150298925420108_10152457392770108",
"can_remove": false,
"created_time": "2014-10-28T19:20:28+0000",
"from": {
"id": "302917246580502",
"name": "สมชาย โกทันธ์"
},
"like_count": 0,
"message": "สองดาวครับ\n",
"user_likes": false
},
{
"id": "10150298925420108_10152461977130108",
"can_remove": false,
"created_time": "2014-10-31T11:57:10+0000",
"from": {
"id": "472810482857795",
"name": "Surat Thaenphet"
},
"like_count": 0,
"message": "แต่ละเรื่องที่ลง สนุกมาก แต่ดูไม่จบ ดูสักพัก ก็ eror ไม่รุ้เป็นเพราะอะไร",
"user_likes": false
}
],
"paging": {
"cursors": {
"before": "Mw==",
"after": "MQ=="
}
}
}
To test all this requests and response before doing it in Android app - use Graph API explorer https://developers.facebook.com/tools/explorer/