customsumit / adapter-php
PHP Security Adapter
Requires
- php: ~5.6.0|~7.0.0|~7.1.0|~7.2.0|~7.3.0|~7.4.0|~8.1.0|~8.2.0|~8.3.0
- ext-openssl: *
This package is auto-updated.
Last update: 2025-10-24 12:50:33 UTC
README
When a customer creates a roof kit on the kitbuildr and clicks the Add to Basket button the kitbuildr will attempt to POST the kit data to the merchant's website so that the kit can be added to the merchant ecommerce website's basket. The kit data is packaged and encrypted into a single data object before being sent across the wire to the ecommerce basket endpoint.
This PHP Security Adapter provides a common way to decrypt the kit data payload using the merchant specific private key (provided by Optagon).
Once the kit data has been decrypted the merchants ecommerce basket code must process the kit data and insert a product into the basket representing that kit.
The Security Adapter can then respond to the kitbuildr to indicate success and the kit was added to the merchant basket.
Usage
use CustomSumIT\Adapter\Adapter;
try {
$Adapter = new Adapter ( $privateKey );
// KitBuilder Kit Data
$kit = $Adapter->data;
// Add to cart START
$addtoCartSuccess = true;
// Add to cart END
// Send a response to the Kit Builder
$Adapter->setReturnUrl ( $returnUrl )->setAddedToCart ( $addtoCartSuccess )->respond ();
} catch ( Exception $e ) {
// Log $e->getMessage() for debugging
}
Kit Data
The kit data object POSTed to the merchant website will contain:
[
'kit_url' => {string} URL of the kit that will allow the customer to reload that kit in the kitbuildr,
'kit_price' => {float}, Price of the kit excluding VAT,
'kit_system' => {string} System code for the kit (e.g. 'classicbond', 'skyguard'),
'kit_size' => {float} Area of the roof in sqm,
'kit_ref' => {string} Unique kit reference
]
kitbuildrĀ® Requirements
The kitbuildr requires the basket endpoint on the merchant's website to which the kit data can be POSTed during the Add To Basket process. (e.g. https://www.merchant-domain.co.uk/add-to-basket.php). This is dependant on the merchant's particular ecommerce implementation.