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.

Member roles are not correct for new gateway

Home Forums Community Forum Member roles are not correct for new gateway

This topic contains 6 replies, has 2 voices. Last updated by  Cristián Lávaque 4 years, 3 months ago.

Topic Author Topic
Posted: Tuesday Sep 25th, 2012 at 2:16 am #26399
James
Username: jhutto

Hi,

I integrated a new gateway – Y2Pay based on the code of Authnet.

It works well exept for the member roles. When someone registers an Access Level 1 account, in Dashboard – Users – Role it displays Non-member, which is Access Level 0.

The IPN array looks like this:

[txn_type] => web_accept
[txn_id] => 12345
[custom] => localhost
[mc_gross] => 250.00
[mc_currency] => USD
[tax] => 0.00
[payer_email] => xx@xx.xx
[first_name] => aa
[last_name] => bb
[option_name1] => Originating Domain
[option_selection1] => localhost
[option_name2] => Customer IP Address
[option_selection2] => ::1
[item_name] => $250 USD / One Time ( for 1 year access, non-recurring, no trial )
[item_number] => 1::1 Y

I think the “1::” in the [item_number] tells the Access Level, thus the IPN seems to be correct.
But why the registration process does not take the right Access Level? Could you please give me a prompt?

Thanks!

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Tuesday Sep 25th, 2012 at 3:45 am #26403
James
Username: jhutto

I found the following code in s2member-pro\includes\classes\gateways\authnet\authnet-checkout-in.inc.php:

if(((is_multisite() && ($new__user_id = c_ws_plugin__s2member_registrations::ms_create_existing_user($create_user["user_login"], $create_user["user_email"], $create_user["user_pass"]))) || ($new__user_id = wp_create_user($create_user["user_login"], $create_user["user_pass"], $create_user["user_email"]))) && !is_wp_error($new__user_id)){
...
}													

When the site is multisite, it uses ms_create_existing_user() to stimulate the registration; when it’s not, it uses wp_create_user() directly.

In the single-site case, I do not quite understand how the Member Role property’s stored, as wp_create_user() only requires 3 parameters.

Your help will be apreciated!

Posted: Tuesday Sep 25th, 2012 at 7:13 am #26418

Hi James.

I integrated a new gateway – Y2Pay based on the code of Authnet.

Nice! :)

But why the registration process does not take the right Access Level? Could you please give me a prompt?

Hmm… Did you add logging to your integration? It’d help to read the logs. [hilite path]Dashboard -› s2Member® -› Authorize.Net® Options -› Account Details -› Logging[/hilite]

Are you using pro-forms or buttons? If buttons, then it’d be worth checking if s2Member is setting the cookie when the user is returned to the site after checkout. The cookie is needed so that on registration he’s given the level he paid for. Are you getting the confirmation email sent with the registration link?

Posted: Tuesday Sep 25th, 2012 at 11:35 am #26438
James
Username: jhutto

Hi Cristián, thanks very much for your reply.

I’m using pro-forms, and confirmation email can be received.
And yes there are logs:

1. y2pay-api.log

PHP v5.4.4 :: WordPress® v3.4.2 :: s2Member® v120703 :: s2Member® Pro v120703
Memory 14.16 MB :: Real Memory 14.25 MB :: Peak Memory 14.23 MB :: Real Peak Memory 14.25 MB
localhost/sms/individual-monthly-membership/?s2-ssl=yes
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1
-------- Input vars: (  ) --------
array (
  'x_type' => 'AUTH_CAPTURE',
  'x_method' => 'CC',
  'x_email' => 'asdf@fsd.com',
  'x_first_name' => 'asdf',
  'x_last_name' => 'asdf',
  'x_customer_ip' => '::1',
  'x_invoice_num' => 's2-5061bc3b0f91e',
  'x_description' => '$23.95 USD / One Time ( for 1 month access, non-recurring, no trial )',
  's2_invoice' => '1::1 M',
  's2_custom' => 'localhost',
  'x_tax' => '0.00',
  'x_amount' => '23.95',
  'x_card_num' => '********2352',
  'x_exp_date' => '2015-05',
  'x_card_code' => '4324',
  'x_address' => 'dfas',
  'x_city' => 'asdf',
  'x_state' => 'as',
  'x_country' => 'BS',
  'x_zip' => '43243',
)
-------- Output string/vars: (  ) --------

array (
  'EXTKey' => 'EK21212',
  'Result' => 'Declined',
  'ResultCode' => 'U20',
  'ResultMsg' => 'U20-INVALID CREDIT CARD NUMBER',
  'TranID' => 2155223,
  'BatchID' => 660018,
  'TranDate' => 20120925,
  'ResultAuth' => '',
  'PmtAcctNumMasked' => '542343xx2352',
  'ResultTrace' => '35EA3E53-A211-454A-9FD0-ED809ABD7365',
  'ResultAVS' => '',
  'PlanID' => '0',
  'PlanTranID' => '0',
  'AmountPayment' => 23.95,
  'AmountVoid' => 0,
  'AmountCredit' => 0,
)

The payment was not successful (invalid credit card, just for testing). But I removed the code

&& empty($authnet["__error"])

in “authnet-checkout-in.inc.php”, to make the registration processes even if the payment fails.

2. paypal-ipn.log

PHP v5.4.4 :: WordPress® v3.4.2 :: s2Member® v120703 :: s2Member® Pro v120703
Memory 15.53 MB :: Real Memory 16.25 MB :: Peak Memory 15.55 MB :: Real Peak Memory 16.25 MB
localhost/sms/?s2member_paypal_notify=1&s2member_paypal_proxy=y2pay&s2member_paypal_proxy_use=pro-emails&s2member_paypal_proxy_verification=d780d5f1c3ef4aad12dca83dfb14ba1c&s2member_paypal_proxy_return_url=
User-Agent: WordPress/3.4.2; http://localhost/sms
array (
  'txn_type' => 'web_accept',
  'txn_id' => '2155223',
  'custom' => 'localhost',
  'mc_gross' => '23.95',
  'mc_currency' => 'USD',
  'tax' => '0.00',
  'payer_email' => 'asdf@fsd.com',
  'first_name' => 'asdf',
  'last_name' => 'asdf',
  'option_name1' => 'Originating Domain',
  'option_selection1' => 'localhost',
  'option_name2' => 'Customer IP Address',
  'option_selection2' => '::1',
  'item_name' => '$23.95 USD / One Time ( for 1 month access, non-recurring, no trial )',
  'item_number' => '1::1 M',
  'proxy_verified' => 'y2pay',
  's2member_log' => 
  array (
    0 => 'IPN received on: Tue Sep 25, 2012 9:14:32 am CDT',
    1 => 's2Member POST vars verified with a Proxy Key',
    2 => 's2Member originating domain ( `$_SERVER["HTTP_HOST"]` ) validated.',
    3 => 's2Member `txn_type` identified as ( `web_accept|subscr_signup` ).',
    4 => 's2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/o update vars.',
    5 => 'Signup Confirmation Email sent to: "asdf asdf" <asdf@fsd.com>.',
    6 => 'Storing `payment` for Subscription via ( `web_accept` ).',
    7 => 'Creating an IPN response for `subscr_payment`. This will go into a Transient Queue; and be processed during registration.',
    8 => 'Storing IPN signup vars into a Transient Queue. These will be processed on registration.',
  ),
  'subscr_gateway' => 'y2pay',
  'subscr_id' => '2155223',
  'eotper' => '1 M',
  'ccaps' => '',
  'level' => '1',
  'ip' => '::1',
  'period1' => '0 D',
  'mc_amount1' => '0.00',
  'period3' => '1 M',
  'mc_amount3' => '23.95',
  'initial_term' => '0 D',
  'initial' => '23.95',
  'regular' => '23.95',
  'regular_term' => '1 M',
  'recurring' => '0',
  's2member_paypal_proxy' => 'y2pay',
  's2member_paypal_proxy_use' => 'pro-emails',
  's2member_paypal_proxy_verification' => 'd780d5f1c3ef4aad12dca83dfb14ba1c',
)

I think the IPN log seems ok, it received the ‘txn_id’ and just regarded the payment as it’s successful. The ‘level’ => ‘1’ was correct.

My confusion is that how the Access Level is stored when registration is processed. (I was expecting to not change the codes for registration since the new gateway is directly modified from authnet, but why it’s not working the same as authnet? – well I guess authnet works well)

I’ll appreciate your further help! Have a nice day!

Posted: Wednesday Sep 26th, 2012 at 7:23 am #26538

Thanks for the logs. Nothing wrong jumped at me…

My confusion is that how the Access Level is stored when registration is processed.

Well, the access (e.g. user level) is stored in the cookie set when the user returns. On registration, s2Member looks for this cookie and sets the access based on it. I’d try searching for “cookie” in the source files.

The other way is the registration link sent to the user in the Signup Confirmation email. The link includes the access the user gets. [hilite path]Dashboard -› s2Member® -› Authorize.Net® Options -› Signup Confirmation Email[/hilite]

That’s the same link you’d get from the Registration Access Link generators. [hilite path]Dashboard -› s2Member® -› Authorize.Net® Pro Forms -› Registration Access Links[/hilite]

The cookie and link also allow registration, in the case where Open Registration is disabled. [hilite path]Dashboard -› s2Member® -› General Options -› Open Registration[/hilite]

I hope it helps. :)

Posted: Thursday Sep 27th, 2012 at 1:50 am #26646
James
Username: jhutto

Thanks for your help, Cristián. I’ve found it was the length of the ‘txn_id’ and ‘subscr_id’ that plays the trick, after I make the y2pay’s ‘txn_id’ match authnet’s, it got working. Thanks again!

Posted: Thursday Sep 27th, 2012 at 10:06 pm #26781

Great! :)

By the way, I gave you the “Advanced User” badge. Nice job with that integration!

Viewing 6 replies - 1 through 6 (of 6 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.