Stripe Payment while chatting
# 🤝help
b
I want the Bot to acknowledge that a Stripe payment has been successful and proceed with the conversation according to that. How can I do that?
a
Hey G, I have the same question. I think we can use make.com webhook for that. Did you look on the internet for solutions?
w
Hey guys ! You the Webhook integration in you bot and use the trigger feature.
Go on the integration hub and enable the wehook integration for your bot: https://app.botpress.cloud/hub/integrations/6d68151a-186e-49c6-a128-940f9a60e673e
e
It seems like it's possible with Zapier and Make, check out their docs: https://zapier.com/apps/stripe/integrations https://www.make.com/en/help/app/stripe
a
I was playing around and I figure using Stripe API Calls in Botpress Code Blocks is probably the slickest and best solution. Will keep you updated on the progress and if I make a breakthrough
So probably no make.com/zapier needed
b
Tell me man
I have tried almost everything
Yes brother. Been back and forth with Stripe payment links and Zapier.
I think you can easily do it using the predefined events and triggers inside Botpress. But I can't understand what code or block should I write inside it to trigger the Stripe payment.
If you guys find any solution to these, please tell 🙏
e
I don't think you would need Triggers for that! Simply a Execute Code card that makes a request to the Stripe API with the payment details. You will get an response from Stripe within seconds, which you can manage in the same Code card, and proceed the conversation accordingly
Check out the Stripe docs https://stripe.com/docs You would be using a Node.js environment 😉
b
So we don't need Stripe's webhook
And, how will the Bot itself will process and acknowledge that the payment has been successful?
This is the code I've written and it's still giving me errors

https://cdn.discordapp.com/attachments/1134539926508142662/1135057420746502154/20230730_092052.jpg

And this is the Node.

https://cdn.discordapp.com/attachments/1134539926508142662/1135059660450320434/rn_image_picker_lib_temp_929daeff-5034-41d5-bee2-e24e7523a597.jpg

a
Yo, G, I've figured it out. Just write in the Execute Code Block: "Make call to stripe to check whether customer's payment was successful. Use env.stripeapiKey to authenticate and workflow.customerID as the customer ID. Define workflow.success and set to false. If the api call was successful, set workflow.success to true." Then use ChatGPT to debug the code. Simply copy and paste the code and the error code from Botpress and ask what to do about the error. Works flawlessly. Stripes API Docs are brilliant. Easy to use and understand. Really top notch. If you're still confused, shoot me a private message and let's talk 🔥
BTW, I meant you to write the above in the Execute Code Block and use the AI Feature of Botpress to generate the JS Code for you. You then just need to debug it a little.
14 Views