Hello KK and Team,
I am trying to implement a paid membership/upgrade membership system and I (hopefully) am very close, but there remains a single roadblock.
The way I have gone about this is within the users/index.php template, I have set a global variable to define pp_price (since I only have one price I intend to charge)
Next, the tags.php 's way of getting $item_name and $item_number is through the page name and id, but since we're in the users template, I can't access those, so I created global variables and then used CTX to get their value. Below are the lines I replaced in tags.php
And these are the relevant lines added into the users/index.php:
Setting paypal_processor to debug mode (not in sandbox), I get the following:
(there is no "exiting" line... I don't know if that's cause for concern)
I think this is the desired result, but for some reason the paypal_processor block won't fire (neither will k_paypal_success).
I have little to no experience with PHP, but I think it might have something to do with this code in tags.php
Namely, in the else block, I think $pg is incorrect (?) since the variables are not being made available. But take that with a grain of salt as, again, I'm not well versed in PHP.
I would really, really appreciate any help as I've thrown many, many hours into this and can't get any further.
I am trying to implement a paid membership/upgrade membership system and I (hopefully) am very close, but there remains a single roadblock.
The way I have gone about this is within the users/index.php template, I have set a global variable to define pp_price (since I only have one price I intend to charge)
Next, the tags.php 's way of getting $item_name and $item_number is through the page name and id, but since we're in the users template, I can't access those, so I created global variables and then used CTX to get their value. Below are the lines I replaced in tags.php
- Code: Select all
$item_name = $CTX->get( 'this_user_name' );
$item_number = $CTX->get( 'this_user_id' );
And these are the relevant lines added into the users/index.php:
- Code: Select all
<cms:pages masterpage=k_user_template id=k_user_id>
<cms:set this_user_id="<cms:show k_page_id/>" 'global' />
<cms:set this_user_name="<cms:show k_page_name/>" 'global' />
</cms:pages>
Setting paypal_processor to debug mode (not in sandbox), I get the following:
- Code: Select all
=======================[2022-01-08 21:46:04]=======================
Received paypal IPN:
mc_gross = 0.05
protection_eligibility = Eligible
payer_id = XU5HJS7WALJQA
payment_date = 17:45:56 Jan 08, 2022 PST
payment_status = Completed
charset = windows-1252
first_name = name
mc_fee = 0.05
notify_version = 3.9
custom =
payer_status = unverified
business = email2@gmail.com
quantity = 1
verify_sign = ARhXYj9-geVZC-qz8Pfn8CjmemnhA3v5SVYqm3FLLF-CStMDnyCG5hbD
payer_email = email@gmail.com
txn_id = 7SE05472P8067030V
payment_type = instant
last_name = lastName
receiver_email = email2@gmail.com
payment_fee = 0.05
shipping_discount = 0.00
receiver_id = T4VUECM5BKLT8
insurance_amount = 0.00
txn_type = web_accept
item_name = 41743cfdf36c6bb41f407018282d42c5
discount = 0.00
mc_currency = USD
item_number = 591
residence_country = CA
shipping_method = Default
transaction_subject =
payment_gross = 0.05
ipn_track_id = f971209736fb6
=======================[2022-01-08 21:46:04]=======================
Connecting to paypal for verification..
=======================[2022-01-08 21:46:04]=======================
POST /cgi-bin/webscr HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: www.paypal.com
Connection: close
User-Agent: abc-company-name
Content-Length: 824
=======================[2022-01-08 21:46:04]=======================
Connected
=======================[2022-01-08 21:46:06]=======================
VERIFIED
=======================[2022-01-08 21:46:06]=======================
Couch validating transaction..
=======================[2022-01-08 21:46:06]=======================
Transaction OK
(there is no "exiting" line... I don't know if that's cause for concern)
I think this is the desired result, but for some reason the paypal_processor block won't fire (neither will k_paypal_success).
I have little to no experience with PHP, but I think it might have something to do with this code in tags.php
- Code: Select all
// Validate that the transaction was valid before flagging success.
if( $debug ) $FUNCS->log( 'Couch validating transaction..', $logfile );
$pg = '';
$rc = $FUNCS->validate_transaction( $_POST['item_name'], $_POST['item_number'], $_POST['quantity'], $_POST['mc_gross'], $_POST['mc_currency'], $_POST['receiver_email'], $pg );
if( $FUNCS->is_error($rc) ){
if( $debug ) $FUNCS->log( 'ERROR: '.$rc->err_msg, $logfile );
$CTX->set( 'k_paypal_error', $rc->err_msg );
}
else{
if( $debug ) $FUNCS->log( 'Transaction OK', $logfile );
$CTX->set( 'k_paypal_success', 1 );
$pg->set_context();
}
Namely, in the else block, I think $pg is incorrect (?) since the variables are not being made available. But take that with a grain of salt as, again, I'm not well versed in PHP.
I would really, really appreciate any help as I've thrown many, many hours into this and can't get any further.