Forums

[SOLVED] Create new payment plugin

shemzone 03 Nov, 2011
Hi everyone,
I need to build a plugin to allow the use of a french payment system (https://systempay.cyberpluspaiement.com/) used by a lot banks in France (as far we can still use banks...)
Is there somewhere I can get documentation on creating plugin for Chronoforms or do I need to make some reverse engineering of the existing ones (eg the one used for authorized.net)?
I'd prefer to have a documentation or at least a good step by step procedure.

Thanks a lot
Fred from France

PS: I bought a license for CF4
GreyHead 03 Nov, 2011
Hi shemzone,

There's no documentation for building an action, through they aren't very complicated. How are you going to use SystemPay? I took a quick look at the documents and there are several different options.

If it's a simple system then it may be easier to build using the existing cURL of ReDirect actions.

Bob
shemzone 03 Nov, 2011
Hi Bob and thank you for your reply.
The form will be an extended joomla registration/subscription form with extra fields (like "Company name", "Identification number of the company", etc.) with a fixed amount.
Here is the storyboard:
Once the content of the form is validated (controls of the fields), after a click on a button (like "subscribe now", I don't know yet) there will be a second page reminding the all the filled values with possibility to modify them and a button "Pay now". There will be a redirection to the system payment plateform with a page containing all the usual stuff for payment.
Once the payment is done (failed or canceled), the user will be sent back to the website with the result of the payment status and the user account will be activated.
I don't have yet all the technical specs (merchant_id, licence key, values to be passed and so on).

What do you think?

Fred
GreyHead 04 Nov, 2011
Hi Fred,

The part you describe can all be done easily enough. The question is how does the tecnhical interface with the payment gateway work. You are going to need to get into the detaisl of that to get an answer to your question.

For example, a basic PayPal payment an be done by building a simple URL and redirecting the user; using the PayPal API requires using cURL to send and receive data from PayPal; using PayPal IPN requires both of these working together.

Bob
shemzone 15 Nov, 2011
Hi Bob, I tried to be redirected to the payment site but this is not going as I expected.

Beside the form itself, I have added a custom code containing the following:

<?php
$key = "xxxxxxxxxxxxx";
$vadsparams= array();
$vadsparams['vads_site_id'] 	= "xxxxxxxx";
$montant_en_euro = 9.99;
$vadsparams['vads_amount']		= 100*$montant_en_euro;	// en cents
$vadsparams['vads_contrib']	= "joomla";
$vadsparams['vads_ctx_mode'] = "TEST";
$vadsparams['vads_currency'] = "978";
$vadsparams['vads_cust_email'] = JRequest::getVar('email');
$vadsparams['vads_cust_id'] = "00001";
$vadsparams['vads_cust_name'] =JRequest::getVar('name');
$vadsparams['vads_page_action']	= "PAYMENT";
$vadsparams['vads_action_mode']	= "INTERACTIVE";
$vadsparams['vads_payment_config']= "SINGLE";
$vadsparams['vads_version'] 	= "V2";

//-------------------------------------------------------
// Parametrage du retour automatique vers le site marchand
$vadsparams['vads_return_mode'] = "GET";
$vadsparams['vads_redirect_success_timeout'] = "5";
$vadsparams['vads_redirect_success_message'] = "Redirection vers la boutique dans quelques instants";
$vadsparams['vads_redirect_error_timeout'] = "5";
$vadsparams['vads_redirect_error_message'] = "Redirection vers la boutique dans quelques instants";

mt_srand();
$temp = str_pad(mt_rand(0,864000),6,'0',STR_PAD_LEFT);
$vadstransid=$temp;
$vadsparams['vads_trans_id']=$vadstransid;
$ts=time();
$vadsparams['vads_trans_date'] = gmdate ("YmdHis", $ts);

ksort($vadsparams);
$contenu_signature = "";
foreach ($vadsparams as $nom => $valeur){
	$contenu_signature .= $valeur."+";
}
$contenu_signature .= $key;
$vadsparams['signature'] = sha1($contenu_signature);

foreach($vadsparams as $nom => $valeur){
$form->data[$nom] = $valeur;
}

?>


and after that, in a CURL [GH] (with the target URL "https://systempay.cyberpluspaiement.com/vads-payment/")

vads_action_mode={vads_action_mode}
vads_amount={vads_amount}
vads_ctx_mode={vads_ctx_mode}
vads_contrib=joomla
vads_currency={vads_currency}
vads_cust_email={vads_cust_email}
vads_cust_id={vads_cust_id}
vads_cust_name={vads_cust_name}
vads_page_action={vads_page_action}
vads_payment_config={vads_payment_config}
vads_key_test={vads_key_test}
vads_redirect_error_message={vads_redirect_error_message}
vads_redirect_error_timeout={vads_redirect_error_timeout}
vads_redirect_success_message={vads_redirect_success_message}
vads_redirect_success_timeout={vads_redirect_success_timeout}
vads_return_mode={vads_return_mode}
signature={signature}
vads_site_id={vads_site_id}
vads_trans_date={vads_trans_date}
vads_trans_id={vads_trans_id}
vads_version={vads_version}


Until this, I get everything from the debugger, I get a correct header response from the targeted site, but nothing else happens, no redirect. I tried to add a redirect URL element with the same targeted URL, but still nothing.
Normally, I should be redirected to the targeted site.

There is a content message (Blue exclamation mark and message in blue):

$content[0]: vads_action_mode={vads_action_mode} vads_amount={vads_amount} vads_ctx_mode={vads_ctx_mode} vads_contrib=joomla vads_currency={vads_currency} vads_cust_email={vads_cust_email} vads_cust_id={vads_cust_id} vads_cust_name={vads_cust_name} vads_page_action={vads_page_action} vads_payment_config={vads_payment_config} vads_key_test={vads_key_test} vads_redirect_error_message={vads_redirect_error_message} vads_redirect_error_timeout={vads_redirect_error_timeout} vads_redirect_success_message={vads_redirect_success_message} vads_redirect_success_timeout={vads_redirect_success_timeout} vads_return_mode={vads_return_mode} signature={signature} vads_site_id={vads_site_id} vads_trans_date={vads_trans_date} vads_trans_id={vads_trans_id} vads_version={vads_version}

By the way, the above message is displayed even without debugger element. Is it normal?

Hereunder the debugger datas for CURL [GH]

cURL OK : the cURL function was found on this server.
cURL Target URL: https://systempay.cyberpluspaiement.com/vads-payment/
cURL Values: vads_action_mode=INTERACTIVE&vads_amount=999&vads_ctx_mode=TEST&vads_contrib=joomla&vads_currency=978&vads_cust_email=email@test.fr&vads_cust_id=00001&vads_cust_name=Jojo le Mérou&vads_page_action=PAYMENT&vads_payment_config=SINGLE&vads_redirect_error_message=Redirection vers la boutique dans quelques instants&vads_redirect_error_timeout=5&vads_redirect_success_message=Redirection vers la boutique dans quelques instants&vads_redirect_success_timeout=5&vads_return_mode=GET&signature=45853b25dfc1ef2382ba295571d6b9f2bed84485&vads_site_id=70501609&vads_trans_date=20111115210104&vads_trans_id=322931&vads_version=V2
cURL:Resource id #170
cURL info: Array ( [url] => https://systempay.cyberpluspaiement.com/vads-payment/ [content_type] => text/html;charset=UTF-8 [http_code] => 200 [header_size] => 769 [request_size] => 774 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.455215 [namelookup_time] => 0.005383 [connect_time] => 0.015918 [pretransfer_time] => 0.210148 [size_upload] => 620 [size_download] => 26759 [speed_download] => 58783 [speed_upload] => 1361 [download_content_length] => -1 [upload_content_length] => 620 [starttransfer_time] => 0.449816 [redirect_time] => 0 )
Response:
Systempay
Informations sur la transaction
http://www.unsaf.org/j17
Identifiant du commerçant	: 	xxxxxxx
Numéro de transaction	: 	xxxxxx
Montant	: 	9,99 EUR
Paiement sécurisé
Choisissez votre moyen de paiement :
CB
CB e-carteBleue
e-carteBleue Maestro
Maestro Mastercard
Mastercard Visa
Visa 


What did I missed?
Thanks a lot for your help.
Fred
GreyHead 16 Nov, 2011
Hi shemzone,

If you need to redirect the user then use the ReDirect URL and ReDirect User actions. The CURL action sends the data but does not redirect the user.

Bob
shemzone 16 Nov, 2011
Hi Bob, that's it, thank you.
For my knowledge: in which cases should we use Curl [GH]?

The next step for my project is:
From the form:
on submit
[list]Create a Joomla user account with "block user" set to "Yes"
Add extra information in a dedicated table (like "subscription account information")
Send to the payment plateform <- this is OK now
Return from the payment plateform, and update datas in "subscription account information" with the querystring and unblock user account if the payment is OK.[/list]

Do you have some hints for me to achieve that?

Fred
shemzone 16 Nov, 2011
Some news (close to the achievement):
The Joomla registration and the fill of my chrono table are OK. Then, I go the payment plateform with all the correct datas.
What I need just before to leave the form before to be redirected to the payment plateform is to create a cust_id that I can retrieve when I want to activate the user account once the payment is done.
So, I placed a custom code just after the Joomla registration (as Bob explained in a thread):

<?php
$form->data['cust_id'] = $form->data['_PLUGINS_']['joomla_registration']->id;
?>

But nothing is returned by the code above.
Does it work with Joomal 1.7.3 and CF 4?

Thank you for your help
Fred
GreyHead 29 Nov, 2011
Hi Fred,

To see exactly what data is being saved and how to access it you can use
echo $form->data; 
in a Custom Code action (or add a DeBugger action). That should let you check the correct syntax here.

Bob
shemzone 29 Nov, 2011
Thanks Bob
It was this:
$form->data['_PLUGINS_']['joomla_registration']['id'];


Fred
GreyHead 29 Nov, 2011
Hi Fred,

Thank you - I'll try to remember for the next time it's asked :-)

Bob
This topic is locked and no more replies can be posted.