User:Stepan Kosatyi/sandbox
Original author(s) | Stepan Kosatyi |
---|---|
Developer(s) | Stepan Kosatyi |
Initial release | 5 August 2015 |
Stable release | 1.1.5
|
Windows, FreeBSD | |
Size | ~1 MB |
Type | Payment gateway |
License | MIT License |
Website | ipsp-php |
IPSP PHP SDK is a free and
. 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
Brief history
Project started on 5 August 2015GitHub 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.
asKey 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',
...
));
?>
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 |
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
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
<script>
$ipsp.get('checkout').config({
'wrapper': '#frameholder' ,
'styles' : {
'body':{
'overflow':'hidden'
},
'.page-section-shopinfo':{
display:'none'
},
'.page-section-footer':{
display:'none'
}
}
})
</script>
Donate button
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
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
- ^ "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. ...
- ^ "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 ...
- ^ "PHP Design Patterns Proxy". FluffyCat. 2005. Retrieved 29 June 2017.
... one class stands in for and handles all access to another class ...
- ^ "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...
- ^ "PSR-4: Autoloader". PHP FIG. 2016. Retrieved 28 June 2017.
...This PSR describes a specification for autoloading classes from file paths...
- ^ "Installation and requirements". IPSP PHP SDK. 2017. Retrieved 28 June 2017.
- ^ "Quick Start". IPSP PHP SDK. 2017. Retrieved 28 June 2017.
- ^ Top 5 Principles for an Improved Checkout Design
- ^ a b "Generate Signature". IPSP PHP. 2017. Retrieved 29 June 2017.
- ^ Fondy JavaScript API
- ^ Hosted payment page
- ^
"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...'
- ^ JSFiddle Example