latest stable versions: v140816 (changelog)

Old Forums (READ-ONLY): The community now lives at WordPress.org. If you have an s2Member® Pro question, please use our new Support System.

last payment time is wrong

Home Forums Community Forum last payment time is wrong

This topic contains 13 replies, has 5 voices.
Last updated by  LG 1 year, 10 months ago.

Topic Author Topic
Posted: Friday Oct 5th, 2012 at 5:21 am #27547
LG
Username: lg

Hi,

I want to show the next payment date to user in edit profile page.

I checked the code, database, even find the file and placed the code also and its shows also. But in the end i checked the last payment date of user in database field ‘wp_s2member_last_payment_time’ is wrong .

I wrote all my code which find the next payment date according to last payment by user.

Please send me the alternative of my requirement ( show the next payment date to user ) OR let me know how and where to change the code so that ‘wp_s2member_last_payment_time’ saves the updated value in database

Thanks

List Of Topic Replies

Viewing 13 replies - 1 through 13 (of 13 total)
Author Replies
Author Replies
Posted: Friday Oct 5th, 2012 at 12:07 pm #27584
Eduan
Username: Eduan
Moderator

Hello LG,

Could you please post the date that you were expecting, and the date that you got? Thanks. :)

- Eduan

Posted: Saturday Oct 6th, 2012 at 7:21 am #27637
Staff Member
$s2member_last_payment_time = get_user_field ("s2member_last_payment_time"); # Timestamp. Last time an actual payment was received by s2Member.

Should give what you want, why do you say it’s wrong? Maybe it’s because of the time difference between the server and you? I would also like to know what time it happened and what time is stored.

You can also use the payment notifications together with a script to save each payment. Dashboard -› s2Member® -› API / Notifications -› Payment Notifications

Posted: Tuesday Oct 9th, 2012 at 1:26 pm #27909
LG
Username: lg

HI,

Thanks for replying.

It shows the time when the paid membership user registered instead last recurring payment date.

Posted: Wednesday Oct 10th, 2012 at 6:52 am #27970
Staff Member

I see. I’m going to ask Jason about it, but tell me, are you sure that that user made another payment after signup?

Posted: Wednesday Oct 10th, 2012 at 9:17 pm #28056
Bruce
Username: Bruce
Staff Member

Hi LG,

Can you check to see if get_user_field('s2member_paid_registration_times') is being populated correctly? This should be an array, so var_dump() it.

If that’s not working for you either, please make sure that your PayPal IPN URL is set up correctly within PayPal. If you have logging enabled, you should check out your paypal-ipn.log file to ensure that it is getting populated. If you do not have a paypal-ipn.log file, then this is most likely your issue.

Technically, if your IPN URL is wrong, you could still be getting user signups, because user upgrades/downgrades are done within the PayPal Return processes, or within WP_Cron in /includes/classes/auto-eots.inc.php. However, this problem, and also a problem where all of your subscription-based members would not be downgraded would occur.

Let us know how that goes :-)

Posted: Thursday Oct 11th, 2012 at 1:47 am #28080
LG
Username: lg

Hi Cristián And Bruce,

Thanks for help .

I tried this get_user_field(‘s2member_paid_registration_times’) and its shows the same time as
get_user_field (“s2member_last_payment_time”);

And i checked my Paypal account and it receives the payment on regular basis from users but as i told you the last payment date field is not updated in the database. :(

Posted: Thursday Oct 11th, 2012 at 3:07 am #28086
Bruce
Username: Bruce
Staff Member

Hi LG,

Thanks for the info.

As you can see in the Codex (Source Code Docs), s2Member does update_user_option() for s2member_last_payment_time in these two files:

The first file is the class for the recurring payments, and the second is for the signup for the subscription.

I’m going to run tests to try to get this to happen in a test environment. For now I suggest using get_user_field (“s2member_auto_eot_time”) – 1 day to display the date that users will be billed again. If this field is not being populated correctly either, then I would suggest disabling all plugins possible (except s2Member) and running test transactions until the problem is resolved.

Thanks for your patience.

Posted: Thursday Oct 11th, 2012 at 8:34 am #28120
LG
Username: lg

Hi Bruce,

But i guess .. get_user_field (“s2member_auto_eot_time”) … This shows the End Of Time when user cancel their payment.

My requirement is different , i want user to show next payment date ( without cancelling their account ), thats why i need last payment date so that i can add the plan days in that and can show user the next payment date.

If you have any other solution to my requirement then that would be great as well.

Thanks

Posted: Thursday Oct 11th, 2012 at 12:19 pm #28142
Bruce
Username: Bruce
Staff Member

Hi LG,

Could you please post a list of other plugins you’re running with s2Member? just copy + pasting the list from /wp-admin/plugins.php should suffice. :-)

Posted: Friday Oct 12th, 2012 at 12:55 am #28189
LG
Username: lg

Hi Bruce,

These are Active plugin in my website

Admin Post Navigation
Akismet
Amazon SES DKIM Mailer
Custom Post Type UI
Dewplayer
Easy CSV Importer
Email Log
Exec-PHP
Fast Secure Contact Form
FLASH player Widget
Hierarchical Pages
Login Logo
More Fields
My Link Order
My Page Order
One-Click Child Theme
PHP Execution
s2Member® Framework
ShareThis
WordPress Importer
WP Survey And Quiz Tool
Posted: Friday Oct 12th, 2012 at 10:15 pm #28286
Bruce
Username: Bruce
Staff Member

Hi LG,

Thanks for the info.

I’ve started an investigation on this. I’m going to get back to you as soon as I can reproduce this issue.

Posted: Tuesday Oct 16th, 2012 at 12:03 am #28491
Staff Member

Thanks for the heads up on this thread.

Regarding the next billing date. This is NOT something that s2Member keeps a record of on-site. s2Member keeps track of the last time a payment was received, but not when the next payment is set to occur. This is maintained by your payment gateway. If you’re running PayPal, then the next billing date is established on the PayPal side of things.

s2Member is fully aware of transactions, cancellations, expirations, failed billing attempts, and other events that occur with a billing profile established on the payment gateway side of things, because s2Member communicates with your payment gateway through a combination of APIs, including things like the PayPal IPN service. However, personal billing details, other financials, and billing cycle specifics are left on the payment gateways side of things for maximum flexibility and security.

If you’re running PayPal Pro, it’s possible to obtain the billing profile details from the PayPal side of things programmatically – via the PayPal Pro API. While it’s not something that s2Member keeps a record of on-site, s2Member does have the ability to pull this information for you from the PayPal API.

Here is a code snippet that shows how to accomplish this:

<?php
$user_id = 1; // The user we'd like to check.
$subscr_id = get_user_option("s2member_subscr_id", $user_id); // User's current PP subscription ID.
$paypal = array ("METHOD" => "GetRecurringPaymentsProfileDetails", "PROFILEID" => $subscr_id); // API call configuration.

if (($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response ($paypal)) && !$paypal["__error"])
    {
    	print_r($paypal); // Prints a full list of all profile details.
    	// You can parse these variables if you like, and make a determination about the next billing date.	
	}
?>

The $paypal variable will contain the following details, as documented by PayPal. This was pulled from the PayPal API docs, which are provided to you in your s2Member.com account. Upon logging in at s2Member.com, go to the My Account page, and download the s2m-pro-extras.zip file. Inside the zip file, you’ll find this information in the file: payflow-pro-rec-api.pdf

Related thread: http://www.primothemes.com/forums/viewtopic.php?f=4&t=2062&view=unread#p7407

Posted: Tuesday Oct 16th, 2012 at 6:27 am #28501
LG
Username: lg

HI Jason,

Thanks for replying and clearing everything , that is really helpful.

I know s2Member didn’t keeps a record of next payment on site but i need the last payment date ( which is stored in database whenever user paid ).

With the help of last payment date and days in current member membership i will calculate the next payment date.

But for that i need the last payment date first which is stored wrong in database by s2membership plugin , that us my problem, i just need the last payment date :)

Looking forward to hear from you soon.

Thanks

Viewing 13 replies - 1 through 13 (of 13 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WordPress.org. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.