wl-sips / sips-paypage-json-php-migration-from-sips-1.0

code samples to integrate Sips Paypage JSON in PHP for merchants migrating from WL Sips 1.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Read this page in French

Sips Paypage JSON sample PHP for WL SIPS 1.0 customers

The sample PHP code in this repository is for WL Sips 1.0 customers (using APIs) migrating to Sips Paypage JSON and keeping their merchantId.

Various use cases are given as an example: payment on order, deferred payment, etc.

To make your migration to WL Sips 2.0 as simple as possible, the code in this repository is configured by default to re-use a WL Sips 1.0 reference: the transactionId on 6 digits. It is called s10TransactionReference on WL Sips 2.0.

If you use a new merchantId natively with WL Sips 2.0, please refer instead to the Sips online documentation and to the following repository: https://github.com/wl-sips/sips-paypage-json-php.

Content

1. Common directory

This directory includes files used by various use cases.

  • sealCalculationPaypageJson.php: this file includes functions to compute the seal with 2 algorithms: HMAC-SHA-256 and SHA-256
  • paymentResponse.php: displays the manual response following the payment request, after verifying the seal received
  • flatten.php: includes various functions to return a string of characters to be sent to the WL Sips 2.0 server so as to initiate a payment with Sips Paypage JSON
  • redirectionForm.php: redirection form to Sips Paypage
  • transactionIdCalculation.php: if needed, generates a transactionId (s10TransactionReference for WL Sips 2.0) in the same format as the WL Sips 1.0 API.

2. Other files

Each file corresponds to a payment type. It includes the code that initiates the payment request and sends it to the WL Sips 2.0 server.

The examples are configured to work with the transactionId (s10TransactionReference) generated by PHP. If you generate a transactionId from your information system, edit the payment request file you would like to use and replace "s10TransactionReference" with "s10TransactionId":

// Merchants migrating from WL Sips 1.0 to WL Sips 2.0 must provide a transactionId. This easily done below. (second example used as default).
// Example with the merchant's own transactionId (typically when you increment Ids from your database)
 $s10TransactionReference=array(
    "s10TransactionId" => "000001",
// //   "s10TransactionIdDate" => "not needed",   Please note that the date is not needed, WL Sips server will apply its date.
 );
//
// Example with transactionId automatic generation, like the WL Sips 1.0 API was doing.
// $s10TransactionReference=get_s10TransactionReference();

Starting the tests

  • Clone the repository and keep the directory structure as on GitHub
  • Change the normalReturnUrl value in parameters.php according to your architecture
  • Check the uniqueness of the s10TransactionReference values if the reference is computed by you
  • In case of multiple payments (installments), change the dates and transaction reference if necessary
  • Run the payment request of your choice on a local web server

Version

These examples were validated on a WAMP server with PHP 7.3.12, and on a Linux/Debian server with nginx server and PHP 8.0.0.

Documentation

These code examples are based on our online documentation and on the migration guide to WL Sips 2.0 for merchants keeping their WL Sips 1.0 merchantId.

To use your merchantId on our WL Sips 2.0 production servers, please contact the WL Sips support beforehand by e-mail sips@worldline.com or at 0 811 10 70 33.

For more information, please refer to the Sips Paypage JSON documentation.

License

This repository is open source and available under MIT license. For more information, please read the LICENSE file .

About

code samples to integrate Sips Paypage JSON in PHP for merchants migrating from WL Sips 1.0

License:MIT License


Languages

Language:PHP 100.0%