With PayPal REST SDK, how I can I get the buyer's country but not the entire address? - privacy

I'm using the PayPal REST SDK for payments, but since I'm selling digital goods, I don't need a shipping address, so for privacy reasons I don't want one.
However, it sounds like I need the billing country for Euro VAT purposes, and I don't know how to do that.
I've configured a payment experience using the following request:
{
"flow_config": {
"landing_page_type": "Billing"
},
"input_fields": {
"allow_note": false,
"no_shipping": 1
},
"name": "my name"
}
The no_shipping parameter is documented thus:
Determines whether or not PayPal displays shipping address fields on
the experience pages. Allowed values: 0, 1, or 2. When set to 0,
PayPal displays the shipping address on the PayPal pages. When set to
1, PayPal does not display shipping address fields whatsoever. When
set to 2, if you do not pass the shipping address, PayPal obtains it
from the buyer’s account profile. For digital goods, this field is
required, and you must set it to 1.
And preparing the payment:
{
"experience_profile_id": "XP-JVB9-FJ5Y-RMWS-ZCTS",
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
etc…
}
Executing the payment returns:
{
"create_time": "2015-02-05T08:24:53Z",
"id": "PAY-snip",
"intent": "sale",
"links": [
{
"href": "snip",
"method": "GET",
"rel": "self"
}
],
"payer": {
"payer_info": {
"email": "test#test.com",
"first_name": "Test",
"last_name": "Buyer",
"payer_id": "snip"
},
"payment_method": "paypal"
},
etc…
}
Which is great: no address… but also no country code.
I think PayPal is missing another value, which requests the country code but not the rest of the address…

Related

How can we differentiate between a secondary and shared calendar in Google Calendar API response

I have a query with respect to the Calendar List API for Google Calendar:
https://developers.google.com/calendar/api/v3/reference/calendarList/list
We have a scenario where user1 has shared his calendar with user2 with Make Changes and Manage Sharing permission.
Now if we invoke the list calendar API on user2, we receive a response as below:
{
"kind": "calendar#calendarListEntry",
"etag": "\"<redacted>\"",
"id": "user1#gmail.com",
"summary": "user1#gmail.com",
"timeZone": "Asia/Kolkata",
"colorId": "4",
"backgroundColor": "#fa573c",
"foregroundColor": "#000000",
"accessRole": "owner",
"defaultReminders": [],
"conferenceProperties": {
"allowedConferenceSolutionTypes": [
"hangoutsMeet"
]
}
}
We can see that the access role above for the user1's calendar is owner and the primary value is absent(false).
Now if user2 has a secondary calendar we again see something similar in the listcalendar API response:
{
"kind": "calendar#calendarListEntry",
"etag": "\"<redacted>\"",
"id": "<redacted>#group.calendar.google.com",
"summary": "Secondary Calendar",
"timeZone": "Asia/Kolkata",
"colorId": "1",
"backgroundColor": "#ac725e",
"foregroundColor": "#000000",
"selected": true,
"accessRole": "owner",
"defaultReminders": [],
"conferenceProperties": {
"allowedConferenceSolutionTypes": [
"hangoutsMeet"
]
}
}
Access role above for the secondary calendar is owner and the primary value is absent(false).
So how can we differentiate between a secondary and shared calendar for user2? We require the same for some specific processing in our application.
As discussed in the comments there does not seem to be a clear way to differentiate the secondary calendars, except for the id and the appearance of the primary field.
Without having a database to control it, it does not seem to be possible to differentiate between a secondary calendar and a shared calendar, except for the calendar id.
You can use this template to explain your case to Google and ask to always have a field where you specify the calendar owner or another element that allows you to identify it.

When I want to approve new recurring payment in PayPal, I got a total amount of 0

I'm trying to test setting up a new recurring payment in the PayPal sandbox. Endpoint for this request is: https://api.sandbox.paypal.com/v1/billing/subscriptions
Body:
{
"plan_id": "P-9JP75835703395314MA2P3FQ",
"start_time": "2021-03-04T20:00:00Z",
"subscriber": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer#example.com"
},
"application_context": {
"brand_name": "example",
"locale": "en-US",
"shipping_preference": "SET_PROVIDED_ADDRESS",
"user_action": "SUBSCRIBE_NOW",
"payment_method": {
"payer_selected": "PAYPAL",
"payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
},
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}
When I want to approve newly created subscription, I got this:
PayPal approve screen
My question is: why is the total amount 0 (seen next to the cart icon), when the recurring amount is set at 100 PLN?
If you want it to bill right away, don't specify a start_time

Deeplinking into a telegram bot

I have a simple use case. When a user clicks the link below,
T.me/MycompanynameBot?start=Microsoft
I want to show him 3 inline buttons corresponding to 3 Telegram channels within Microsoft. Is this possible?
The key is the bot must be able to retrieve the parameters from the URL.
Thank you.
Yes it's possible to retrieve bot parameter via answerCallbackQuery
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via #Botfather and accept the terms. Otherwise, you may use links like:
t.me/your_bot?start=XXXX
that open your bot with a parameter.
Here is an example I made for you :
{
"ok": true,
"result": [{
"update_id": 89590932,
"message": {
"message_id": 5978,
"from": {
"id": 223110107,
"is_bot": false,
"first_name": "Ğąme",
"last_name": "Ǿver!",
"username": "GameO7er",
"language_code": "en"
},
"chat": {
"id": 223110107,
"first_name": "Ğąme",
"last_name": "Ǿver!",
"username": "GameO7er",
"type": "private"
},
"date": 1579094448,
"text": "/start Microsoft",
"entities": [{
"offset": 0,
"length": 6,
"type": "bot_command"
}]
}
}]
}
As you can see type=bot_command so you can parse the message if (type == "bot_command") and get text and substring /start from the original text or what ever you want to do.
In many cases I detect users with the parameters for example when I wanna to know who invited this user to bot I share the link in this format:
t.me/NameBot?start=ReferUserID
for example :
t.me/NameBot?start=223110107
is my ID and I can see how many user I've invited to the bot.
Hope be useful.

Does the RingCentral Call Log API Return a "Missed" Value?

In the RingCentral Online Account Portal (https://service.ringcentral.com) and endpoint apps, the call log display shows whether a call was Inbound, Outbound or Missed.
In looking at the API Reference for the Call Log API, it seems that it only sends back Inbound or Outbound for "Direction". Does the developer Call Log API return a "Missed" value? Is there another way to get this information via the Call Log API?
Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefCallLog.html
This question appears to be in reference to the Online Account Portal UI's "Type" column as shown in this screenshot:
The web UI's "Type" column shows Inbound, Outbound or Missed. This can be generated by using the response properties for both direction and result.
direction API response property will be Inbound or Outbound
result API response property is an enumerated value that includes Missed and other values including Voicemail which is the example screenshot. A full list is available in the link below:
Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#ResultStatusValues
Here is an example response:
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/call-log?view=Simple&showBlocked=true&withRecording=false&dateFrom=2018-08-27T06:18:00.000Z&page=1&perPage=100",
"records": [
{
"uri": "https://platform.ringcentral.com/restapi/v1.0/account/11111111/call-log/22222222?view=Simple",
"id": "22222222",
"sessionId": "33333333",
"startTime": "2018-08-27T17:38:12.634Z",
"duration": 27,
"type": "Voice",
"direction": "Inbound",
"action": "Phone Call",
"result": "Missed",
"to": {
"phoneNumber": "+16505550101"
},
"from": {
"phoneNumber": "+16505550102",
"name": "LOS ALTOS CA",
"location": "Los Altos, CA"
}
}
],
...
}
Please read this blog to find out more information you can find from the call log.

How to "Add guest" to event via google calendar API?

could you please give me a hint on how to share a single event via google calendar api?
That is I'd like to invite other users to see the event programmatically without sharing the whole calendar. To mimic the "Add guests" UI action
As Claudio mentioned, you need to use the Google Calendar Advanced API for this.
You'll want to use a patch because you don't want to replace all the other data on the calendar invite. However, even in the case of patch, since the attendees lives in an array, if you attempt to pass a patch such as this:
{
attendees: [ { email: "new#example.com"} ]
}
... it'll replace all old invitees (i.e. it'll remove anyone that was on the invite before you called patch). To fix this, you must first get the current invitees, add a new person to the array, and then send a patch.
You can see a detailed example of this in this answer which also explains how to use Google Apps Scripting to ensure an email is sent to the user when adding them to a calendar event (see the addGuestAndSendEmail() method in that post).
You can use the API to add people to the attendees collection:
https://developers.google.com/google-apps/calendar/v3/reference/events/update
refer the following request.
method: POST
endpoint: https://www.googleapis.com/calendar/v3/calendars/primary/events?sendUpdates=all
here, sendUpdates means when you add any guest so he would get an invitation mail used based on scenario.
Input Json:
{
"kind": "calendar#event",
"etag": "etag",
"status": "confirmed",
"summary": "JayKara",
"description": "eqwbdjhwhhwhhwrhjehrhejhfj",
"location": "America",
"creator": {
"email": "#mail.com",
"self": true
},
"organizer": {
"email": "#mail.com",
"self": true
},
"start": {
"date": "2019-12-23"
},
"end": {
"date": "2019-12-24"
},
"originalStartTime": {
"date": "2019-12-24"
},
"visibility": "public",
"attendees": [
{
"email": "****#mail.com" //this guys are the guest
}
]
}.
After that there is no patch method required your guest guys will receive an invitation whenever update event
Cheers!

Resources