Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

QPAY Checkout Page integration example in PHP

License

NotificationsYou must be signed in to change notification settings

qenta-cee/qcp-example-php

Repository files navigation

LicensePHP v7.4

This example demonstrates the usage of QPAY Checkout Page and provides a basis for integration into PHP-based systems.

OurOnline Guides provide an in depth description of theQPAY Checkout Page.

Installation

Copy the example code to a web server which supports PHP. Ensure that the web server is accessible from the Internet via port 80 (for http communication) or port 443 (for https communication). The web server needs a fully qualified domain name for receiving data from Qenta (e.g. payment confirmations).

Docker

Required: Dockeranddocker-compose

Recommended:ngrok

Demo Configuration

Rundocker-compose up to start theqcp-example-php Application locally with our demo configuration.

Test Configuration

The Repository features a.env.example File with our test configuration. Theqcp-example-php Application can be started with our test configuration by runningdocker-compose --env-file .env.example up.

Custom Configuration

In order to use theqcp-example-php Application with your own Qenta Configuration you need to runcp .env.example .env and change the corresponding values in the.env File with the values representing your Qenta Configuration. Afterwards a simpledocker-compose up will start theqcp-example-php App with your Configuration.

The webserver is accessible athttp://localhost:8000.

To receive a payment confirmation you need a FQDN. We recommend to usengrok.Runngrok http http://localhost:8000 to get an externally reachable URL.

Support and additional information

If you have any questions or troubles to get this example up and running in your web server environment, please do not hesitate to contact oursupport teams.

Relevant files

Configuration

File:includes/config.inc.php

The necessary configuration values are defined in a configuration file. This file is included in the other PHP files which depend on these values.

Creating a separate file for these variables enables the use of the values when starting the payment process and also when retrieving and verifying the result of the payment process. Additionally we strongly encourage you to move this configuration file containing the secret to a folder on your web server where it cannot be accessed from outside!

After closing the contract change the specific parameters you received from our support teams in the configuration file.

Keep the file(s) where your secret is defined in a folder which cannot be accessed from users visiting your web server.

Payment process initiation

File:index.php

The required and optional request parameters used for the specific payment process are defined in a different file. Please have a look atRequest Parameters for more details on the parameters which can be defined. These parameters are then used as hidden fields in the HTML-form which is presented to the consumer of your online shop.

Your consumer may then select one of the offered payment methods and start the payment process by submitting the values to QPay Checkout Page. If all required parameters are set and the fingerprint is verified, the payment process is started and your consumer is guided through the process.

Receiving and storing the payment process result

File:return.php

The PHP file for receiving and storing the result of the payment process for your online shop is called by QPay Checkout Page. We strongly recommend that you use the possibility to set the optional request parameterconfirmUrl so that you are able to store the result independently of the behavior of your consumer during the redirect to thesuccessUrl,cancelUrl,pendingUrl orfailureUrl.

File:confirm.php

TheconfirmUrl is called by QENTA informing your online shop about the result of the payment process.

This file consists of the following functional steps:

  • Including the previously created and already used configuration file.
  • Executing the functionhandleCheckoutResult. This function
    • Checks the availability of the return parameterpaymentState.
    • Validates the response parameters with the functionareReturnParametersValid, if the resulting state is "SUCCESS" or "PENDING", which
      • creates a fingerprint based on the parameter order as given in the return parameterresponseFingerprintOrder and the values of all mentioned values in it.
      • compares the value of the return parameterresponseFingerprint and the computed fingerprint.
    • Writes the results and the response parameter and their values into the fileconfirmation.log.

Additional files

You may also use the additional files in the example package for testing purposes and replace them later with your specific content:

File nameDescription
ui/logo.pngYour logo of your online shop which will be displayed on the QPay Checkout Page.
service.htmlThis HTML page is shown to your consumer, if your consumer clicks on your logo within QPay Checkout Page.

[8]ページ先頭

©2009-2025 Movatter.jp