Stripe to Salesforce via Microsoft Power Automate

Stripe is a great payment processor. Integration with salesforce requires using a third party tool, of which there are many - though i have not explored them.

I recently discovered the inbound http request connector in Microsoft power automate, fka microsoft flow.

Like most things with flow, its got some quirks. I cannot find this connector for an automated flow, only for an ‘instant’ flow - which is supposed to be triggered manually but in this case fires automatically. So, yeah, onwards.

So create a new flow, type = instant, give it a name, and select ‘when http request received’ as the trigger.

flow1_instant.png

Add a connector, any connector (I chose weather), click save, and you have a REST API endpoint on Azure of your very own. (you have to have another connector to save)

Open up the HTTP connector, and you can see the endpoint (the HTTP POST URL). Copy that.

flow_httpReq.png

Now we need to enter the request body json schema so the flow knows what to expect, but we dont have to roll our own. Just leave it blank for now.

A) Setup a webhook in stripe to fire on an event, point it at the new endpoint. I used the charge succeeded event but there may be a better one to use as there are a lot of events.. you will have to figure this out based on your use case). Make sure you use the endpoint you copied above.

flow_endpoint.png

B) fire off a stripe transaction (I used formassembly as the front end to trigger a stripe transaction, but there are many options here, like the stripe CLI).

C) Open up your ‘flow runs’. You should see a successful run - click on that. In the outputs section, you can see the JSON body in the schema. Copy the whole json structure.

flow_runOutput.png

D) Go back and edit the flow. Open up your http request flow element, click ‘use sample payload to generate schema’ and paste in the json from above, and voila - microsoft parses the json which means you can access all the stripe data in downstream steps, like connecting to salesforce.

Try it - add a salesforce connector to create a lead
Map a few fields
And send a test transaction again.

flow_LeadElement.png

flow_leadCreated.png

(I mapped ID, status, and amount to an ‘other information’ text area field on lead)

There clearly would be a lot more work involved in building out a complete solution to handle refunds, recurring transactions, errors, and all the things that come with integratoins.

And there are some oddities - like the fact that the same field shows up a few times when mapping stripe output into the salesforce connector, so there may be a better way to parse the json - I have not looked at it closely.

And you may want to verify the webhook signature for security and all.

But overall this seems like it works and can probably be built into something robust.

 
1
Kudos
 
1
Kudos

Now read this

Dynamic Approvals in Salesforce Using Visual Workflow

We needed a dynamic approval process for our new HR system (FinancialForce HCM), where the 3 approvers for a consultant job requisition needed to be based on the budget managers for the related department, cost center, and region. Budget... Continue →