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™

API Call to check status of subscription

Common Questions/Problems/Tips. Posted by Administrators & Support Reps.

API Call to check status of subscription

Postby MailBeez » February 3rd, 2011, 6:30 am

hi,

am just evaluating s2member for my project and have been through the nice tutorial videos.

is there any way like this
Code: Select all
check_subscription($user_id)

to check the current status of a subscription?

Or would I need to use the notification API to store the current status per user by myself?

cheers
cord
User avatar
MailBeez
Registered User
Registered User
 
Posts: 1
Joined: February 3, 2011

Re: API Call to check status of subscription

Postby Jason Caldwell » March 4th, 2011, 10:02 pm

If you're using PayPal® Pro integration, you can do this in PHP.

Code: Select all
<?php
$user_id 
= "1";
$subscr_id = get_user_option("s2member_subscr_id", $user_id);
$paypal = array ("METHOD" => "GetRecurringPaymentsProfileDetails", "PROFILEID" => $subscr_id);
if (($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response ($paypal)) && !$paypal["__error"])
    $status = $paypal["STATUS"];
?>
* this code snippet requires s2Member Pro v1.5+

Possible values for $status are:
Code: Select all
ActiveProfile
PendingProfile
CancelledProfile
SuspendedProfile
ExpiredProfile

Other details about the Recurring Profile are also available in the $paypal array. The fields in this array are documented in the PayPal® Pro API guide, which is included with the latest version of s2Member Pro. Please check your account at s2Member.com for the /s2m-pro-extras.zip file. Inside the zip you will find the API doc. Its file name is: paypal-pro-api.pdf. In the PDF, you'll want to read the section on the Response Vars for "GetRecurringPaymentsProfileDetails".
Code: Select all
print_r($paypal); // spits out a full list of variables during testing.
~ 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 Common Questions/Problems/Tips

Who is online

Users browsing this forum: No registered users and 3 guests

cron