Jump to content


Photo

lack of documentation


  • Please log in to reply
6 replies to this topic

#1 Luis Manson

Luis Manson

    Spam Happy

  • Members
  • PipPipPipPipPip
  • 707 posts

Posted 17 November 2011 - 06:53 PM

After reading http://community.inv...nt-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?

#2 Mark

Mark

    I dropped the "iggy"

  • IPS Staff
  • 8,384 posts

Posted 18 November 2011 - 05:13 AM

Hi Luis,

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


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.



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


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.


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..


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


what variables and data does payScreen() expect?


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.)

Mark Wade
Developer

zce-php5-3-logo.gif php5-zce-logo-new.gif


#3 Luis Manson

Luis Manson

    Spam Happy

  • Members
  • PipPipPipPipPip
  • 707 posts

Posted 18 November 2011 - 07:39 AM

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?

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)

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

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.)


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...?)

#4 Mark

Mark

    I dropped the "iggy"

  • IPS Staff
  • 8,384 posts

Posted 18 November 2011 - 09:30 AM

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:

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


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 :)


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)

Mark Wade
Developer

zce-php5-3-logo.gif php5-zce-logo-new.gif


#5 Luis Manson

Luis Manson

    Spam Happy

  • Members
  • PipPipPipPipPip
  • 707 posts

Posted 18 November 2011 - 11:02 AM

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>


#6 Luis Manson

Luis Manson

    Spam Happy

  • Members
  • PipPipPipPipPip
  • 707 posts

Posted 19 November 2011 - 04:52 PM

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

#7 Mark

Mark

    I dropped the "iggy"

  • IPS Staff
  • 8,384 posts

Posted 19 November 2011 - 06:13 PM

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

Mark Wade
Developer

zce-php5-3-logo.gif php5-zce-logo-new.gif





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users