Book Image

Twilio Cookbook: Second Edition

By : Roger Stringer
Book Image

Twilio Cookbook: Second Edition

By: Roger Stringer

Overview of this book

Table of Contents (20 chapters)
Twilio Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Collecting Stripe payments


At some point in most projects, you will want a way to collect payments. This recipe will show you how to set up payments via Stripe and give your users a set of prompts where they can enter their credit card information in order to conduct the payment.

Getting ready

The complete source code for this recipe can be found at Chapter10/Recipe3 in the source code for this book.

How to do it…

We're going to build a plugin that will let users make stripe payments over the phone. Perform the following steps to do so:

  1. Download the latest version of the Stripe API for PHP from https://code.stripe.com/stripe-php-latest.zip.

  2. Create a folder in your plugins/ folder of your OpenVBX installation, name it stripe, and upload the stripe-php folder.

  3. Upload a file on your server called plugin.json with the following content:

    {
      "name" : "Stripe",
      "description" : "Take payments over the phone using stripe.com",
      "links" : [{
        "menu" : "Stripe",
        "url" : "stripe",
        "script" :...