latest stable versions: v150827 (changelog)

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

Get Clickbank Receipt (cbreceipt) & Store

Home Forums Community Forum Get Clickbank Receipt (cbreceipt) & Store

This topic contains 11 replies, has 4 voices. Last updated by  Cristián Lávaque 4 years, 1 month ago.

Topic Author Topic
Posted: Tuesday Oct 30th, 2012 at 3:01 pm #30191
Rob
Username: digitsoft

What I’m looking to do is store the Clickbank receipt number in each user’s profile.

Of course I can ask them to type it in, but since it’s being passed back I should be able to auto populate it.

I tracked down the file that displays the template for ?s2member_pro_clickbank_return=1, but no variables (session or post) exist here.

Is there a way to make the variables passed back from CB global or at least available so that I can auto-populate on the register page?

List Of Topic Replies

Viewing 11 replies - 1 through 11 (of 11 total)
Author Replies
Author Replies
Posted: Wednesday Oct 31st, 2012 at 5:43 pm #30262
Raam Dev
Username: Raam
Staff Member

Hi Rob,

I recommend creating a Must-Use Plugin that checks if $_GET[‘s2member_paypal_proxy’] is set and then pull the stuff you need from $_POST (you probably want $_POST[‘txn_id’]).

You can use print_r() to see what’s inside $_POST like this:

<?php
 if ($_GET&#91;'s2member_paypal_proxy'&#93; === 'clickbank')
    {
        print_r($_POST);
        exit;
    }
?>
Posted: Thursday Nov 1st, 2012 at 10:45 am #30315
Rob
Username: digitsoft

I’ll give it try, but honestly this should be part of S2.

I don’t know of any other Clickbank payment options that don’t gather and store this info…very odd that S2 doesn’t. This should be fairly simple to incorporate, so hopefully it makes it into an upcoming release.

Posted: Thursday Nov 1st, 2012 at 9:19 pm #30382
Raam Dev
Username: Raam
Staff Member

Thank you for the suggestion, Rob. I will pass this along to the lead developer.

Posted: Friday Nov 2nd, 2012 at 7:49 am #30429
Staff Member

Is there a way to make the variables passed back from CB global or at least available so that I can auto-populate on the register page?

In the case of a “Buy Now” transaction via ClickBank (e.g. no recurring fees), the value of ctransreceipt from ClickBank, is stored by s2Member Pro as the Paid Subscr. ID value, and is tied directly to a customer’s profile in your Dashboard. Please check the Users menu in your Dashboard, for a User you’d like to see information for.

This Paid Subscr. ID (i.e. the ClickBank Receipt Number), is the only financial information that s2Member Pro needs to make it’s integration with the ClickBank return-page communication and IPN communication function properly; and it allows s2Member to remain more secure, since additional financial details are not being stored on the server side, but left in storage with your payment gateway.


In cases where there ARE recurring fees, s2Member Pro generates it’s own Paid Subscr. ID, which it sends to ClickBank, and ClickBank uses the Paid Subscr. ID generated by s2Member Pro in all future communication with s2Member Pro. Therefore, in the case of recurring subscriptions via ClickBank, the ClickBank receipt identifies only a specific transaction among many that may occur over the life a subscription. The value that remains constant throughout all future payments is the Paid Subscr. ID, which was originally generated by s2Member Pro, and is stored in a customer’s account profile, visible from the administrative Dashboard for WP.


If you’d like to collect the ClickBank Receipt for either one-time or recurring payments, you may connect to s2Member’s API Notification for payments, which is processed ANY time a payment occurs on the ClickBank side of things (including initial and recurring payments). In s2Member’s API Notification for payments, the ClickBank receipt value is obtained with the s2Member Replacement Code: %%txn_id%%

With s2Member’s API Notifications, you can collect and process your own custom code, storing these values, or use them for any other purpose you see fit. Some experience with PHP is required to integrate with s2Member’s API Notifications. See: Dashboard -› s2Member® -› API / Notifications -› Payment Notifications

Posted: Friday Nov 2nd, 2012 at 7:11 pm #30518
Rob
Username: digitsoft

Thanks for all of the info…

I was able to easily set $cbreceipt in clickbank-return.php:

if(!empty($_GET['txn_id']))
{
			$cbreceipt = $_GET['txn_id'];
}

It’s easy to display it on the clickbank-return page (works fine), but is there a way to auto-populate a custom reg field on the signup page that follows?

My goal was to auto-populate the Custom Registration/Profile Field I created when they setup their username etc..,.

Since the user account is created on the reg form, the receipt would have to be inserted/updated AFTER they create their account – therefore couldn’t trigger it with the payment api. I only need to set the initial receipt….

Could I use %%txn_id%% as the default text value for the custom field?

Posted: Sunday Nov 11th, 2012 at 1:30 pm #31256
Staff Member

Thanks for the follow-up.

This would most likely fall under what we consider to be “custom coding”. However, you might take a quick look at s2Member’s built-in Registration Notification to see if that helps you further. See: Dashboard -› s2Member® -› API / Notifications -› Registration Notifications

If not, you could certainly use one of s2Member’s MANY built-in hooks/filters to accomplish this.

Here is a quick example that serves to point you in the right direction.
Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
( these are MUST USE plugins, see: http://codex.wordpress.org/Must_Use_Plugins )

http://www.s2member.com/codex/stable/overview-summary/#src_doc_overview_description
See also: http://codex.wordpress.org/Function_Reference/update_user_option

Posted: Sunday Nov 11th, 2012 at 1:41 pm #31257
Rob
Username: digitsoft

That’s what I needed…will test, but looks like it will at least store the CB receipt.

I still think it would be great to have storing the receipt (and possibly other info) as an option on S2Member/Clickbank Options

Appreciate the code, support, and awesome product!

Rob

Posted: Sunday Nov 11th, 2012 at 1:45 pm #31258
Rob
Username: digitsoft

BTW – I know the receipt is stored in usermeta already, but storing it in a defined or custom field like CBReceipt and displaying it with members would be awesome for those using CB.

Posted: Monday Nov 12th, 2012 at 7:55 am #31293

You mean in the profile page? Since it’s a new meta field you’re creating, you’d probably have to edit the profile page to show it too.

Posted: Monday Nov 12th, 2012 at 8:34 am #31305
Rob
Username: digitsoft

I mean there should be a default built-in to S2 so that I don’t have to create a custom field or jump through any custom coding to store and display the Clickbank receipt per user.

So if I select Clickbank as my payment gateway, then the Users page would show the CBReceipt by default and the actual Clickbank receipt number would be displayed per user.

Posted: Monday Nov 12th, 2012 at 6:23 pm #31373

Ah ok, I thought you were asking about how to do it now.

Yes, I agree with you, and am adding it to the feature requests list. :)

Viewing 11 replies - 1 through 11 (of 11 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 WP Sharks™. 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.