Skip to content

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

License

Notifications You must be signed in to change notification settings

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

Repository files navigation

Read this page in French

Sips Paypage POST 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 POST 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-post-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 to initiate a payment with Sips Paypage POST
  • redirectionForm.php: POST version of the 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 payment (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 POST documentation.

License

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages