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™

Notify to my email a payment transaction

s2Member Plugin. A Membership plugin for WordPress®.

Notify to my email a payment transaction

Postby Dranz1r » April 12th, 2011, 11:28 am

I would like that if I recieve payment, so it will send my a notfication to my email saying:

Hi Admin,
%%user_full_name%% (Name), %%user_id%% (ID) of %%user_email%% (email) has paid %%amount%% (amount) for %%item_name%% (item).
Congrats!!
From Payment Notification Dept

I know PHP, but I don't know how to use it with s2member.
Help?
User avatar
Dranz1r
Registered User
Registered User
 
Posts: 2
Joined: April 12, 2011

Re: Notify to my email a payment transaction

Postby Cristián Lávaque » April 12th, 2011, 11:44 am

I think you may find what you need in the Notifications API. :)

WP Admin -> s2Member -> API / Notifications
http://www.s2member.com/api-tracking-no ... ons-video/
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: Notify to my email a payment transaction

Postby OWeekly » April 12th, 2011, 1:32 pm

Cristian,

I am facing similar problem... I have watched the video 3 times, I tried to engage a coder and its not working... Can u please help me check the code?

I do not know how to code proficiently and i got a coder to help me, but he does not fully understand...

on the video, it said to put a script.php?........... then create the script.php file ....

My code for that reads...

Code: Select all
<?php

$to 
= 'admin@abcd.com;
$subject = '
Payment Received';
$message = '
Hi John,. "\r\n" . $_GET['user_name'] . ", " . $_GET['user_id'] . " (ID) of $_GET['user_email'] has paid " . $_GET['amount'] . " for " . $_GET['item'] . "."rn"Congrats!!"rn"From Payment Notification Dept';
$headers = 'From: mail.optionsweekly.org';
mail($to, $subject, $message, $headers);

?>


Is it correct??? Help would be apprciated thanks.
s2member rocks!

Allan
User avatar
OWeekly
Registered User
Registered User
 
Posts: 36
Joined: March 31, 2011

Re: Notify to my email a payment transaction

Postby Dranz1r » April 12th, 2011, 2:47 pm

I work with OWeekly and this is the code I told him to input into the Payment Notifications:

http://www.optionsweekly.org/notify.php?user_name=%%full_name%%&user_id=%%user_id%%&user_email=%%payer_email%%&amount=%%amount%%&item=%%item_name%%

the file is notify.php which he showed above me.
User avatar
Dranz1r
Registered User
Registered User
 
Posts: 2
Joined: April 12, 2011

Re: Notify to my email a payment transaction

Postby Cristián Lávaque » April 12th, 2011, 3:09 pm

Hi Allan. :)

You have some PHP syntax errors in the $to and $message variables. Anyway, you need your script to get the data from the notification you set up in s2Member for signups.

Your notification URL could be:
http://yoursite.com/yourscript.php?secret_key=gha294jas2583dkdhat345&full_name=%%full_name%%&subscr_id=%%subscr_id%%&payer_email=%%payer_email%%&initial=%%initial%%

It's using the replacement codes available to the signup notification, but they vary depending on the kind of notification.

Following your example, something like this may work for you in the script you're notifying with the API:

Code: Select all
<?php
if 
($_GET['secret_key'] === 'gha294jas2583dkdhat345') {
    
    $to 
= 'admin@abcd.com';
    $subject = 'Payment Received';
    $message = 'Hi John,' . "\r\n" . $_GET['full_name'] . ', ' . $_GET['subscr_id'] . ' (ID) of ' . $_GET['payer_email'] . ' has paid ' . $_GET['initial'] . ' for ' . $_GET['item_number'] . '.' . "\r\n" . 'Congrats!!' . "\r\n" . 'From Payment Notification Dept';
    $headers = 'From: mail.optionsweekly.org';
    mail($to, $subject, $message, $headers);
}
?>


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: Notify to my email a payment transaction

Postby OWeekly » April 12th, 2011, 4:00 pm

Thanks Cristian, IT workeed!!! lol

my next Qns for u are:

Can I use the same script file (use different secret keys ) and add on commands for the registration's email notification, refund, modify, etc below's code.... or must i add new new scripts for each tye of notification?

Code: Select all
<?phpif ($_GET['secret_key'] === 'gha294jas2583dkdhat345') {        $to = 'admin@abcd.com';    $subject = 'Payment Received';    $message = 'Hi John,' . "\r\n" . $_GET['full_name'] . ', ' . $_GET['subscr_id'] . ' (ID) of ' . $_GET['payer_email'] . ' has paid ' . $_GET['initial'] . ' for ' . $_GET['item_number'] . '.' . "\r\n" . 'Congrats!!' . "\r\n" . 'From Payment Notification Dept';    $headers = 'From: mail.optionsweekly.org';    mail($to, $subject, $message, $headers);}?>

<?phpif ($_GET['secret_key'] === 'gXXxxxxxxxx5') {        $to = 'admin@abcd.com';    $subject = 'New Registration';    $message = 'Hi John,' . "\r\n" . $_GET['full_name'] . ', ' . $_GET['subscr_id'] . ' (ID) of ' . $_GET['payer_email'] . ' has paid ' . $_GET['initial'] . ' for ' . $_GET['item_number'] . '.' . "\r\n" . 'Congrats!!' . "\r\n" . 'From New Registration' Dept';    $headers = 'From: mail.optionsweekly.org';    mail($to, $subject, $message, $headers);}?>

<?phpif ($_GET['secret_key'] === 'YGHDxxxxx8') {        $to = 'admin@abcd.com';    $subject = 'Refund';    $message = 'Hi John,' . "\r\n" . $_GET['full_name'] . ', ' . $_GET['subscr_id'] . ' (ID) of ' . $_GET['payer_email'] . ' has paid ' . $_GET['initial'] . ' for ' . $_GET['item_number'] . '.' . "\r\n" . 'Congrats!!' . "\r\n" . 'From New Refund Dept';    $headers = 'From: mail.optionsweekly.org';    mail($to, $subject, $message, $headers);}?>




Thanks!!
s2member rocks!

Allan
User avatar
OWeekly
Registered User
Registered User
 
Posts: 36
Joined: March 31, 2011

Re: Notify to my email a payment transaction

Postby Cristián Lávaque » April 12th, 2011, 5:16 pm

Great! I'm glad it worked. :)

Nah, you can use the same key as long as it's kept secret.

You could actually have all those notifications processed in the same script, just add a new parameter that will tell your script what type of notification to handle.

Code: Select all
<?php
if 
($_GET['secret_key'] === 'gha294jas2583dkdhat345' && strpos('signup, payment, registration,', $_GET['notification']) !== false)
    $_GET['notification']();

function signup() {
    $to = 'admin@abcd.com';
    $subject = 'Payment Received';
    $message = 'Hi John,' . "\r\n" . $_GET['full_name'] . ', ' . $_GET['subscr_id'] . ' (ID) of ' . $_GET['payer_email'] . ' has paid ' . $_GET['initial'] . ' for ' . $_GET['item_number'] . '.' . "\r\n" . 'Congrats!!' . "\r\n" . 'From Payment Notification Dept';
    $headers = 'From: mail.optionsweekly.org';
    mail($to, $subject, $message, $headers);
}
?>


Then just add it to the URL like this &notification=signup.
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: Notify to my email a payment transaction

Postby OWeekly » April 12th, 2011, 11:04 pm

U're the best!!!! thanks.. but is my code below correct?

Code: Select all
<?phpif 
($_GET['secret_key'] === 'gha294jas2583dkdhat345' && strpos('signup, payment, registration, refund, upgrade,'$_GET['notification']) !== false)    
$_GET['notification']();function signup() 
{    
$to 'admin@abcd.com';    
$subject 'Payment Received';    
$message 'Hi John,' "\r\n" 
$_GET['full_name'] . ', ' $_GET['subscr_id'] . ' (ID) of ' $_GET['payer_email'] . ' has paid ' $_GET['initial'] . ' for ' $_GET['item_number'] . '.' "\r\n" 'Congrats!!' "\r\n" 'From Payment Notification Dept';    
$headers 'From: mail.optionsweekly.org';    
mail($to$subject$message$headers);
}

$_GET['notification']();function payment() 
{    
$to 'admin@abcd.com';    
$subject 'Payment Received';    
$message 'Hi John,' "\r\n" 
$_GET['full_name'] . ', ' $_GET['subscr_id'] . ' (ID) of ' $_GET['payer_email'] . ' has paid ' $_GET['initial'] . ' for ' $_GET['item_number'] . '.' "\r\n" 'Congrats!!' "\r\n" 'From Payment Notification Dept';    
$headers 'From: mail.optionsweekly.org';    
mail($to$subject$message$headers);
}

$_GET['notification']();function registration() 
{    
$to 'admin@abcd.com';    
$subject 'Payment Received';    
$message 'Hi John,' "\r\n" 
$_GET['full_name'] . ', ' $_GET['subscr_id'] . ' (ID) of ' $_GET['payer_email'] . ' has paid ' $_GET['initial'] . ' for ' $_GET['item_number'] . '.' "\r\n" 'Congrats!!' "\r\n" 'From Payment Notification Dept';    
$headers 'From: mail.optionsweekly.org';    
mail($to$subject$message$headers);
}

$_GET['notification']();function refund() 
{    
$to 'admin@abcd.com';    
$subject 'Payment Received';    
$message 'Hi John,' "\r\n" 
$_GET['full_name'] . ', ' $_GET['subscr_id'] . ' (ID) of ' $_GET['payer_email'] . ' has paid ' $_GET['initial'] . ' for ' $_GET['item_number'] . '.' "\r\n" 'Congrats!!' "\r\n" 'From Payment Notification Dept';    
$headers 'From: mail.optionsweekly.org';    
mail($to$subject$message$headers);
}

$_GET['notification']();function upgrade() 
{    
$to 'admin@abcd.com';    
$subject 'Payment Received';    
$message 'Hi John,' "\r\n" 
$_GET['full_name'] . ', ' $_GET['subscr_id'] . ' (ID) of ' $_GET['payer_email'] . ' has paid ' $_GET['initial'] . ' for ' $_GET['item_number'] . '.' "\r\n" 'Congrats!!' "\r\n" 'From Payment Notification Dept';    
$headers 'From: mail.optionsweekly.org';    
mail($to$subject$message$headers);
}

?>
s2member rocks!

Allan
User avatar
OWeekly
Registered User
Registered User
 
Posts: 36
Joined: March 31, 2011

Re: Notify to my email a payment transaction

Postby Cristián Lávaque » April 12th, 2011, 11:46 pm

No, you have some errors.

Also, you're using the same replacement codes for every notification, when each notification will have them vary, so you need to read the documentation at WP Admin -> s2Member -> API / Notifications for each.
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: Notify to my email a payment transaction

Postby OWeekly » April 13th, 2011, 6:58 am

Cristián Lávaque wrote:No, you have some errors.
What r the errors? How can I recitfy them?

Cristián Lávaque wrote:Also, you're using the same replacement codes for every notification, when each notification will have them vary, so you need to read the documentation at WP Admin -> s2Member -> API / Notifications for each.
Those replacements codes i will replace them... hehhehe I just wanted you to see with the additional lines of codes, will the script still works...

If u dun mind pls can u help me clarify the errors that u see on the previous code. Thanks.
s2member rocks!

Allan
User avatar
OWeekly
Registered User
Registered User
 
Posts: 36
Joined: March 31, 2011

Re: Notify to my email a payment transaction

Postby OWeekly » April 13th, 2011, 1:17 pm

I tried with this code but error.... pls help...


Code: Select all
<?phpif 
($_GET['secret_key'] === '123hehfge235343dhe' && strpos('signup, registration, payment, cancellation, eot, refund,'$_GET['notification']) !== false)    

if(
$_GET['notification']();function signup()) 
{    
$to 'allan@abcd.com';    
$subject 'New Suscription Signup Or 7 Day Trial At abcd.com';    
$message 'Hi John and Allan,' "\r\n" "\r\n" 
'Member: ' $_GET['full_name'] . "\r\n" 
'Subscription ID: ' $_GET['subscr_id'] . "\r\n" 
'No. of free trial days: ' $_GET['initial_term'] . "\r\n" 
'Recurring every ' $_GET['regular_term'] . "\r\n" 
'Paypal email: ' $_GET['payer_email'] . "\r\n" 
'will pay $' $_GET['recurring'] . ' later when they are billed, if they have free trial.' ."\r\n" 
'for ' $_GET['item_name'] . "\r\n" "\r\n" 
'Congrats!! Have we reach 1,000 yet??' "\r\n" "\r\n" 'From Members Dept';    
$headers 'From: mail.abcd.com';    
mail($to$subject$message$headers);
}

if(
$_GET['notification']();function registration()) 
{    
$to 'allan@abcd.com';    
$subject 'New Members At abcd.com';    
$message 'Hi John and Allan,' "\r\n" "\r\n" 
'Role: ' $_GET['role'] . "\r\n" .  
'Member: ' $_GET['user_full_name'] . "\r\n" 
'Username: ' $_GET['user_login'] . "\r\n" .
'Email: ' $_GET['user_email'] . "\r\n" 
'DOB: ' $_GET['date_of_birth'] . "\r\n" 
'Country: ' $_GET['country'] . "\r\n" "\r\n" 
'Congrats!! Allan, Please setup the Subcribe2 attributes for these members. Have we reach 10,000 yet??!' "\r\n" "\r\n" 'From Members Dept';    
$headers 'From: mail.abcd.com';    
mail($to$subject$message$headers);
}

if(
$_GET['notification']();function payment()) 
{    
$to 'allan@abcd.com';    
$subject 'Payment Received At abcd.com';    
$message 'Hi John and Allan,' "\r\n" "\r\n" 
'Member: ' $_GET['full_name'] . "\r\n" 
'Username: ' $_GET['user_login'] . "\r\n" .
'Subscription ID: ' $_GET['subscr_id'] . "\r\n" 
'Paypal email: ' $_GET['payer_email'] . "\r\n" 
'has paid $' $_GET['amount'] . "\r\n" 
'for ' $_GET['item_name'] . "\r\n" "\r\n" 'Congrats!!' "\r\n" "\r\n" 'From Payment Notification Dept';    
$headers 'From: mail.abcd.com';    
mail($to$subject$message$headers);
}


if(
$_GET['notification']();function cancellation()) 
{    
$to 'allan@abcd.com';    
$subject 'Member Cancelled At abcd.com';    
$message 'Hi John and Allan,' "\r\n" "\r\n" 
'Member: ' $_GET['user_full_name'] . "\r\n" 
'Username: ' $_GET['user_login'] . "\r\n" .
'Email: ' $_GET['user_email'] . "\r\n" 
'Subscription ID: ' $_GET['subscr_id'] . "\r\n" 
'has cancelled ' $_GET['item_name'] . "\r\n" "\r\n" 'Bad news. Find out why!! Anyways we can offer them a good deal to stay with us?' "\r\n" "\r\n" 'From Members Dept';    
$headers 'From: mail.abcd.com';    
mail($to$subject$message$headers);
}

if(
$_GET['notification']();function eot()) 
{    
$to 'allan@abcd.com';    
$subject 'Member EOT At abcd.com';    
$message 'Hi John and Allan,' "\r\n" "\r\n" 
'EOT Event: ' $_GET['eot_del_type'] . "\r\n" 
'Member: ' $_GET['user_full_name'] . "\r\n" 
'Username: ' $_GET['user_login'] . "\r\n" .
'Email: ' $_GET['user_email'] . "\r\n" 
'Subscription ID: ' $_GET['subscr_id'] . "\r\n" 
'DOB: ' $_GET['date_of_birth'] . "\r\n" "\r\n" 
'Anyways we can offer them a better deal to stay with us? Last chance!' "\r\n" "\r\n" 'From Members Dept';    
$headers 'From: mail.abcd.com';    
mail($to$subject$message$headers);
}

if(
$_GET['notification']();function refund()) 
{    
$to 'allan@abcd.com';    
$subject 'Member Refund At abcd.com';    
$message 'Hi John and Allan,' "\r\n" "\r\n" 
'Member: ' $_GET['full_name'] . "\r\n" 
'Parent Txn ID: ' $_GET['parent_txn_id'] . "\r\n" .
'Subscription ID: ' $_GET['subscr_id'] . "\r\n" 
'Paypal email: ' $_GET['payer_email'] . "\r\n" 
'has processed for refund of $' $_GET['-amount'] . "\r\n" 
'for ' $_GET['item_name'] . "\r\n" 
'We got back from Paypal, $' $_GET['-fee'] . "\r\n" "\r\n" 
'Bad news. Find out why!! We don't usually deal with refunds.' . "\r\n" . "\r\n" . 'From Refund Notification Dept';    
$headers = '
Frommail.abcd.com;    
mail($to$subject$message$headers);
}
?>
s2member rocks!

Allan
User avatar
OWeekly
Registered User
Registered User
 
Posts: 36
Joined: March 31, 2011

Re: Notify to my email a payment transaction

Postby Cristián Lávaque » April 13th, 2011, 7:57 pm

Well, you added the function names to the strpos correctly, but then all you need to add are the functions, the if and the function call at the beginning of my code should not be repeated.

Code: Select all
<?php
if 
($_GET['secret_key'] === 'gha294jas2583dkdhat345' && strpos('signup registration payment cancellation eot refund', $_GET['notification']) !== false)
    $_GET['notification']();

function signup() {
    //
}

function registration() {
    //
}

function payment() {
    //
}

function cancellation() {
    //
}

// And so on.
?>
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: Notify to my email a payment transaction

Postby OWeekly » April 14th, 2011, 9:56 am

You're the best! Thanks
s2member rocks!

Allan
User avatar
OWeekly
Registered User
Registered User
 
Posts: 36
Joined: March 31, 2011

Re: Notify to my email a payment transaction

Postby Cristián Lávaque » April 14th, 2011, 11:02 am

;)
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


Return to s2Member Plugin

Who is online

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

cron