Conversations Inbox | Integration with Stripe

Hi there!

Are you looking for a way to send your products from Facebook catalogues via WhatsApp and automatically generate orders to Stripe? And this whole process manage through tyntec Conversations Inbox? Thanks to the tyntec Conversations Inbox, you can do exactly that and more by this integration.

You will need

  • A tyntec Conversations Inbox API key.
  • A WhatsApp Business Account Number provided from tyntec.
  • A mobile phone with the WhatsApp application not associated with your WABA.
  • A Facebook catalogue connected to your WhatsApp Business Profile.
  • A Stripe account with an account or business name set here.
  • Node.js installed.
  • Ngrok account and the binary installed.

Step One: Get your Facebook catalogue ready

    1. Create a Facebook catalogue and insert items for sale.
    2. Click on
Assign Partners.
    3. Select
Business ID.
    
4. Enter
partner business ID : 1791147717848878 and allow full control.

    5. Copy your Catalogue ID. You will need it later.

You can find detailed instructions on how to create catalogues on Facebook here.

Step Two: Get you Stripe app ready

We’ve prepared a sample Node.js app for your quick start with Stripe integration. Let's look at what the code does:

    1. Clone the api-sample repository and go to the chat-integrations/stripe directory.
    2. 
Install dependencies:

npm install

    3. Run ngrok in a terminal to expose your local server on the internet:

ngrok http 3000

    4. Copy the HTTPS address.
    5. Register the public URL as your
WhatsApp webhook:
        
a. Open
Postman and use this API.

Did you get an answer 201 (Created)? Perfect. Your webhook is set.

    6. Get your Stripe Secret key.

    7. Open Stripe repository and rename the file .env-example to .env.
    8. 
Fill the template with your data:

  • PORT (optional) - Start an HTTP server listening for connections on the given port. Defaults to 3000.
  • PUBLIC_URL - The public URL.
  • STRIPE_SECRET_API_KEY - Your Stripe secret API key.
  • TYNTEC_API_KEY - Your tyntec API key.
  • WHATSAPP_TEMPLATE_ID - The ID of your WhatsApp template.
  • WHATSAPP_TEMPLATE_LANG - A chosen language of our WhatsApp template.
  • Optionally - `SMALLEST_UNIT` map in `src/currencies.js` file according to your preferred currencies supported by Stripe. For example like this:
// Please, adjust this map according to your preferred currencies supported by Stripe https://stripe.com/docs/currencies
const SMALLEST_UNIT = {
   AUD: 2,
   EUR: 2,
   GBP: 2,
   JPY: 0,
   USD: 2
};
module.exports = {
   SMALLEST_UNIT
};

Note: Your WhatsApp template should have these parameters:

  • Acknowledges receipt of the shopping cart and instructs the user to proceed to checkout (e.g. "Very good choice! Now, proceed to checkout to complete your order.").
  • Has no variable in the header.
  • Has no variable in the body.
  • Has one Call-to-Action button with https://checkout.stripe.com/pay/{{1}} dynamic URL (an example of the URL is https://checkout.stripe.com/pay/sk_test_RXH...).

Step Three: Test your app

The sample app will receive a new order that was created via WA and sent to Stripe.

Now, it's time to try it out:

    1. Start by running your server. Go to the terminal and navigate to your Stripe folder.
    2. Inside your Stripe folder, run the following command to start the server:

npm start

    3. Open your Conversations Inbox. Once the customer contacts you, you can send your product catalogue.

    4. Click the Commerce button and select the products you want to send to your customer.

Stripe_ConversationsInbox6

    5. Insert the product into your shopping cart and click send.

    6. If everything is set correctly, after proceed order a message with payment instructions from Stripe will be returned immediately.

That's it. You've successfully integrated tyntec Conversations Inbox with Facebook catalogues and Stripe payment system. Happy shopping!