Paypal button code is not working

When i use shortcodes for s2member paypal buttons the subscription to paypal works fine. But when i add the button code (s2member --> paypal buttons --> Resulting PayPal Button Code) the redirected paypal site is wrong when i click the button.

s2member provides the following code:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="paypal@mywebsite.de" />
 <input type="hidden" name="cmd" value="_xclick-subscriptions" />
 <input type="hidden" name="notify_url" value="https://www.mywebsite.de/?s2member_paypal_notify=1" />
 <input type="hidden" name="cancel_return" value="https://www.mywebsite.de/" />
 <input type="hidden" name="return" value="https://www.mywebsite.de/?s2member_paypal_return=1" />
 <input type="hidden" name="rm" value="2" />
  <input type="hidden" name="lc" value="" />
  <input type="hidden" name="no_shipping" value="1" />
  <input type="hidden" name="no_note" value="1" />
  <input type="hidden" name="custom" value="www.mywebsite.de" />
  <input type="hidden" name="currency_code" value="EUR" />
  <input type="hidden" name="page_style" value="paypal" />
  <input type="hidden" name="charset" value="utf-8" />
  <input type="hidden" name="item_name" value="Silber Level / description and pricing details here." />
  <input type="hidden" name="item_number" value="1" />
  <input type="hidden" name="modify" value="0" />
  <input type="hidden" name="src" value="1" />
  <input type="hidden" name="srt" value="" />
  <input type="hidden" name="sra" value="1" />
  <input type="hidden" name="a3" value="0.01" />
  <input type="hidden" name="p3" value="1" />
  <input type="hidden" name="t3" value="M" />
  <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal" />
 </form>

I add this code to a page. When i click on it i get redirect to paypal but the payment scenario is not right. For example i should pay 0.01 USD instead of EUR as specified in the input field “currency_code”.

On the other hand using the shortcode works fine although the shortcode creates even less inputs in the form. Here is the code generated by the shortcode:

 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
 <input type="hidden" name="cmd" value="_s-xclick" /><br />
 <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIK8QYJKoZ.....-----END PKCS7-----" /><br />
 <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal." /></p>
 </form>

When i click on the shortcode button everything on paypal is fine. Currency is EUR although there is not even a input field “currency_code”. How does this work?? Why is this code working but not my manually added code (which of course is provided by s2member too)?

Paypal buttons don’t work for me either. I think this app is dead

Hi Torsten.

The button data is encrypted so that the visitor can’t see and -especially- can’t edit it.

when i add the button code (s2member --> paypal buttons --> Resulting PayPal Button Code) the redirected paypal site is wrong when i click the button.

I add this code to a page. When i click on it i get redirect to paypal but the payment scenario is not right. For example i should pay 0.01 USD instead of EUR as specified in the input field “currency_code”.

That button is not encrypted. Is your PayPal account set to allow unencrypted buttons, or to require that they are encrypted? https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/encryptedwebpayments/#id08A3I0R00ZJ

s2member provides the following code:

It seems to be missing some lines:

 <!-- Identifies/Updates An Existing User/Member (when/if applicable)  -->
 <input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
 <input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" />
 <!-- Identifies The Customer's IP Address For Tracking -->
 <input type="hidden" name="on1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; ?>" />
 <input type="hidden" name="os1" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; ?>" />

You could use the shortcode equivalents to avoid the PHP. WP Admin > s2Member > API / Scripting > s2Member PHP/API Constants

 <!-- Identifies/Updates An Existing User/Member (when/if applicable)  -->
 <input type="hidden" name="on0" value="[s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0" /]" />
 <input type="hidden" name="os0" value="[s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0" /]" />
 <!-- Identifies The Customer's IP Address For Tracking -->
 <input type="hidden" name="on1" value="[s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1" /]" />
 <input type="hidden" name="os1" value="[s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1" /]" />

Please check those, test again, and let me know how it went.

I look forward to your update. :slight_smile:

Hi Christian,

thanks for your answer. My original post was about 2 years ago. And due to paypal problems i switched to stripe in the past. So at the moment i have no active paypal integration running. But if i will have one in the future i will give it a try.

1 Like

Gotcha! Sorry I missed that your post was so old. This thread showed up at the top of the forum activity with Shannon’s reply, and I thought it was a recent question you made.

Yeah, I know you are using Stripe and was wondering about your interest in PayPal buttons. I thought maybe for PSD2 readiness, just in case. :grin:

No worries! :slight_smile: At the moment i try to keep calm and wait for your stripe update to s2member. :wink:

1 Like