Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Go to Haptik Website
  • Contact Us
  • Home
  • Developer Guides
  • Stripe Integration

How to Set Up Stripe Integration

Written by Soham Amburle

Updated on September 9th, 2022

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting Started
    Build Deploy Analyse Manage Account Bot Deactivation
  • Bot Building
    Essentials Smart Skills Steps User Messages Bot Responses Entities Connections Customisations User feedback collection Testing Whatsapp Bots NLU Bot Maintenance
  • Smart Agent Chat
    Set up Admin Settings MyChats Section (Agent Inbox) Live Traffic Section Teams Section Archives Section Analytics Plans on Smart Agent Chat
  • Conversation Design
    Design Basics Design Guides Designing for Platforms Designing WhatsApp Bots
  • Developer Guides
    Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
  • Deployment
    Web SDK WhatsApp Facebook Instagram Sunshine Conversation LINE Google Business Messages Telegram MS Teams Bot as an API iOS SDK Android SDK
  • External Agent Tool Setup
    Zendesk Chat Salesforce Service Cloud Freshchat Zoho NICE CXOne Gorgias
  • Analytics & Reporting
    Intelligent Analytics
  • Notifications
    SMS Notifications Success Measurement
  • Commerce Plus
    Catalog Integration Bot Building Guide Channel Deployments Unified ML Pipeline Documentation
  • Troubleshooting Guides
    Error Messages FAQs
  • Release Notes
+ More

Table of Contents

What is Stripe? Prerequisites for using Stripe Integration How to set up? How to use the Skill How to make changes to the Skill

What is Stripe?

Stripe is a payment solution that allows businesses to accept, process, and disburse payments.

Haptik has come up with Stripe Integration using which you can add payment solutions to your bot. Once this integration is set up on your bot, you can collect payments from your users by providing them a payment link over conversations, generated using APIs. It is a highly convenient way to accept payments from users.

Prerequisites for using Stripe Integration

  • A registered account on Stripe. You can read more about it here.
  • A bot on Haptik. You can read this article to build your own bot.
  • APIs for fetching necessary information from your CRM system.

How to set up?

We have packaged Stripe Integration in the form of industry-specific Smart Skill for faster deployments. 

The available Smart Skill for Stripe is Stripe Payment. You can make use of this Smart Skill as per your requirement.

How to use the Skill

You can plug this Skill at a point of the bot flow where you would want to collect payments from the user.

For Example: During the cart checkout process.

For testing purposes, you can type the intent “Stripe payment flow” for generating a payment link for a sample amount that has been preconfigured.

How to make changes to the Skill

Since this Smart Skill is for payment purposes specifically, which is why we focus on generating a payment link.

Step 1: We have tried to make the Smart Skill platform agnostic and have incorporated necessary variations for WebSDK and WhatsApp platforms. The flow starts with the user getting a prompt to enter their mobile number on WebSDK, whereas on WhatsApp this prompt gets skipped as we are using the completion_phone_number system entity (captures phone number automatically on WhatsApp).

Step 2: Once the phone number is captured, the flow reaches the Stripe Integration Code Step wherein we call a dummy API to fetch the product details from the cart and further generate the payment link.

The following are the functions being used in this Code Step:

Sr no.
Function
Description
1
fetch_cart_details()

This function would be used to fetch the cart details of a user, for the demo we have used a dummy postman API. The client can replace this with their own cart APIs.

The cart API response must contain the following parameters as seen in the example below, which are required subsequently while generating the payment link.

{
    "unique_user_id": "1234abcd",
    "product_list": [
        {
            "product_id": "mag123",
          "product_name": "maggi noodles",
            "price": 10,
            "quantity": 5,
            "currency": "inr"
        },
        {
            "product_id": "coc123",
            "product_name": "coca cola",
            "price": 20,
            "quantity": 2,
            "currency": "inr"
        },
        {
            "product_id": "lay123",
            "product_name": "lays",
            "price": 5,
            "quantity": 6,
            "currency": "inr"
        },
        {
            "product_id": "cad123",
            "product_name": "cadbury silk",
            "price": 150,
            "quantity": 2,
            "currency": "inr"
        }
    ]
}
2
generate_price_ids(env_variables)
This function will generate a list of all the price_ids along with their quantities for each and every product in the cart.
3
generate_line_items(env_variables, user)
This function generates the line_items dictionary which forms the part of the create payment link payload.
4
create_stripe_price_id(env_variables, currency, unit_amount, product_name)

This function creates a product on the Stripe dashboard and returns a price_id for each product which is then used to create a payment link.

For more information, refer to this document.

5
create_stripe_payment_link(env_variables, user)
This function creates a payment link and returns the same using the price ids generated in the create_stripe_product(env_variables).\

For more information, refer to this document

6
update_payment_intent_metadata(env_variables, user, pay_intent_id)
This function updates the payment intent object with the metadata fields.
7
get_auth_token(env_variables)
This function generates a base64 encoded token using the Stripe secret_key for basic auth Stripe API calls.

Step 3: Next, you need to store the following fields in the Environment Variables of the Code Step:

  • business_id
  • client_id
  • secret_key

Delete

The client_id(Account id) and business_id for your bot can be found through the Share bot option on Conversation Studio, as shown.

For the secret_key, you need to navigate to your account on Stripe and select API Keys from the LHS navigation bar, as shown.

Finally, after you have made the necessary changes, you can test the flow end-to-end. 

Beyond this available predefined Skill, you can also build custom use cases by editing this Skill. Whatever changes and updations are required will be done to the Code Steps of this Smart Skill depending on your requirements.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Step 2 - How to check the feedback collected on my bot?
  • What is Words and Phrases Entity?
  • Which all languages are supported on Haptik bots?
  • What are Video HSLs?
  • What are WhatsApp Voice Notes?

Platform

  • Conversation Studio
  • Smart Skills
  • Advanced NLU
  • Intelligent Analytics
  • Omnichannel
  • Smart Agent Chat
  • Enterprise Security
  • Integrations

Solutions

  • Conversational Commerce
  • Lead Generation
  • Customer Care
  • WhatsApp
  • Conversational IVR
  • Google Business Messages

Industries

  • Retail/ E-Commerce
  • Financial Services
  • Travel & Hospitality
  • Telecom

Knowledge

  • ROI Calculator
  • Reports & Research
  • Case Studies
  • Webinars
  • ISAT
  • Tech Blog
  • Business Blog
  • Resources
  • Haptik v/s Yellow
  • Haptik v/s Liveperson
  • Haptik v/s IBM Watson
  • Haptik v/s Verloop
  • Conversations on AI

Company

  • Why Haptik
  • About Us
  • Careers
  • News & Media
  • Awards & Recognition
  • Contact Us
  • Partnerships
  • Investor Relations

Subscribe

Sign up to recieve the latest updates

Find us on

  • Twitter-footer
  • Linkedin-footer
  • YT-footer
  • Insta-footer
  • G2-footer
  • Facebook-footer

Knowledge Base Software powered by Helpjuice

Copyright © jio Haptik Technology Limited 2021 | Data Security & Privacy Policy | GDPR

North America | Asia Pacific | Africa | enterprise@haptik.ai

Definition by Author

0
0