Thank-you for your inquiry.
s2Member currently does not store payment details on your site for security reasons. This information is stored securely by your payment gateway (i.e. PayPal, Authorize.net, etc.). However, if you’d like to store this information, s2Member does grant access to this information through API Notifications.
s2Member’s API Notifications are routines that will send data to specific URLs whenever certain events happen in your site. For this functionality you will only need to use Payment Notifications.
See: Dashboard -› s2Member® -› API / Notifications -› Payment Notifications
To use the information provided through s2Member’s API Notifications, you will need to set up an API Notification handler. This requires a bit of code to set up.
See: Knowledge Base » Building An API Notification Handler
To collect the payment amount for a user, you will need the user’s ID, as well as the amount that user paid. Both of these portions of data are available within s2Member’s Replacement Codes for Payment Notifications.
Your API Notification URL might look like this:
http://example.com?s2_payment_notification=yes&s2_amt=%%amount%%&s2_id=%%user_id%%
The above URL passes the amount that the user paid, and their ID as s2_amt, and s2_id, respectively. Now you can set up your API Notification handler. Using the code sample from Building An API Notification Handler as a guide, your handler might do something like the following:
<?php
add_action('init', 's2_payment_notification');
function s2_payment_notification()
{
if(!empty($_GET['s2_payment_notification'])) // In my URL, I have `?s2_payment_notification=yes`, that's what I'm looking for here.
{
if(!empty($_GET['s2_id']) && !empty($_GET['s2_amt'])) // In my URL, I have `&s2_id=%%user_id%%&s2_amt=%%amount%%`, that's what I'm looking for here.
{
$user_id = (integer)$_GET['s2_id']; // I'm expecting an integer in this value.
$amount = (integer)$_GET['s2_amt']; // I'm expecting an integer in this value
// Here I might perform any number of tasks related to this user. Such as creating a user option value in WordPress.
update_user_option($user_id, 's2member_last_amount_paid', $amount);
}
exit; // We can exit here. There's no reason to continue loading WordPress® or my theme during an API Notification.
}
}
[/hilite]
The above uses the WordPress function <a href="http://codex.wordpress.org/Function_Reference/update_user_option">update_user_option()</a> to save the amount that this user paid as a User Meta value in your database. This information is saved into the meta field s2member_last_amount_paid
.
To access this information, you can use any of the methods outlined in s2Member’s Shortcode Conditionals with s2Get examples, or with get_user_option().
Example with shortcodes:
[s2Get user_option="s2member_last_amount_paid"]
Example in PHP with get_user_option():
<?php echo get_user_option('s2member_last_amount_paid'); ?>
See: Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals
Please let us know if you have any further questions/concerns. :-)