lack of documentation

7 posts in this topic

Posted

After reading http://community.invisionpower.com/resources/documentation/index.html/_/developer-resources/ipnexus/how-to-create-your-own-payment-gateway-r498 a lot of times i realized there is a lot of information missing from that doc

like what are the ok/cancel/pending URLs which i should pass to the gateway

what about if i have multiple items on my cart...?

also, how do i make "an installer" for my gateway, like the hooks have...or i have to instruct the user to manually create the mysql data, copy the files, copy-paste the lang strings...

what variables and data does payScreen() expect?

Share this post


Link to post
Share on other sites

Posted

Hi Luis,



I'm not sure what you mean - the data that you send to the gateway would depend on the gateway. I'd refer to their documentation for more information.





It shouldn't make a difference. At the payment gateway level, all you're doing is allowing the user to interact with the gateway, and then telling Nexus if the invoice amount ($this->invoice->total) was received.
You could access the items through $this->invoice->items, if your gateway requires it for whatever reason though.




You could write a hook with no hook files which runs installation code if you were so inclined.




It receives no parameters, and should return an array, probably with one element called "html" with the HTML to display on the payment screen.

/** * Show payment screen * * @return array array( "html" => ..., - HTML to display in select method box "button" => ..., - HTML to replace button with "formUrl" => ..., - The URL we should submit the form to (do not specify to use a URL which will call validatePayment) ) */


You can also use:
$this->transaction (the transaction ID)
$this->invoice (the invoice object)
$this->method (array of payment method data)

Plus all the normal IP.Board shortcuts ($this->registry, $this->settings, $this->DB, etc.)

like what are the ok/cancel/pending URLs which i should pass to the gateway

what about if i have multiple items on my cart...?

also, how do i make "an installer" for my gateway, like the hooks have...or i have to instruct the user to manually create the mysql data, copy the files, copy-paste the lang strings..

what variables and data does payScreen() expect?





Share this post


Link to post
Share on other sites

Posted

[quote name='Mark' timestamp='1321611197' post='2197955']
Hi Luis,



I'm not sure what you mean - the data that you send to the gateway would depend on the gateway. I'd refer to their documentation for more information.



sorry, i was not clear, what i meant was that some gateways have a few options to pass URLs for returning the user after some events:

return url: payment made, but pending state...
ok url: the payment went OK, the gateway will send the user to this URL
cancel url: if the user cancels the payment, where should he be sent back?

[quote name='Mark' timestamp='1321611197' post='2197955']
It shouldn't make a difference. At the payment gateway level, all you're doing is allowing the user to interact with the gateway, and then telling Nexus if the invoice amount ($this->invoice->total) was received.
You could access the items through $this->invoice->items, if your gateway requires it for whatever reason though.


well, the gateways i use have some basic invoicing generation like $item_name_X, $item_price_X where X is a number, so i can have 2 items, with their price, so the gateway will show a detailed lists and a total

yet i have not a very good idea on how to interact with invoice->items (im a newbie on PHP)

[quote name='Mark' timestamp='1321611197' post='2197955']
You could write a hook with no hook files which runs installation code if you were so inclined.

i think i get it, write a hook with lang string, options, SQL and then just place the php file on the gateway directory

[quote name='Mark' timestamp='1321611197' post='2197955']
It receives no parameters, and should return an array, probably with one element called "html" with the HTML to display on the payment screen.




You can also use:
$this->transaction (the transaction ID)
$this->invoice (the invoice object)
$this->method (array of payment method data)

Plus all the normal IP.Board shortcuts ($this->registry, $this->settings, $this->DB, etc.)


thanks, i also made a mistake here because of my lack of knowledge, what i meant was, what are the $this variables i have available here (like this->invoice...?)


/**

  * Show payment screen

  *

  * @return array array(

		"html"  => ..., - HTML to display in select method box

		"button" => ..., - HTML to replace button with

		"formUrl" => ..., - The URL we should submit the form to (do not specify to use a URL which will call validatePayment)

		)

  */

Share this post


Link to post
Share on other sites

Posted

[quote name='Luis Manson' timestamp='1321619992' post='2197997']
sorry, i was not clear, what i meant was that some gateways have a few options to pass URLs for returning the user after some events:

return url: payment made, but pending state...
ok url: the payment went OK, the gateway will send the user to this URL
cancel url: if the user cancels the payment, where should he be sent back?


Pass all of them this value:




[quote name='Luis Manson' timestamp='1321619992' post='2197997']
well, the gateways i use have some basic invoicing generation like $item_name_X, $item_price_X where X is a number, so i can have 2 items, with their price, so the gateway will show a detailed lists and a total

yet i have not a very good idea on how to interact with invoice->items (im a newbie on PHP)


I would recommend simply passing one item with the invoice name and price ($this->invoice->title and $this->invoice->total). Like I say though, you could loop through $this->invoice->items and pass them all if you like.

You'll obviously need some basic PHP knowledge before you can write a payment gateway though :)


[quote name='Luis Manson' timestamp='1321619992' post='2197997']
thanks, i also made a mistake here because of my lack of knowledge, what i meant was, what are the $this variables i have available here (like this->invoice...?)


$this->transaction (the transaction ID)
$this->invoice (the invoice object)
$this->method (array of payment method data)

ipsRegistry::$settings['base_url'] . 'app=nexus&module=payments&section=receive&do=validate&method_id=' . $this->method['m_id'];

Share this post


Link to post
Share on other sites

Posted

thanks for your help, one last question, about SQL in hooks, i was not able to find any example/help on how to write the hookextras_database_insert part, i saw its key=value

so i guess



  <hookextras_database_insert>

    <insert>

	  <table>nexus_gateways</table>

	  <updates>g_gey=somegateway</updates>

	  <updates>g_name=Some Name GW</updates>

	  <updates>g_settings=a:4:{s:9:"api_login";a:1:{s:4:"type";s:9:"formInpu..</updates>

	  <updates>g_testmode=0</updates>

	  <updates>g_payout=0</updates>


	  <fordelete/>

    </insert>

  </hookextras_database_insert>

Share this post


Link to post
Share on other sites

Posted

is the hold (revw) public? or my only option is hold ?

Share this post


Link to post
Share on other sites

Posted

You should only return "okay", "hold" or "fail".

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Who's Browsing   0 members

    No registered users viewing this page.