Jump to content
Mark
 Share


IP.Nexus Dev Update: Extensibility

One of the first things I wanted to talk about with IP.Nexus is how easy it is for third-party developers to integrate with IP.Nexus.
You could for example, have an area of your application that you only want available to users who pay a fee. IP.Nexus makes this possible.

There is a special class in IP.Nexus called commerceApi that allows you to generate an invoice, and check if an item has been purchased.
In addition, you can make use of special extension files to automatically run when an item from your application is purchased, expires or is renewed - and your items can appear in the Admin CP "Generate Invoice" page.

For example, we have written integration for IP.Nexus with IP.Downloads using this functionality, which we will demonstrate in a future blog entry.


For developers, to generate an invoice, you simply call the commerceApi::generateInvoice() method. This is the code we use within the donation module of IP.Nexus:

try { $title = "Donation: {$goal['d_name']}"; $invoiceID = commerceApi::generateInvoice( $title, $this->memberData['member_id'], array( array( 'act' => 'charge', 'app' => 'commerce', 'type' => 'donation', 'cost' => $amount, 'itemName' => $title, 'itemID' => $goal['d_id'] ) ) ); } catch( Exception $e ) { $this->registry->output->showError( "An error occurred while trying to generate your invoice. Please try again or contact an administrator. ({$e->getMessage()})", 12345 ); } $this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=commerce&module=payments&section=pay&id=' . $invoiceID );






















As you can see, the code passes some information about the item(s) being purchased. At this point, commerceApi generates an invoice, and then the user is sent to the payment screen.
Once payment has been processed, the user will be sent right back to the file.

Using this functionality you can:

  • Specify a base cost for your item
  • Specify renewal terms
  • Provide a URL to the item which will be linked to on the invoice screen
  • Specify a member who should get commission for the purchase and how much commission to give them (for example, if the item was added by another member)
  • Specify a URL to return the user to once payment has been received



Later in your code, to check if a user has purchased an item (for example, when they try to access a restricted area) you just call commerceApi::itemIsPurchased() to check if they have paid for the item.

if ( commerceApi::itemIsPurchased( $this->memberData['member_id'], 'myapp', 'item_type', $data['id'] ) != 'ACTIVE' ) { // Item not purchased... }








commerceApi::itemIsPurchased() will return a value indicating whether the item was purchased, and if the renewals are active.


As you can see, the API is very simple to use and means mod authors do not have to worry about implementing payment systems in their own applications. We're really excited to see how mod authors will use this functionality and as always, if you have any questions, please post them in our feedback forum.
Our next blog entry will demonstrate how we used this functionality to implement paid files within IP.Downloads.

 Share

Comments

Recommended Comments

This looks great Mark. One question, you state via this method that once payment has been completed the buyer will be sent straight to the file...can this be altered via permissions so that access to the file is still delayed until manual approval?

Link to comment
Share on other sites

[quote name='John S' date='13 May 2010 - 02:45 PM']
This looks great Mark. One question, you state via this method that once payment has been completed the buyer will be sent straight to the file...can this be altered via permissions so that access to the file is still delayed until manual approval?


If payment is held for approval then the user will see a screen informing them of such instead.

Link to comment
Share on other sites

[quote name='Mark' date='13 May 2010 - 09:48 AM']

If payment is held for approval then the user will see a screen informing them of such instead.
Outstanding! I take it that these fields are also customizable via hooks or direct edit of the core file?

Link to comment
Share on other sites

[quote name='Gros Blaireau' date='13 May 2010 - 09:57 AM'] I don't understand the goal of IP.commerce.

It's to create a true shop like a library, or only something virtual with special access to special categories in the forum, for exemple ?
It will be able to do both. You can use it as a subscription/promotional tool, helpdesk and/or a shopping cart for either digital or hard goods. It will also provide invoicing and inventory control.

Link to comment
Share on other sites

To add on to what John said - IP.Commerce is designed to give you the tools to monetize your community. It isn't just a "shop modification".

Stay tuned for more blog entries over the coming weeks that detail Commerce's features :)

Link to comment
Share on other sites

Okay,

The fact is I need a shop, for a library. I have interest into ebaystore. But I prefer to have the shop directly on my website of course.

I know you don't want to give date, but what time do you expect, approximatively, for the first release of IP.Commerce ?
3 months ? 6 Months ? At the end of the year ? In more than one year ?

Link to comment
Share on other sites

Wow, you guys are incredible! Makes me glad I went with IPS products! This is amazing! :)

Quick question though, will you incorporate this into your site? As in, will future IP.Board and addons purchasing actually be made and fulfilled by IP.Commerce, just how other parts of this site is using your other addons?

Link to comment
Share on other sites

[quote name='Ω Ω Ω' date='13 May 2010 - 07:51 PM']
Can newbies be given documentation / tutorials on how these things can be achieved? - Omega


There will of course be documentation

Link to comment
Share on other sites

I cannot begin to say how excited I am about this add on, you have a customer in waiting right now! Just buying the IP Board now too and looking forward to some of the other attachments in due course. Good bye phpbb… :thumbsup:

Link to comment
Share on other sites


Sorry, but you do not think that it's not compatible with Zend Guard?

One of the first things I wanted to talk about with IP.Nexus is how easy it is for third-party developers to integrate with IP.Nexus.

Link to comment
Share on other sites



Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...