GetTransactionDetails and permissions in the new REST API world - paypal

I'm still trying to wrap my head around all this, so my apologies if I've made a mistake, but it seems like the old NVP apps that are now unable to be registered as of December 1st had some features available that can't be replicated in the new REST world order...
Here's what I want/need: I need to be able to translate buyer-side transaction IDs into my seller-side transaction IDs, and I want to be able to do this on a webserver that is secure but I don't want it to have full access to my account, so I'd like fine-grained authz for this server.
It seems like I am a couple days too late to actually get what I want/need. Basically, GetTransactionDetails does exactly what I want (convert buyer to seller transaction IDs, and returns the rest of the transaction information for good measure). And, although I haven't gotten it working, it looks like the Permissions SDK plus an NVP AppID would allow me to have just the TRANSACTION_DETAILS permission on this service which is exactly what I want.
However, as of Friday apparently I can't get an AppID for the classic NVP API? If so, my timing is impeccable.
Trying to figure out how to do this in the REST API has proven difficult. This thread talks about the sale record, which does indeed take a buyer-side transaction ID, but it does not actually translate it into a seller-side one. It does have the custom field, which helps me a little, but I really need the seller-side transaction ID. It looks like maybe the parent_payment URL in the return from the sale might help, but the API started returning PERMISSION_DENIED on me even on previously successful queries so I can't exactly test this right now. And, even if that did work, it seems like the permissions on the REST API are incredibly coarse compared to the Permissions SDK, for example the sale endpoint is under /v1/payments which seems to also include refunds and all kinds of other stuff I don't want exposed. It looks like there's a Transaction Search permission but it's marked beta and it didn't work for querying a sale for me. But maybe it means they're working on it?
What are my options here?
Thanks,
Chris

Okay, so I played around with this for a while, and it seems like the PayPal REST API is just not very good. So, I worked around the limitations here using AWS Lambda and its fine-grained IAM permissions. I created a Lambda function that took my PayPal NVP credentials as encrypted env vars, and an IAM account that could only call my Lambda function, and so now I've got a microservice that will translate transaction IDs and return some extra info (custom and email) from the transaction to boot.
I wish I didn't have to use AWS to work around PayPal's limitations (which seem to be getting worse with the REST API, the NVP api would have been fine if I could have gotten and AppID and used the Permissions SDK), but oh well.
Chris

Related

Jira Rest API is slow

So I'm using Jira Rest API, where the user can type their own JQL query and then a table will display tasks. The only problem is my Rest API is very slow, and I think it's due to login before it can access the data. Is there a way to make the Rest API faster?
a simple call which GETs around 20 task results takes up to 17sec, before the user gets the requested information.
the URL can be something like:
https://jirabd.xxx.com/rest/api/latest/search?jql=project%20in%20(BUG%2CFIELDB)%20AND%20component%20in%20(%22Fieldb%20Components%22)%20%22AND%20issuetype%20=%20BUG%20AND%20status%20!=%20%22Closed%22&fields=customfield_10100,customfield_10101,status
I simply just need to know where I might have to look to boost the performance, since I have no clue how/where to start looking.
EDIT
Did some more digging regarding login, and it seems its the way our accounts has been setup in the company. The service account I use for login, takes 17sec to login, where a regular account takes 1-2sec to login, so that's why. Now I just have to figure out why this is the case.
If the issue is login, try keeping the authentication cookie for the next requests:
https://developer.atlassian.com/server/jira/platform/cookie-based-authentication/
or OAuth as they do suggest

Get All Refunds in BigCommerce

I'm using BigCommerce and want to know if there is an endpoint that retrieves all refunds. I've seen the v3 orders endpoint /orders/{order_id}/payment_actions/refunds, but this gets all refunds for a specific order.
I want to know if its possible to get all refunds of all orders.
Edit:
Found the path for refunds, but now I need to know if I can use query params to filter the data or not.
In the orders API we can use filters like min_date_modified. Can I use the same for the refunds endpoint?
It seems they've missed the documentation on that endpoint, but if I was to guess I'd try /v3/orders/payment_actions/refunds?created:min=2021-01-01T23:05:05%2B00:00 since that's how other V3 endpoints work. I used that query and it didn't error (once I encoded the + sign in the time), but I don't have production creds at hand to test with real refunds.
I found an article that specified the endpoint URL
https://medium.com/bigcommerce-developer-blog/order-refund-api-automate-refunds-in-bigcommerce-7a00aaa6fae7
the endpoint to get all refunds is orders/payment_actions/refunds

Is it possible to have a ride request without authenticating the traveler?

I'm trying to use UberAPi to request rides while not requiring an authentication from the end user (rider).
My company should be responsible for the payments from such rides, and would only request that a driver appears at point A at such time, and deliver someone to point B.
Uber business does have all the features needed for such an integration: Usage reports, expense codes, and else, but I see no way of doing this without either an SSO or OAuth.
No, it is not currently possible to use the api for such a use case. You might want to consider using Uber Central.

What can one do with PayPal API keys

In case one is asked to enter their PayPal API keys (API user, API password, API signature), what can the receiving end actually do with those?
The receiving end wants to use the keys for Express Checkout and that's fine, but I'm not sure whether giving such information would actually enable the other party to make use of other functionality (such as having a look at the balance of the account).
Generally speaking, you can have a look at PayPal's REST API documentation to see what can be done with an API key. I'm not aware of any way to grant subsets of permissions to an API key (but I don't know for sure that it's impossible, either).
There's also the SOAP API. I haven't used it, so I'm not entirely sure if it uses the same API keys or some separate authorization mechanism. It does contain a GetBalance API, though.
It should perhaps be noted that I don't think it should be considered impossible that PayPal extends the API-accessible functionality at any time, though.

PayPal Rest API Get Sale - REQUIRED_SCOPE_MISSING

Today I have been trying to implement the rest API into my application to look up transaction information from a transaction ID (GET /v1/payments/sale/)
I have implemented everything correctly on my end and set the mode to "live" and I can't seem to get details from a transaction.
Here is the full error code:
{"name":"REQUIRED_SCOPE_MISSING","message":"Access token does not have required scope","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING"}
And here is documentation on what I am trying to do: https://developer.paypal.com/docs/api/#look-up-a-sale
Any help would be appreciated.
Thanks.
There are few things you could do to make sure your configurations are set right.
If the mode is set to live, are you using the live credentials instead of sandbox. You can select the sandbox app and copy the live credentials from there. See bottom part of this image.
Make sure Payments are enabled on live. PayPal has a dashboard page, where you could see all the services that you have enabled to work with Live environment. This prevents accidents on unknowingly using an API on live. You can check the status here
Is the sale that you are looking for created by the same clientId that you are using for making a GET call ? Only the app who creates the sale, can view the sale.
In the mean time, PayPal has created SDKs for many languages to support REST APIs. They are actively developed, and maintained, and could help you mitigate issues in handling tokens, credentials, etc, and allows you to quickly use APIs faster and in a way that could be upgraded easily. Also, few SDKs come packaged with Sample codes, and wiki documentations. Few are still under development, but you can feel free to contribute back to these open source SDKs.
When I had this issue, the problem was that I was making REST requests using the Identity API token. Basically, I was logging users into my website with Paypal then using that token for REST requests when another token from the REST API service should have been used. "
Here is the support ticket from Paypal SDK deveoper Randy who helped answer my question even though I do not use the SDK. Thanks Randy:
https://github.com/paypal/PayPal-PHP-SDK/issues/785#issuecomment-282749095