User:Stepan Kosatyi/sandbox

Source: Wikipedia, the free encyclopedia.
IPSP PHP SDK
Original author(s)Stepan Kosatyi
Developer(s)Stepan Kosatyi
Initial release5 August 2015; 8 years ago (2015-08-05)
Stable release
1.1.5
Windows, FreeBSD
Size~1 MB
TypePayment gateway
LicenseMIT License
Websiteipsp-php.com

IPSP PHP SDK is a free and

open-source software development kit written in PHP and distributed under the MIT License
. IPSP PHP SDK is a wrapper of Fondy payment protocol REST API, uses object-oriented programming (OOP) techniques and several design pattern: Command [1], Chain of Responsibility[2], Proxy[3]. SDK covers e-commerce for businesses of all types and support popular CMS modules for fast integration in existing software architecture.

How Does it Work?

Payment Service Providers partner with Acquiring Banks to offer Merchants the capability to accept payments. Payment Service Providers often offer services in addition to processing transactions. These services include

Payment Card Industry and Data Security Standard (PCI)
compliance, fraud protection and the ability to process different currencies and translate different languages.

Brief history

Project started on 5 August 2015; 8 years ago (2015-08-05) as GitHub project. After almost 2 years, the project has its own website. The development of new releases and bug fixes started after code coverage with unit tests. In the future, support will be added for new versions of PHP and PSR-2[4] coding style guide and PSR-4[5] autoloader specification.

Key features

  • Quick installation[6] [7]
  • Client side instruction and best practicies[8]
  • Host-to-host and vendor side checkout page
  • Multiple payment methods credit card, internet banking.
  • Multiple data formats (JSON, XML, form-urlencoded)
  • Payment details for testing scope
  • Hidden server callback for sign responses
  • Integration with CMS modules.

API methods

All API methods executes in the same way. Use $ipsp (Ipsp_Api instance) method call() and pass two parameters: method name and parameters as associative array.

Example:

<?php
$data = $ipsp->call('method name',array(
  ...
  'param'    => 'value',
  ...
));
?>
General API methods
Name Description Mandatory parameters
checkout Hosted payment page signature[9] merchant_id order_id order_desc, currency, amount, signature
recurring Purchase using card token currency, amount, rectoken
reverse Order Refund currency, amount, signature
status Payment status
verification Card verification currency, amount, verification=y, verification_type=code
capture Order capture currency, amount, signature
reports Payment reports date_from, date_to
PCI compliance API methods
Name Description Mandatory parameters
pcidss Merchant payment page signature[9] merchant_id order_id order_desc currency amount card_number, cvv2, expiry_date
p2pcredit Peer-to-Peer card credit receiver_card_number, receiver_rectoken

Client side integration

To provide more flexibility for developers, server-side code must deliver secure information (commonly token like

UUID
) to front-end application, and handle signed responses from payment gateway for payment completion. All other things covered by client-side developers and UX designers.

Embedded checkout page

To load checkout page on merchant site using IPSP.JS[10] API, developer should first receive this url using checkout api method [11]. Then using example below just replace variable CHECKOUT_URL with api response variable checkout_url.

Example:

<div id="checkout"></div>
<script src="https://api.fondy.eu/static_common/v1/checkout/ipsp.js"></script>
<script>
 $ipsp.get('checkout').config({'wrapper':'#checkout'}).scope(function(){
     this.loadUrl(CHECKOUT_URL);
 });
</script>

Styling checkout page

IPSP.JS support embedded

css
rules to override the default checkout page design (hide general shop info section, style form controls etc.)

<script>
 $ipsp.get('checkout').config({
     'wrapper': '#frameholder' ,
     'styles' : {
         'body':{
            'overflow':'hidden'
         },
         '.page-section-shopinfo':{
             display:'none'
         },
         '.page-section-footer':{
             display:'none'
         }
     }
 })
</script>

Online donation on web-site is an important thing in open source project or non-commercial organization. [12] In this case payment service providers bring to their clients features like:

This payment type is less secure for using in e-commerce project, but ideal for

open source project or Nonprofit organization
. [13]

Example:

<script src="https://api.fondy.eu/static_common/v1/checkout/ipsp.js"></script>
function getCheckoutUrl(amount,order_desc) {
	var button = $ipsp.get('button');
	button.setMerchantId(1396424);
	button.setAmount(amount,'USD');
	button.setResponseUrl('http://example.com/result/');
	button.setHost('api.fondy.eu');
	button.addField({
		label: 'Payment Description',
		name: 'order_desc',
		value: order_desc,
    readonly:true
	});
	return button.getUrl();
};
<button onclick="location.href=getCheckoutUrl('','Open source project support')">Donate an arbitrary amount</button>
<button onclick="location.href=getCheckoutUrl(10,'10$ Donation')">Donate $10</button>

See also

References and notes

  1. ^ "PHP Design Patterns Command". FluffyCat. 2005. Retrieved 29 June 2017. ... In the Command Pattern an object encapsulates everything needed to execute a method in another object. ...
  2. ^ "PHP Design Patterns Chain of Responsibility". FluffyCat. 2005. Retrieved 29 June 2017. ... A method called in one object will move up a chain of objects until one is found that can properly handle the call ...
  3. ^ "PHP Design Patterns Proxy". FluffyCat. 2005. Retrieved 29 June 2017. ... one class stands in for and handles all access to another class ...
  4. ^ "PSR-2: Coding Style Guide". PHP FIG. 2016. Retrieved 28 June 2017. ...The intent of this guide is to reduce cognitive friction when scanning code from different authors...
  5. ^ "PSR-4: Autoloader". PHP FIG. 2016. Retrieved 28 June 2017. ...This PSR describes a specification for autoloading classes from file paths...
  6. ^ "Installation and requirements". IPSP PHP SDK. 2017. Retrieved 28 June 2017.
  7. ^ "Quick Start". IPSP PHP SDK. 2017. Retrieved 28 June 2017.
  8. ^ Top 5 Principles for an Improved Checkout Design
  9. ^ a b "Generate Signature". IPSP PHP. 2017. Retrieved 29 June 2017.
  10. ^ Fondy JavaScript API
  11. ^ Hosted payment page
  12. ^ "Payment / donate button". Fondy. 2015. Retrieved 27 June 2017. ...Payment button is a simple HTML code, wich can be place on any web page: on site, blog, internet-shop basket...'
  13. ^ JSFiddle Example

External Links