You are submitting the form directly to PayPal, so obviously your server 
will not get the data. You have two options:

   1. Instead, submit the form to your web2py app, and then use urllib2 or 
   the requests library to post the data from your server to PayPal (in that 
   case, the user will not be redirected to the PayPal page -- not sure if 
   that matters).
   2. Use Javascript to capture the form submission and (a) first send an 
   Ajax request with the form data to your web2py app, and then (b) submit the 
   form as usual to the PayPal URL.

Anthony

On Friday, March 31, 2017 at 5:22:14 AM UTC-4, Fabio Ceccarani wrote:
>
> Hi all, 
> I have this FORM with some fields + paypal fields and paypal action:
>
> form = FORM(
>         H1("SUBMISSION AND PAYMENT"),
>         DIV(LABEL("Nome: ",_class="control-label 
> col-sm-3")+DIV(auth.user.first_name,_class="col-sm9"),_class="form-group"),
>         DIV(LABEL("Cognome: ",_class="control-label 
> col-sm-3")+DIV(auth.user.last_name,_class="col-sm9"),_class="form-group"),
>         # some others form elements...
>         # start PAYPAL hidden fields
>         INPUT(_type="hidden", _name="business", _value="[email protected]
> "),
>         INPUT(_type="hidden", _name="cmd", _value="_xclick"),
>         INPUT(_type="hidden", _name="paymentaction", 
> _value="authorization"),
>         INPUT(_type="hidden", _name="currency_code", _value="EUR"),
>         INPUT(_type="hidden", _name="item_name", _value="Name of product"),
>         INPUT(_type="hidden", _name="amount", _value="10.00")
>         BUTTON('CONFIRM AND PAY',_value='conferma', _type='submit', 
> _class='btn btn-success btn-lg center-block btn-prenota'),
> # THIS IS THE PROBLEM: this action is required to pay, but so  
> form.accepts is not executed       
>         _action="https://www.paypal.com/cgi-bin/webscr";, 
>         _method="post"
> )
>
> # ON FORM ACCEPT 
> if form.accepts(request, session):
>         date_subscription = datetime.datetime.today()
>
>         #insert subscription
>         db.subscriptions.insert(
>             user_subscriber = auth.user.id,               #authenticated 
> user
>             course_id = session.current_course,  #current course
>             course_title = course.title,
>             course_subtitle = course.subtitle,
>             subscription_date = date_subscription,
>             course_date = prenotation_date, 
>             number_of_persons = number_of_persons,
>             paid = False,
>             archived = False
>             )
> # OTHER ACTION ON FORM ACCEPT (send emails, ecc...)
>
>
> There's a way to execute before form.accepts and after redirect to _action 
> url (with _method="post")?
> I want before register the subscription, then goto to paypal page.
>
> Thanks!
> Fabio
>

-- 
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