PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Use Custom Fileds To Set Payment Amount & Type

s2Member Plugin. A Membership plugin for WordPress®.

Use Custom Fileds To Set Payment Amount & Type

Postby boealps » May 15th, 2011, 12:24 am

Hello,

I am using s2member pro with Paypal express checkout.

Within Level 1, I would like to have to following pricing and payment type options using ONE Level 1 Paypal Pro From:
* Membership Type 1, $25 (recurring & non-recurring)
* Membership Type 2, $25 (recurring & non-recurring)
* Membership Type 3, $20 (recurring & non-recurring)
* Membership Type 4, $30 (recurring & non-recurring)

This would be easier than creating 8 different forms when you are only changing 2 shortcode values (ra & rr) within the Level 1 pro form.

I have made two s2member custom fields (Membership Type, Payment Type (recurring & non-recurring); however, I don't know how this information would be passed to Paypal for the appropriate billing and cycle.

I would also like to set the subscription cycle to be 1/1 to 12/31 for the 1 year option rather than one year from payment date. IE, EOT would always be 12/31/(current year).

Thanks for your help.
User avatar
boealps
Registered User
Registered User
 
Posts: 3
Joined: May 14, 2011

Re: Use Custom Fileds To Set Payment Amount & Type

Postby Cristián Lávaque » May 15th, 2011, 1:22 am

How will you know how to restrict access for a particular user if all the 8 possibilities look the same to s2Member (Level 1). You will also need to user custom capabilities to differentiate them. Is that what you were planning?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Use Custom Fileds To Set Payment Amount & Type

Postby boealps » May 15th, 2011, 1:34 am

Yeah, it sounds weird. I am only planning to have two different levels. 0 (Guest) and 1 (Member). Our club has different member types with different prices (Individual, Associate, retiree, family).

Even though there will be 4 different payment prices with 2 different payment types, they will all be able to see the same website content. I am attempting to have s2member be a way we can manage our membership accounting rather than control levels of website content and keep some pages also seperate from guests.

Thanks.
User avatar
boealps
Registered User
Registered User
 
Posts: 3
Joined: May 14, 2011

Re: Use Custom Fileds To Set Payment Amount & Type

Postby Cristián Lávaque » May 15th, 2011, 12:46 pm

Since the membership won't change, just the payment, then you could easily modify the form to have dropdowns for the price and the frequency. You'll need to use the full code generated for the button instead of the shortcode. This may give you an idea of how to do the dropdown viewtopic.php?f=4&p=8503#p8503

You'll need a little customization to get the EOTs adjusted to the calendar year. You could get some ideas from this code viewtopic.php?f=4&p=13445#p13445

That'll work for one-time payments, recurring will need you to use an additional parameter in your buttons so you can control how many times a recurring payment will be processed by PayPal, otherwise it'll go on until the person cancels.

srt: (Optional) Subscription recurring times. Number of times that subscription payments recur. Specify an integer above 1. Valid only if you specify src="1". https://merchant.paypal.com/us/cgi-bin/ ... 8A6HI00JQU


I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Use Custom Fileds To Set Payment Amount & Type

Postby Cristián Lávaque » May 15th, 2011, 12:48 pm

If you decide to give each kind of payer a way to identify them, use custom capabilities. In that case you'll need to update the ccaps value dynamically based on their selection for the payment. You can do this on the browser using AJAX or on the server submitting the form to a custom script that'll work with the values before forwarding them to PayPal.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Use Custom Fileds To Set Payment Amount & Type

Postby boealps » May 16th, 2011, 6:44 pm

Since the membership won't change, just the payment, then you could easily modify the form to have dropdowns for the price and the frequency. You'll need to use the full code generated for the button instead of the shortcode. This may give you an idea of how to do the dropdown viewtopic.php?f=4&p=8503#p8503


I am only given the shortcode on the pro forms...
[s2Member-Pro-PayPal-Form level="1" ccaps="" desc="BOEALPS Membership Signup -- Individual Member ($25)" ps="paypal" cc="USD" ns="1" custom="boealps.org" ta="0" tp="0" tt="D" ra="25" rp="1" rt="Y" rr="BN" accept="paypal" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="clean" /]

I would like to dynamically make the price change say wirh a custom filed called "amount" then upon submission it renders...

[s2Member-Pro-PayPal-Form level="1" ccaps="" desc="BOEALPS Membership Signup -- Individual Member or Associate Member ($25)" ps="paypal" cc="USD" ns="1" custom="boealps.org" ta="0" tp="0" tt="D" ra="amount" rp="1" rt="Y" rr="BN" accept="paypal" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="clean" /]

You'll need a little customization to get the EOTs adjusted to the calendar year. You could get some ideas from this code viewtopic.php?f=4&p=13445#p13445


I didn't gather much from this thread but this kinda helps....
viewtopic.php?f=4&t=2878&p=8634&hilit=EOT%2C+end+of+the+year#p9025

Is there a way to automate the year (current year) rather than just setting a specific date?
This thread seems like you should be able to make the amout issue possible.
User avatar
boealps
Registered User
Registered User
 
Posts: 3
Joined: May 14, 2011

Re: Use Custom Fileds To Set Payment Amount & Type

Postby Cristián Lávaque » May 16th, 2011, 8:54 pm

Ah yes, that's a good thread for what you want. To have the year be current, you could do

Code: Select all
$eot_time = strtotime('31 December ' . date('Y')); 


I don't know if copying the generated form and editing that would work, but you could try it to add the amount dropdown. I'll ask Jason, though.

You may want to adjust the amount depending on the time left until year's end.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Use Custom Fileds To Set Payment Amount & Type

Postby Jason Caldwell » May 18th, 2011, 2:49 am

There are two ways to dynamically configure a PayPal Pro Form.

1. Using variables in your Shortcode ( explained here )
( note, you can apply the concept discussed in this thread, to any Shortcode Attribute )
viewtopic.php?f=36&t=1604

2. Or, you can apply a Filter of your own, to all Pro Forms during checkout processing.
Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter 
("ws_plugin__s2member_pro_paypal_checkout_post_attr", "my_paypal_pro_checkout_form_attr");
function my_paypal_pro_checkout_form_attr ($attr = array ())
    {
        if ($_POST["something-custom"] === "some custom value")
            {
                $attr["ra"] = "10.00"; /* Adjust price dynamically. */
                /* And/or, you could adjust other Attributes too. */
                /* $attr["rp"], $attr["rt"], etc, etc. */
            }
        /**/
        return (array)$attr;
    }
?>
^ this is for all PayPal Pro Checkout Forms, except Specific Post/Page Access.

This is for PayPal Pro Specific Post/Page Checkout Forms.
Code: Select all
<?php
add_filter 
("ws_plugin__s2member_pro_paypal_sp_checkout_post_attr", "my_paypal_pro_sp_checkout_form_attr");
function my_paypal_pro_sp_checkout_form_attr ($attr = array ())
    {
        if ($_POST["something-custom"] === "some custom value")
            {
                $attr["ra"] = "10.00"; /* Adjust price dynamically. */
                /* And/or, you could adjust other Attributes too. */
                /* $attr["ids"], $attr["exp"], etc, etc. */
            }
        /**/
        return (array)$attr;
    }
?>
^ this is for PayPal Pro Specific Post/Page Checkout Forms.

The examples above will also work for Authorize.Net Pro Forms.
Just change all occurrences of the word "paypal" in the code, to "authnet".
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Use Custom Fileds To Set Payment Amount & Type

Postby Jason Caldwell » May 18th, 2011, 2:55 am

Building from the example I gave here:
viewtopic.php?f=4&t=2878&p=8634&hilit=EOT%2C+end+of+the+year#p9025

You might do something like this.
Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter 
("ws_plugin__s2member_pro_paypal_checkout_post_attr", "my_paypal_pro_checkout_form_attr");
function my_paypal_pro_checkout_form_attr ($attr = array ())
    {
        if ($_POST["something-custom"] === "some custom value")
            {
                $now = strtotime ("now");
                $fixed_time = strtotime ("31 December " . date ("Y"));
                $days_until_fixed_time = round (($fixed_time - $now) / ($seconds_in_one_day = 86400));
                /**/
                $attr["ra"] = "10.00"; 
                $attr
["rp"] = $days_until_fixed_time; 
                $attr
["rt"] = "D"; 
                $attr
["rr"] = "BN";
            }
        /**/
        return (array)$attr;
    }
?>
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 2 guests

cron