Paypal php API: setting up credentials - paypal

This is a simple question. I am using the Paypal php api (https://www.x.com/sites/default/files/merchant-php-2.0.96.zip). I found my api keys (Api username, password and signature). But I cannot find where to specify them in express check out in the PHP SDK( I am using the Express checkout from the Samples).
Any help is appreciated.

Modify this file config/sdk_config.ini

Use the sandbox api credentials as follows:
use the business account created as one of your sandbox account. (applications tab, sandbox accounts). Click on the account, then on "profile" under it, then on the "API Credentials" tab.
edit the sdk_config.ini in the php sdk (under the config folder), and use those credintials with an app_id of APP-80W284485P519543T
Make sure mode is set to sandbox under [Service] in the ini file.
When you make the service call use the account username you entered in the ini file as follows:
$setECResponse = $paypalService->SetExpressCheckout($setECReq,"API_USERNAME");

Related

Why do I get authentication error when trying to access PayPal Sandbox (ref REST API app)?

As requested by Preston PHX, I uploaded a full copy of my
code to Dropbox:
My test ASP.NET Web App
I hope this helps someone to identify what I may have done wrong
#####################################
I am trying to use the sample code at https://github.com/paypal/Checkout-NET-SDK/tree/develop/Samples to make contact with the Sandbox but it doesn't work for me. In order to find out why, I ran my code in Visual Studio under Localhost in debugging mode, using several breakpoints.
This line of code in my test page ...
var createOrderResponse = CreateOrderSample.CreateOrder(true).Result;
... displayed the following error:
Inner Exception 2:
HttpException: {"error":"invalid_client","error_description":"Client Authentication failed"}
However, it was the environment function in PayPalClient.cs (modified to use my PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET) that appears to have generated the error:
public static PayPalEnvironment environment()
{
return new SandboxEnvironment(
System.Environment.GetEnvironmentVariable("PAYPAL_CLIENT_ID") != null ?
System.Environment.GetEnvironmentVariable("PAYPAL_CLIENT_ID"):"<<PAYPAL-CLIENT-ID>>",
System.Environment.GetEnvironmentVariable("PAYPAL_CLIENT_SECRET") != null ?
System.Environment.GetEnvironmentVariable("PAYPAL_CLIENT_SECRET"):"<<PAYPAL-CLIENT-SECRET>>");
}
I very carefully copied my PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET from the REST API app I created via the PayPal Developer Dashboard. Apart from that, the GitHub sample code has not been modified. I could see no requirement in the GitHub code to specify a Sandbox URL and assume that this is provided by the PayPalCheckoutSdk via the use of "return new SandboxEnvironment()".
It's not obvious to me why my attempt to connect to this Sandbox account is failing the authentication process. What might I be doing wrong? Is it anything to do with my use of Localhost?
EDIT on 1 Nov 2021 in response to Preston PHX
Creating a new Sandbox Client ID and Secret made no difference. Prompted by another forum post I read some time ago, I also tried using ngrok (for the first time) to open http port 80 to facilitate PayPal testing via Localhost, but the connection to the Sandbox still failed authentication.
Sandbox Client ID: AZcb8XrqhJEUO7lS_JtKSe3sdNDLESmo3ekhupDKTL1J9vQCKVOzacCjO3PBQwSfngYkLGa-qS7EUrGV
Secret:
EBEcuPewHdzCB8p0qE1Yszjk2eMyFCstzkL0Diz2WC5IQREsu6cDHr7yFG9a-GDIyljb-KRb2DA6Hoey
I installed curl (plus Bash and Git) on my Windows 10 PC and ran the curl command specified on the get-an-access-token page. I couldn't find a way to post the result here in an easily readable form so I put it in a Word doc and uploaded that to Dropbox.
https://www.dropbox.com/s/knia3y2ighfzxpa/Result%20of%20PayPal%20curl%20command.docx?dl=0
Edit on 2 Nov 2021
As requested by Preston PHX, I have uploaded a copy of the ASP.NET Web App I have been using for my tests to Dropbox.
https://www.dropbox.com/sh/4uclfs2lexv4v42/AAAjoZIN5cEMV1mu0cYi24zKa?dl=0
I've only uploaded the project folder, as I'm guessing that it is unnecessary to upload my Solution files.
Create a new sandbox client ID and secret in the developer dashboard. Test with the new client ID and secret.
If issues persist,
Update your question with both the new sandbox client ID, and the new sandbox secret.
Update your question with a sample curl command to get an access token, showing the entire command and the entire response in your question.

Cannot log in gcloud SDK using the non google account

I associated with my other email (mymail#cn.waha.com) with my google account (jinchihe#gmail.com).
When I try to run the gcloud auth login mymail#cn.waha.com, open a web browser, and by default that's gmail and I selected the Use another account to input my other email and password, and then still show Google Cloud Sdk wants to access your Google Account jinchihe#gmail.com, I click Allow but screen shows
ERROR: (gcloud.auth.login) You attempted to log in as account [mymail#cn.waha.com] but the received credentials were for account [jinchihe#gmail.com].
Please check that your browser is logged in as account [mymail#cn.waha.com] and that you are using the correct browser profile.
Seems only can logged in by google account? How can I log in with my mymail#cn.waha.com, I need show mymail#cn.waha.com in gcloud info so pass authentication. Thanks!
You can sign in using one of the following identities:
Google account
Service account
Google group G Suite domain account
If your domain is part of the Google G suite domain then you should be able to log in, using third party domains (such a Hotmail, yahoo, etc) won't let you*. You state that you were able to "log in" into your account through the browser and "allow" the permission. After that you should see a code (random string of text) that you would have to copy and paste into the shell console before continuing the authentication.
*note: you can create a Google Account using a third party email domain, just go to the Create your Coogle Account page and click on "Use my current email address instead" to introduce your personal email (in your case "mymail#cn.waha.com").
Also, according to the error message, you are running the command with "mymail#cn.waha.com" but on the browser you are logging in with "jinchihe#gmail.com" account.

How to get clientid and clientsecret for OAuth 2.0 authentication in servicenow

I am trying to integrate my client application with ServiceNow using OAuth 2.0 authentication. In servicenow documentation for REST apis i have seen that we have to register our client with servicenow to get clientid and clientsecret for OAuth 2.0 resource owner password authentication. In the document to register the application we have to navigate to System OAuth > Application Registry in servicenow, but in my servicenow instance System OAuth > Application Registry is not present. How should i proceed to get the clientid and clientsecret
It sounds like the OAuth 2.0 plugin may not be active on your instance.
Got to: https://YOURINSTANCE/v_plugin_list.do?sysparm_query=GOTOname%3E%3Doauth and make sure it is Active
Also in your System Properties, make sure that OAuth is turned on.
This URL: sys_properties_list.do?sysparm_query=GOTOname%3E%3Dcom.snc.platform.security.oauth.is.active
Also check out the wiki for any further clarification:
Good luck!
Steps to create and app and get client id/client secret.
Log into ServiceNow. Make sure you have an admin user login.
You need to navigate to System OAuth > Application Registry. Click New.
Easiest way is to search for "Application Registry"to register an OAuth client application in ServiceNow interceptor page, click Create an OAuth API endpoint for external clients. Fill out the fields, as appropriate.
Step 1
Step 2
Name - e.g. MyApp
If you leave the "Client Secret" as blank that will be the admin password by default (I won't recommend this)
Step 3
Additional Info:
Note that the refresh token expires in 100 days (8,640,000 seconds).
You can update the “Refresh Token Lifespan” to “2,147,483,647” (maximum value allowed by ServiceNow) to have a longer expiry for refreshtoken.
More Details - http://wiki.servicenow.com/index.php?title=OAuth_Setup#gsc.tab=0
• Click Submit.
Make sure tables you access via the api are allowed for web service access. Go to System Definition > Tables and locate your table (e.g. “sys-user”). Make sure “Allow access to this table via web services” checkbox is ticked. By default this is enabled.
Provide your Servicenow admin account username and password with the ClientId and ClientSecret to authorise your app to connect to ServiceNow.

PayPal application going live. New credentials

I use some 3rd party script for processing the PayPal payments. Found it on Github, works perfect. It uses the following credentials:
Username, password, signature.
In sandbox it works perfect. Now I want to go live.
I go to developer.paypal.com -> My apps -> choosing my app -> Show live credentials.
Now, it shows me:
Endpoint - api.paypal.com
Client ID - xxx
Secret - xxx.
However, I can't find the ones I actually need. Where do I get them ?
What these credentials are used for ? (client id, secret, endpoint) They don't appear anywhere in the code of my payment script.
Thank you.
You need to get Classic API credentials:
https://developer.paypal.com/webapps/developer/docs/classic/api/apiCredentials/

How can I deploy salesforce project with apex class to enterprise account?

I've been working in a salesforce development edition environment and have built something that uses an apex page and an apex class. I'm now trying to deploy this to our company's salesforce account so they can test it out. We have an enterprise account, I believe. When I use "Deploy To Server" from ForceIDE, I enter the username, password and security token of a sys admin on the company account. In the screen where it shows me what it will deploy, the apex class is not checked and when I click on it, it says "Component Type not permissible in destination organization".
This is my first attempt at salesforce development and am stuck. I've read everything I could find on the subject but nothing has helpe. Any thoughts on what I'm missing?
Just to be clear, my code is at 92% test coverage -- so that is not the problem.
Thanks
John
You say you're using a system administrator username. Please double check that they are an admin, and more specifically, that they have the "Author Apex" permission checked on the user profile.
Just check, are you using Admin profile or anything else?
And check with the Administrative Permissions
API Enabled
Author Apex
Both these should be checked.