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

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

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.

PayPal Payouts (Sandbox) response MALFORMED_REQUEST_ERROR

I'm using PayPal Payouts in my project. I found an issue when creating a Payout. The request is made on Postman (Windows), and Node.js using axios (Firebase Functions).
I received a response MALFORMED_REQUEST_ERROR on this request:
POST https://api.sandbox.paypal.com/v1/payments/payouts
{
"sender_payout_header": {
"sender_batch_id": "2018083001",
"email_subject": "You have a payout!"
},
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": "9.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"sender_item_id": "2018083001001",
"receiver": "receiver#example.com"
}
]
}
I tried changing items[0]/note to a test value: POSPYO001, the API will response 201 Created as expected.
Why the sandbox is working only on positive/negative test values ? Is this a limitation, or a bug ?
P.S. Sorry for my english.

Triggering smart campaign and getting 603

I am trying to use Marketo smart campaign to send email data.
What I do is:
1) get or create Lead with addresse email
2) trigger smart campaign I've created with this lead_id and a couple of tokens I created on the folder containing the campaign.
That is, I am sending POST to https://.mktorest.com/rest/v1/campaigns/5826/trigger.json?access_token= with body
{
"input": {
"leads": [
{
"id": 2034349
}
],
"tokens": [
{
"name": "{{my.subject}}",
"value": "subj"
},
{
"name": "{{my.message}}",
"value": "the text"
}
]
}
}
And I get the response:
{u'errors': [{u'message': u'Access denied', u'code': u'603'}], u'requestId': u'c8f5#14c79fae723', u'success': False}
I was trying token names without "{{" and "}}", without "my." - the same result. The campaign exist and has this ID.
What's wrong here?
The role of the Marketo API user that you're using needs the "Execute Campaign" permission, and your current user is probably missing that permission. Unfortunately you can't edit the existing role. You'll need to create a new role, check that permission, and possibly also create a new API User.

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

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…

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