title: Receiving a webhook event for Stripe in Flask
body: <p>I am new to Flask and will appreciate little help with stripe payments.
  I currently can "Send" data to stripe with simple view and it communicates with stripe site as it shows payment charged against the subscription plan.
  But I need to "receive" signal from stripe so I can capture the event and take action as needed. For that I would appreciated if according to the following view someone help me to figure it out. Following view is to charge customer and now I need to retrieve expiration from stripe end.</p>
  
  <pre><code>@app.route('/charged', methods=['POST'])
  def charge():
      # Amount in cents
      amount = 9900
      # customer
      customer = stripe.Customer.create(
          email='testing@gmail.com',
          source=request.form['stripeToken']
      )
      try:
          charge = stripe.Charge.create(
              customer=customer.id,
              capture='true',
              amount=amount,
              currency='usd',
              description='standard',
          )
          data="$" + str(float(amount) / 100) + " " + charge.currency.upper()
      except stripe.error.CardError as e:
          # The card has been declined
          body = e.json_body
          err = body['error']
          print
          "Status is: %s" % e.http_status
          print
          "Type is: %s" % err['type']
          print
          "Code is: %s" % err['code']
          print
          "Message is: %s" % err['message']
  
      return render_template('/charge.html', data=data)
  </code></pre>
  
  <p>HTML Template:</p>
  
  <pre><code>&lt;form action="/charged" method="post"&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="email"&gt;Amount is $99.00 USD &lt;/label&gt;
                  &lt;script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                      data-key="{{ key }}"
                      data-description="Standard Package"
                      data-name="Demo Site"
                      data-amount="9900"
                      data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                      data-locale="auto"&gt;
                  &lt;/script&gt;
              &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>I will really appreciate if someone can give me just one example of receiving the expiration date of the package from stripe or any other event.</p>