Hi again everyone,
Well, i wrote a mod for SMF core feature,
paid subscriptions system, actually this mod will add a new gateway for paid subscriptions, i done almost everything about 99% :) the only problem is callback to forum, the progress is:
Done:. adding gateway to paid subscriptions
. connecting to gateway via merchant ID
. set price for membership
. ordering membership via profile
. going to gateway and pay money.
. get tracking code you see, i almost done but the problem is callback and active membership for user. well, this is my first time that i have working with paid subscriptions, i don't have a paypal account so i don't know how smf works in this system. lemme share my code here, i know i shouldn't share mod (i dunno, maybe i can!)
Subscriptions-ZarinPal.phpit's absolutely like paypal file, i just changed gateway id and:
// Can we use curl?
if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'http://www.') . 'zarinpal.com/users/pay_invoice/$res')) include_once('zarinpal/request.php');
$return_data = array(
'form' => 'https://www.' . (!empty($modSettings['paidsubs_test']) ? 'sandbox.' : '') . 'zarinpal.com/users/pay_invoice/$res',and:
// Setup the headers.
$header = 'POST /users/pay_invoice/$res HTTP/1.1' . "\r\n";as you see in include, we have a file,
request.php:
this one will connect us to gateway.i don't know how to set callback to forum, SMF says:
LainaaFor the other gateways (If installed) you can normally find it in your customer panels, usually under the term "Return URL" or "Callback URL".
well, my callback file is: verify.php
$callBackUrl = 'verify.php';The #1 question is:this file is in this directory: SMF/Sources/zarinpal/verify.phpweb service always should access to this file, but above code not working, well after paid gateway will back us to our website, but it couldn't find verify.php for redirect.
i tried this:
$callBackUrl = '$sourcedir/zarinpal/verify.php';but this won't work, because web service can't read what sourcedir is. i'm little dizzy here, but for test, i set callback url to:
$callBackUrl = 'http://mystie.com/Sources/zarinpal/verify.php'; it's working but i just get a blank page with this url:
mysite.com/Sources/zarinpal/verify.php?refID=3621179431&au=536f6887-66fc-446b-b2bd-65d75bef37d4#2 question is:i just want it back to forum and active membership for those user that paid, i have no idea what should i do.
i just need a special help to make this mod to 100%. i know maybe i made you confuse, sorry for bad english.
Thanks in advance
About question one: I wouldn't put the file Sources at all.
The best place for it is the root of the forum, in the same directory as SSI.php for two reasons:
1) it can grab SSI.php easily,
2) if, for any reason, the forum is set up so that Sources is not web-accessible (for example like this site), it would never work (not that this configuration is used often, but just so that you know the option exists and would break your mod ;)).
Also:
$callBackUrl = '$sourcedir/zarinpal/verify.php';
should be:
$callBackUrl = $sourcedir . '/zarinpal/verify.php';
or:
$callBackUrl = "$sourcedir/zarinpal/verify.php";
Single and double quotes act differently in php. ;)
$sourcedir is the path and the url is required. So that's not quite right. ;)
As suggested, move it to the root. Then you can use $boardurl instead.
Oh... LOL
/me needs eyeglasses :P
yes, before i see your post, i get this from web service for callback:
/homepages/5/d394578306/htdocs/Mysite/zarinpal/verify.php?refID=3021216902&au=5370be2c-06a8-4b59-9785-3c335bef37d4
but after it, problem solved. it could find call back url successfully. #1 is solved, just #2 left. any idea?
i still see blank page and need active membership after paid.
Thanks a lot
OK, so it is the path which is required. ::)
For the white page, check your logs. There might be some indication there.
Don't quite understand #2. But if it is something that is membergroup based. Would addling a permission do what you want?
Lainaus käyttäjältä: Kays - toukokuu 12, 2014, 08:56:47 AP
OK, so it is the path which is required. ::)
For the white page, check your logs. There might be some indication there.
I don't think this time i find something in error log ;D
look dear Kays:
Lainaahttp://mysite.com/zarinpal/verify.php?refID=3021216902&au=5370be2c-06a8-4b59-9785-3c335bef37d4
blank page happened in outside of SMF, it's an external file, if i wrong please let me know, in other hand, my error log not working, i recently converted from SMF 1.1.19 to 2.0.7, i don't know what's happen, does it a bug? or something else... don't ask me why you won't test it on localhost , this web service work and valid on my website IP address, for security. i can't test it on other thing.
LainaaDon't quite understand #2. But if it is something that is membergroup based. Would addling a permission do what you want?
well, i explain more
first things first i should say i don't know how SMF Paid subscriptions works, but guess after user paid the money, it redirect to the forum and premium membership should activated for him/his. so i need this exactly.
in my mod after user paid money, he will get tracking code and after 30 seconds it will back to callback url, exactly this:
Lainaahttp://mysite.com/zarinpal/verify.php
web service generate refID automatically and adding this to address like this:
Lainaahttp://mysite.com/zarinpal/verify.php?refID=3021216902&au=5370be2c-06a8-4b59-9785-3c335bef37d4
well, we get blank page at this time, :D user paid the money but membership not activated for him automatically.
if i see how SMF paid subscriptions works with paypal maybe it will help to found out my problem. but i guess there's no demo!, right?
i think it's clear enough :) isn't it?
The paid subscriptions system is built around not having the workflow you're trying to use.
What you mean?
i don't understad what are you talking about.
! http://www.simplemachines.org/community/index.php?topic=321426.0
The way paid subs is designed, it won't really work with what you're trying to do. It's basically built for PayPal and the way PayPal notifies the site once the subscription is verified. It's better in 2.1 but not by a lot.
Take a look at the Google Wallet mod and see how much of the paid subs system it has to ignore.
well, i will try, try to do my best! or done or none.
okay, if i can't done this like paypal, i won't stop writing this mod, i prefer change my way, for example:
it's better than nothing, that tracking code and payment information will save in database, at least admin can see it, and active membership for user manually.
guys, i need someone to help me out to done this mod. i won't stop this mod, specially at 99% progress!
any solution? any idea?
Thanks in advance