Chrome extension switch from digital goods to in-app payments - google-chrome

With Google retiring the old iframe version in March 2015 we have to switch to the in-app payment route for our extension.
How can we implement repeated purchases of the same product? I see you use the
google.payments.inapp.getPurchases({...
However in our case the user should be able to purchase the same product multiple times. The thought here was just relying on the server postback but it looks like they are removing that too?
{
"response": {
"details": [
{
"kind": "chromewebstore#payment",
"itemId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"sku": "giant_tv",
"createdTime": "1387221267248",
"state": "ACTIVE"
}
]
}
}
I must be missing something here, why would Google not implement a way to allow repeated purchases of the same sku or at least allow us to tag the purchase with additional information?

For complete information on the new payments API see:
https://developer.chrome.com/webstore/payments-iap
To answer your question, purchases for the same SKU will only be accepted if you first call
google.payments.inapp.consumePurchase and pass in the SKU that matches a product the profile/user already owns. This is similar to how the Google Play API works.

Related

Google Fit session not appearing in history

I am trying to create a workout session using the Google Fit REST api and it's not appearing in the user's history on the Fit Android app.
I am following their guide here and using the OAuth playground here with the following steps:
I have granted access to the playground for fitness.activity.read and fitness.activity.write and obtained the necessary tokens
I'm making a call to https://www.googleapis.com/fitness/v1/users/me/sessions/example-fit-1411053997 with the following payload
{
"id": "example-fit-1411053997",
"name": "My example workout",
"description": "A very intense workout",
"startTimeMillis": 1396710000000,
"endTimeMillis": 1396713600000,
"version": 1,
"lastModifiedToken": "exampleToken",
"application": {
"detailsUrl": "http://example.com",
"name": "Foo Example App",
"version": "1.0"
},
"activityType": 1
}
I can see a 200 response code meaning my session was created and I can confirm the session gets listed when I call https://www.googleapis.com/fitness/v1/users/me/sessions
The session doesn't appear in the Google Fit mobile app for the same user account.
However, if I switch to a different user account on the device and switch back the session appears. This happens every time and I cannot make the session appear right away. I have also tried recording sessions from Android directly and those appear instantly in the Fit app. Am I missing extra steps necessary for the REST Api?
Edit
I tried the same on iOS and I can see my workout in the history. Could this be a bug on Android?
Edit 2
So I've tested on 3 devices - 2 androids and one iOS. iOS works as expected - all sessions are listed there and when I create a session from the Google Fit app it gets returned by the API.
However, on Android on both phones when I create sessions from the Fit app they don't even get sent it seems because I'm not receiving them from the Api. Definitely starting to look like a sync issue on their Android end.

Does paypal API suport user to user payments on my app?

Can I use the Paypal API to allow users to send money to other users without leaving my website?
I have a website where users can become friends, much like Facebook. Can I embed a Paypal form that allows users to send each other money directly without leaving my site to Paypal?
So User1 would select their friend User2, and send him money via paypal. Then the money would go straight to User2's paypal account.
thanks!
Setting up payee is a relatively new feature in paypal. Its fairly simple and i found it here. When you setup a payment using some parameters like below
{
"intent": "sale",
"payer":
{
"payment_method": "paypal"
},
...
Just add a payee object to it.
"payee": {
"email": "paypal-de#paypal.com"
}
You can find more info on payee here

Getting ETH FIAT conversion rates via Web3

Am I missing something or is this information not available via web3 in the browser even if the ETH USD rate is displayed in Metamask.
Cannot find anything in the docu.
is the standard practice to use a cross-crypto API?
Ethereum Protocol Doesn't Care About Ether/Fiat Exchange:
The fiat price of Ether is not recorded on the Ethereum network, nor is it handled by the Ethereum protocol. The only reason MetaMask show this information is because it is a useful feature for users, but they get this information from exchanges that trade Ether for fiat.
Sources of Exchange Data:
Because Ether is traded on the free market there is no central organisation dictating the price. The best thing you can do to find the "current price" is to query the APIs of exchanges (https://poloniex.com/exchange, https://www.kraken.com/) and/or market tracking sites (https://coinmarketcap.com/). You can interrogate these APIs and use the rates presented as your guide for the Ether/Fiat exchange rate.
https://api.coinmarketcap.com/v1/ticker/ethereum
[
{
"id": "ethereum",
"name": "Ethereum",
"symbol": "ETH",
"rank": "2",
"price_usd": "211.824",
"price_btc": "0.0930788",
"24h_volume_usd": "1191280000.0",
"market_cap_usd": "19499368103.0",
"available_supply": "92054574.0",
"total_supply": "92054574.0",
"percent_change_1h": "-0.51",
"percent_change_24h": "21.85",
"percent_change_7d": "20.51",
"last_updated": "1496138662"
}
]
Please note :
Exchanges will tend to have different prices depending on their user's activity, most the time the price won't vary much but they can do. That's why market tracking sites are more accurate as they give weighted averages.

Box Api : Adding User Group as Collaborator return 403 Forbidden

I am trying to add collaborators through Box API, but when I am adding a user group, the api request return status 403: Forbidden.
Here is the request attributes i'm passing:
{"item": { "id": "3907701373", "type": "folder"}, "accessible_by": {"id": "400235","type":"group"}, "role": "viewer"}
And it returns me this error:
Bearer realm="Service", error="insufficient_scope", error_description="The request requires higher privileges than provided by the access token."
The documentation for Create Collaboration states that:
Errors may occur if the IDs are invalid or if the user does not have permissions to create a collaboration.
Are you able to create a collaboration with a regular user on that folder?
Follow-Up
I think the problem could be due to one, or possibly both, of the following:
Box recently introduced the Group Admin, which has permissions to "add existing users to their groups, create new users that will be assigned to their groups, and assign folder access to their groups." You may need to have those permissions in order to manage group collaborations.
Your may need to enable the Manage an Enterprise scope for your application, under OAuth2 Parameters > Scopes. If (1) above is true then your app most likely requires elevated, enterprise privileges.

How can I get a user's Google+ ID from its email address?

I have a user's Gmail e-mail address and I need to get his or her Google+ ID to get additional information about him or her, like name, and so on. Is there a way to do this using the Google APIs?
There is no publicly available API to identify the Google+ profile associated with an email address. There is an existing feature request you should star if you are interested in such an API.
Tricky, but works.
If you have a G Suite Domain (aka Google Apps) you can create a new group with emails addreses and call Members method.Groups API response contains user ID.
https://developers.google.com/admin-sdk/directory/v1/reference/members/list
Response looks like :
{
"kind": "admin#directory#members",
"etag": etag,
"members": [
**members Resource**
],
"nextPageToken": string
}
Where members rersource looks like :
{
"kind": "admin#directory#member",
"etag": etag,
"id": string,
"email": string,
"role": string,
"type": string
}
id is the Google+ Profile id, later you can use Google+ API with people method.
Google plus
login to your gmail account then Put that gmail-email address to search option.
If that user is on Google plus then you will able to see his/her profile.
If you want to create new one with specific format for you then you can get it after making few friend on it.
Google will notify you when you will pass the position.
you can create your own customized profile in it.
Not exactly from the email address itself, but if you have a JWT token you can get the information from that. The id is one of the claims in the token. So if you have a server that uses Google issued JWT tokens, decode the token. Here's a website to view the token information: https://jwt.ms/