Integrate Stripe with Salesforce (Error)

Hello , I am new to n8n.

I want to insert the products I have on salesforce and then update my products on salesforce with the stripe id.

So since the product object does not exist in the salesforce node, I made an http request to update my salesforce data.

Here is the error I get

Can you please help me?
​ ​

Hi @Hasnaa_SOUIBA, welcome to the community :tada:

The error suggests the API you are calling in your HTTP Request node doesn’t accept the credentials you are using.

Can you share your workflow (simply select it, copy it and then paste it here on the forum using the button for preformatted text) as well as the data you are passing on the HTTP Request node from your screenshot along with a link to the documentation of the API you are trying to use? This will help the community with better understanding your problem.

1 Like

Hi @MutedJam,

Thank you for your reply.

Documentation Salesforce : Salesforce Developers

Workflow:

Http Request URL :
https://gridpal--partial.lightning.force.com/services/data/v54.0/sobjects/Product2/{{$node[“Get Product Id”].json[“Id”]}}

Hm, the Salesforce documentation seems to suggest OAuth2 authorization is required but your workflow uses Basic authentication instead.

Could you try configuring OAuth2 credentials for your HTTP Request node connecting to the Salesforce API? You would need to register a “connected app” first as described here:

When creating such an app, Salesforce will eventually give you a Consumer Key and a Consumer Secret. These values correspond to the Client ID and Client Secret fields in n8n:

Once I had updated my credentials and changed the hostname to my-domain.my.salesforce.com and used fields existing for my “Products2”, the request was working as expected:

Thank you very much for your help :blush:

So I did as you said , but I get this error

cause

{"status":"rejected","reason":{}}

stack

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/HttpRequest.node.js:888:27)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:451:47

Also , when I want to connect my salesforce account (Screen 1) , I can’t login to my account.
It looks like there is the wrong URL (Screen 2).
When trying to connect a sandbox account you have to use another url not (http://login.salesforce.com/)…

Unfortunately I can’t change the URL…

Yes, Salesforce does indeed use different URLs for sandbox vs. production accounts. The ones I am aware of are the ones used by n8n’s Salesforce node. They also worked for me when testing this and allowed me to authenticate with Salesforce:

Sandbox

Authorization URL: https://test.salesforce.com/services/oauth2/authorize
Access Token URL: https://test.salesforce.com/services/oauth2/token

Production

Authorization URL: https://login.salesforce.com/services/oauth2/authorize
Access Token URL: https://login.salesforce.com/services/oauth2/token

The scopes I entered in n8n were full refresh_token. Could you try if you can authenticate with these settings?

Hi @MutedJam

Unfortunately It doesn’t work, I always get the same error

Hi @Hasnaa_SOUIBA, is the authentication working or are you already getting errors there?

And could you double check the hostname you are using for your request? You mentioned you are sending the request to your-sf-comain.lightning.force.com, but the documentation you have provided suggests using your-sd-domain.my.salesforce.com instead (which is also what I have tested).