Hi Mathieu

I used Stripes submit form and put that in a form, and that seems to work 
ok -
https://robstestinglab.pythonanywhere.com/c/e/b1


<form action="/pay" method="POST">

<script

src="https://checkout.stripe.com/checkout.js";

class="stripe-button"

data-key="pk_test_XXXXXXXXXXXXXXXXXXXXX"

data-amount="999"

data-name="XXXXXXXXXXX"

data-description="Widget"

data-image="https://stripe.com/img/documentation/checkout/marketplace.png";

data-locale="auto"

data-zip-code="true"

data-currency="nzd">

</script>
</form>

I've used your code for my pay view, but cannot seem to get it to work - it 
just returns invalid request 
at 
https://robstestinglab.pythonanywhere.com/pay?stripeToken=tok_1A23uIERiozJkA6DO2gMlyJJ&stripeTokenType=card&stripeEmail=sgjkahg%40gashgj.com

The code I use in my pay page is...

def pay():

  from gluon.contrib.stripe import StripeForm

  amount = 1000

#1000 is $10 in cents

  description ="Example charge"

  form = StripeForm(

      pk=STRIPE_PUBLISHABLE_KEY,

      sk=STRIPE_SECRET_KEY,

      amount=int(100*amount),

      description=description).process()

  if form.accepted:

      #can also add stuff to update my records and allow them access and 
that. Also send them an email. But me, I’ll probably do that on the TU page 
itself.

      redirect(URL('thank_you'))

  elif form.errors:

      redirect(URL('pay_error'))
  return dict(form=form)

The form generated at Stripe is
# Set your secret key: remember to change this to your live secret key in 
production
# See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.api_key = "sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxx"

# Token is created using Stripe.js or Checkout!
# Get the payment token submitted by the form:
token = request.POST['stripeToken'] # Using Flask

# Charge the user's card:
charge = stripe.Charge.create(
  amount=1000,
  currency="nzd",
  description="Example charge",
  source=token,
)


So - where do I put the token, the test code, etc?
I've tried to strip out everything so it's as bare bones as possible eg 
only able to submit $10, no shopping cart, but still confused.
I'd be very grateful for your help

Cheers
Rob

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to