How to fetch user's email address associated with Apple Pay Account from Apple Pay using JavaScript - applepayjs

I wanted to know if Apple has an API which we can use to fetch user's email address associated with apple pay account.
FYI I am using apple pay js (ApplePaySession) for apple pay.
Or is there another way to fetch user's email address from Apple pay in JavaScript.
Thank You!

The email address is provided within the onpaymentauthorized callback of your ApplePaySession.
Note: It is an inherited property, so it may be somewhat difficult to find in your developer console (in Chrome you've got to drill down into the event's __proto__ property).
You must specifically ask for the email address by including a requiredShippingContactFields property in your payment request:
requiredShippingContactFields: [
'phone',
'email'
]
And the email address will be available like so:
var session = new ApplePaySession(2, myPaymentRequest);
session.onpaymentauthorized = function(event){
console.log(event.payment.shippingContact.shippingAddress);
};

Once the user authorizes the transaction, you will get the shippingContact Object like this:-
{
"locality": “India",
"country": "India",
"postalCode": "95014-2083",
"administrativeArea": "CA",
"emailAddress": “sachin#example.com”,
"familyName": “Tendulkar",
"addressLines": [
"1 Infinite Loop"
],
"givenName": “Sachin",
"countryCode": "INDIA",
"phoneNumber": "(408) 555-5555"
}
from this object you can access the email id.

Related

how to Detect Marketing and Role based emails programmatically?

I have requirements where I would have to distinguish emails whether it is regular email, Marketing email, or Role based email.
Marketing Emails: Emails that correspond to a marketing campaign. Typically sent to a batch of users and composed with tools like
MailChimp, etc...
Role-Based Emails: Emails addresses that are not associated with a particular person, but rather with a company, department, position, or
group of recipients (ex: noreply#, marketing#, support#, etc).
Can I identify this by email header information? Or is there any other way to achieve this?
Technology using:
Gmail API: to get email information
Spring boot: to process emails
By using the Gmail API you can retrieve the emails by using the following request:
GET https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/{id}
Which will end up returning the body of a Message with the following similar structure:
{
"id": ID,
"threadId": THREAD_ID,
"labelIds": [
"CATEGORY_PROMOTIONS",
"UNREAD",
"INBOX"
],
"payload": {
"headers": [{
"name": "Reply-To",
"value": "NAME \u003cnewsletter#email.com\u003e"
},
{
"name": "Subject",
"value": "Week 9 Newsletter"
},
{
"name": "From",
"value": "NAME \u003csupport#email.com\u003e"
},
"body": {
"size": SIZE,
"data": ""
}
},
}
So depending on how you want to process these afterwards, you can use some of the following fields from the returned email:
labelIds - this field will contain all the labels attached to the incoming email which means that (depending on the settings you have for your inbox) you can easily check this email for instance as being a promotional email because of the CATEGORY_PROMOTIONS label attached to it;
Reply-To header - you can retrieve the email address here and later analyze it;
Subject header - assuming you have a list of keywords set up, you can search the subject of the email and later mark it based on the results;
From header - you can retrieve this email address here and again, based on a list of keywords, you can decided of which type this email is.
Reference
Gmail API Message Resource.

How can I disable waiting room in Google Meets created with calendar api?

In the Google Calendar api there's the ability to request that a conferencing link be created when an event is created.
My current setup is that I have an account that is creating google calendar events whenever someone schedules a meeting on my app. The problem is that when someone outside of my organization tries to join the meeting it says "ask to join" which isn't possible since nobody from my organization will be in the meeing. Are there are parameters to let me turn off the waiting room feature or at least have a list of approved emails that are allowed to enter the meeting. The request body looks like this right now:
{
"end": {
"dateTime": "2020-08-30T05:27:35.206Z"
},
"start": {
"dateTime": "2020-08-29T05:27:35.206Z"
},
"conferenceData": {
"createRequest": {
"conferenceSolutionKey": {
"type": "hangoutsMeet"
},
"requestId": "12345"
}
},
"summary": "Test event with meets 2",
"attendees": [
{
"email": "****#gmail.com"
}
]
}
The attendee I added still has to request to join the meeting.
This appears to be a bug!
I have taken the liberty of reporting this on Google's Issue Tracker for you, detailing the behaviour:
User from outside of G Suite domain required to ask to join a Meeting from a Calendar event they are invited to
You can hit the ☆ next to the issue number in the top left on the page which lets Google know more people are encountering this and so it is more likely to be seen to faster.

Correct id to send message to a skype account

I am trying to test my bot by sending a message to my skype account. I can't find a way how to contact myself what is the members.id id suppossed to be? I tried Skype Name but can't find any other id suitable and the docs are not very helpful.
I started a conversation:
{
"bot": {
"id": "2",
"name": "bot's name"
},
"isGroup": false,
"members": [
{
"id": "123", <----------------- WHAT SHALL BE HERE?
"name": "My Account"
}
],
"topicName": "News Alert"
}
The id for the conversation is { "id": "123" }.
I could find the bot from the Skype app but I never receive anything.
You can get the ID of user by checking the Activity.From.Id property when s/he sends a message.
Also please note that in case of Skype and Facebook user IDs are altered for each user.
So each user has different ID for each Bot, and that ID is not the Skype (or Facebook) ID, as mentioned in documentation

How to uniquely identity a Person resource in Google People API response from a particular user?

Google People API, unlike Google Plus API doesn't provide an unique id for each Person resource in the response.
Why has this been deprecated/removed and how to uniquely identify a Person in an user's contacts list without an id?
In short, use resourceName as an ID.
The Google People API is the user's list of contacts and have IDs specific to the user. They can create contacts that only have a mailing address or only have a name and no contact info. There is no way for Google to logically collate all of these contacts across all of the Google Contacts users.
Specific contacts or a user have a resourceName field that uniquely identifies that resource (contact) for the authenticating user. You basically want to use that as an id. This is the value you for use, for example, to query People.get.
This is part of an example response of a single contact from People.connections:
{
"resourceName": "people/103710953423417258027",
"etag": "qwApd98gduQ=",
"metadata": {
"sources": [{
"type": "CONTACT",
"id": "1",
"etag": "#rj+KMFHVyHY="
}, {
"type": "PROFILE",
"id": "103710953423417258027",
"etag": "#4eZfef/IuMFw="
}],
"objectType": "PERSON"
},
...
}
resourceName is essentially the "id" of that contact and then in the metadata field it lists the sources the contact data comes from. E.g. CONTACT is for a Google Contacts entry where the user has manually entered name/phone/email/etc. PROFILE is a Google Profile, commonly with Google+ data.
The Person resource docs are a great place to learn more about these values.

Paypal REST API - Description/Item name missing

I am using paypal ruby sdk in order to process credit cards via rest api. Everything is working fine from perspective of credit card processing. Credit cards are processed properly without any kind of issues.
Unfortunately, when i preform the csv export of transactions on the sandbox (or live) merchant paypal account, the "Item Title" field is not populated and also I cannot see that description field is used anywhere.
Request to the paypal:
Request[post]: https://api.sandbox.paypal.com/v1/payments/payment
Request.body={
"intent":"sale",
"payer":{
"payment_method":"credit_card",
"funding_instruments":[{
"credit_card":{
"number":"xxxxxxxxxxxxxxxx",
"type":"visa",
"expire_month":10,
"expire_year":2020,
"first_name":"First Name",
"last_name":"Last Name"
}
}]
},
"transactions":[{
"amount":{
"currency":"USD",
"total":"1"
},
"description":"This is item description",
"item_list":{
"items":[{
"quantity":"1",
"name":"This is item description",
"price":"1",
"currency":"USD",
"sku":"This is item description"
}]
}
}]
}
Within the successful paypal response I am getting all of these data back including the fields populated with "This is item description".
My question is, which parameter we need to provide for this api call in order to populate "Item Title" field within transactions csv export?
What is the purpose of "description" field within this api request and where this field is used on paypal side (showed) after we process payment with credit card?
EDITED
Tried with PHP SDK as well (just to be sure that this is not an issue with specific SDK). At the end it seems that question is "Is there a field to be used as part of REST API which corresponds to 'Item Title' column within paypal export?"
Indeed answer from pp_pduan answers on initial bounty question (related with specific report). I am adding an update related with this specific report and other reports as well.
For credit card processing you can use following API's on paypal side:
Rest API
DoDirect Payment Api (Pro 3.0)
Payflow Gateway Api (Pro 1.5-2.0)
As per my discussion with paypal side and quite a detailed research, it is not possible to populate Item Name for some of the reports using REST API.
For credit card processing (in order to avoid issues in general with reporting systems) I suggest to go with DoDirect Payment Api if you have Pro accounts. Seems that this specific API is "older" then REST API credit card processing hence it is more stable and do not have any kind of issues with reporting system.
Having in mind that DoDirect Payment Api have weird documentation (at least for me this is not covered properly) I suggest to check following php repository with working solution (examples).
Try put a sample request payload like this,
{
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://localhost:80/getpaypal",
"cancel_url": "http://localhost:80/cancel"
},
"transactions": [
{
"description": "Transaction Desc Text",
"amount": {
"total":"80",
"currency":"USD"
},
"item_list": {
"items": [
{
"name": "Test Ticket 1",
"currency": "USD",
"quantity": "1",
"sku": "55a460ff65f13",
"price": "10"
},
{
"name": "Test Ticket 2",
"currency": "USD",
"quantity": "2",
"sku": "55a460ff66c7a",
"price": "20"
},
{
"name": "Test Ticket 3",
"currency": "USD",
"quantity": "3",
"sku": "55a460ff66ce2",
"price": "10"
}
]
},
"invoice_number": "55a460ff696br"
}
]
}
And when you download transaction history (csv) from your PayPal profile,
If you've ticked the option "Include Shopping Cart details",
the "name" field under each item object will display in the "Item Title" col; and the description field in transaction object will be in that col as well
If you leave the option of "Include Shopping Cart details", the transaction will be a single record in the csv without the cart item rows, and you'll only see ""description": "Transaction Desc Text"," (description field in transaction object) in the Item Title col

Resources