PayPal's documentation is pretty bad, but they do have a PHP notification verification sample here which mentions:
PHP Currently does not support certificate chain validation, that is necessary to validate webhook directly, from received data. To resolve that, we need to use alternative, which makes a call to PayPal's verify-webhook-signature API.
It also includes some files that aren't within the Checkout SDK. I found this question from a year ago in which someone created what seems like a decent explanation of all of the various missing packages and files that aren't included in the base SDK.
One of the key parts of their answer was to install a separate PayPal SDK, which they don't mention anywhere in the documentation, via composer (without mentioning its package name). Luckily composer has decent recommendations to my incorrect attempts at finding it so I got it eventually with: composer require paypal/rest-api-sdk-php. Looking through the files it downloaded, it's clear that this is the package that the Paypal documentation I listed above is including. However, upon requiring it I got the message
Package paypal/rest-api-sdk-php is abandoned, you should avoid using it. No replacement was suggested.
This seems pretty cut and dry, that it's not future safe and I shouldn't use it, but what am I supposed to do instead? Is there some new SDK somewhere I should be looking at or have they just given up on PHP and I have to just start making direct hand crafted API calls?
There is no supported SDK for webhooks -- not for PHP, nor for any other environment. Use a direct HTTPS integration.
Related
I've been implementing PHP getstream.io support for our app, found that the official PHP library is lacking compared to Python one.
Checking official api refs on getstream.io site - seems they are not full by any means as well.
For example - we have 'stats/follow/' endpoint, allowing to get following/followers counts easily, quite a common thing to use for user profiles. I found it by reading python lib. But it is not documented at all on the official site, there are no mentions it even exists.
Am I looking for the full api refs in the wrong place (on getstream.io official site)?
Maybe there are a lot of other useful endpoints I am not aware of, as they are not present in the official refs?
stats/follow is a recent addition (beta right now) which isn't added to PHP SDK at the moment. PRs are always welcome (good to imitate Python SDK). Anyway, it will be added though, just a matter of time.
REST docs will be auto generated in near future.
I made a WP plugin which depends on the Youtube API. So, to do it well, I use Google API PHP client.
My issue is quite simple: the Google API PHP client is huge (more than 12 000 files), including clients for all Google services, when I just need to use Youtube service. So I'm not confortable committing all those files to the WP plugins repo when most of them are useless in my case.
So, right now, my composer.json looks like this:
{
"require": {
"google/apiclient": "^2.0"
}
}
Any way to use only the Youtube API client (using composer if it's possible)?
This is not for the feign of heart but it is doable.
Go to this branch of the repo https://github.com/google/google-api-php-client/tree/v1-master
Grab the full src/Google directory you will need all of that.
In the src/Google/Service directory is the stuff for all the different APIs. Remove everything except for YouTube.
cross your fingers it should work.
This wont remove all 12000 files but it should give you just what you absolutely need. I used to do this but its been a few years.
Unfortunately, I don't think this is possible without manually including the relevant files in your project (which is a really bad idea).
The reason why its impossible, is because Google places all service APIs for the PHP library in a single GitHub repository found here:
https://github.com/google/google-api-php-client-services
If Google does split them into multiple repositories, then it could be possible to include a single repo.
For now, though, all services are under one composer project and one repo. Maybe its worth making a GitHub issue to ask Google about this?
I am trying to setup the "Merchant SDK" for Express Checkout option with Paypal.
While installing the 'dependecy' as prescribed with curl or composer, the system is having trouble with loading 'sqlsrv' and some other modules.
My doubt : Is this all really necessary? Can't I just download the SDK files from github and start using them? The only dependency needed for the basic working is openssl. Am I right about it? What is it that curl/composer really do in this case?
curl is utility to transfer data with different protocols and composer is a php dependency manager which helps in deployment of php code and makes sure that you have the required libraries. You can surely use the code directly but it might become difficult to maintain it.
If you're going to use their SDK it's recommended that you use composer to install their package. That's the only way you'll be able to follow along nicely with all their samples/tutorials.
curl is going to be required to make POST calls to PayPal, but it's generally enabled by default on any good web host. The composer file is just ensuring that it is available when it installs the package. The way they built their SDK's does make it a little tough to use without following those procedures.
If you want something a little more direct you might be interested in my PHP class library for PayPal. It requires curl, too, but again you should already have that, and it comes complete with functional samples and prepared template files for all of the API calls PayPal provides. You can take care of pretty much any API call you need in a matter of minutes.
Adding Httpful (http://phphttpclient.com/) to ATK4 using the recommended Composer method does not work.
After some fooling around I managed to get all the file paths correct but I get "Fatal error: Class 'Frontend' not found in /var/www/portal/index.php on line 14".
Using the 'phar' method described on Httpful's page is also a no-go.
I don't know if this needs to be implemented through an add-on, and if it does, I don't know how. Any info/pointers would be appreciated...
The bottom line is: I need to interact with a REST API in a sane way, it doesn't have to be Httpful specifically, is there another solution out there that someone has already implemented in ATK4?
Please look into this repository which is designed to run Agile Toolkit based on composer primarily:
https://github.com/atk4/atk4-secure/
You can also look at this branch:
https://github.com/atk4/atk4/tree/4.3-PageManager-refactoring
which deals with this issue:
https://github.com/atk4/atk4/issues/403
although that's not part of the "master" branch, instead it went to 4.3. Perhaps you can back-port the commits.
Edit: I must also mention, that this should work best if you have picked Agile Toolkit from Git repository.
I have struggled with google's php library, the latest version of which is available on their own website. While the simple google plus example they provide works fine (it's a basic login with GET features), there is no way to add a moment activity via app in php - at least not for me.
Their own example isn't working (the example can be retrievd in the library: examples/moments/simple.php)
Someone provides an answer here but the button demo they provide isn't working either if I press (authorization is fine, posting produces no action.
Does anyone have a suggestion on how to change their own php file so to make it work? I tired removing all the code and resetting it to the basic action: at least I am not getting oauth or php errors, but the file produces no action.
I understand that posting moments in php is not currently supported, but I have a web app and android implementation wouldn't work for me I think.
At the moment you need to get the library from the trunk, you can find instructions here.
This gist documents how to request permission and write activities.
The old moments api has been deprecated and those samples are for the old API, I'll remove them from the codebase as soon as possible. Thanks for raising this question!