Download the PHP package hypercharge/hypercharge-php without Composer
On this page you can find all versions of the php package hypercharge/hypercharge-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hypercharge/hypercharge-php
More information about hypercharge/hypercharge-php
Files in hypercharge/hypercharge-php
Package hypercharge-php
Short Description Hypercharge PHP Library / SDK
License MIT
Informations about the package hypercharge-php
hypercharge-php
PHP SDK for the Hypercharge payment gateway.
tested with PHP > 5.3 on OSX/Linux
Matches hypercharge-API-doc version 2.24 2014/09/16
Installation
Do not download the Hypercharge PHP SKD files manually. The php package manger composer takes care of that.
Let's say MY_PROJECT/
is your project root folder.
Do the following three steps:
1) Download composer.phar to MY_PROJECT/composer.phar
2) With your text editor create a MY_PROJECT/composer.json
containing
This will tell composer to install the most recent Hypercharge PHP SDK version.
3) in the shell (DOS console or terminal) go to MY_PROJECT/
and run the command
This downloads and installs Hypercharge PHP SDK and its dependencies into MY_PROJECT/vendor/
.
Show what has been installed
nice.
Notice: Later, when deploying your project to your server, upload the complete MY_PROJECT/vendor/
directory as well. MY_PROJECT/vendor/
contains the installed packages and autoload files.
Configuration
To get started, add one of the following snippets to your global configuration file.
Sandbox (for testing)
Hypercharge support creates a test-account and sends you login and password. For development and testing. No real money is transfered.
Live
When your Hypercharge boarding is complete our support team will send you your live login and password. Real money transactions here!
If there is no MY_PROJECT/vendor/autoload.php
in your project follow the installation instructions.
Credit Card sale Transaction
Submit 77.00 USD as a credit card sale to hypercharge channel.
Note: You have to be PCI compliant to handle Credit Card data. Most likely you are not PCI compliant, in that case you use our Mobile Payment.
To see local validation errors wrap the Hypercharge\Transaction::sale
call in a try catch
.
Web Payment Form (WPF) session
The following example is more complex.
- create a WPF session.
- redirect customer browser to WPF url provided
- customer submits WPF and is redirected to return_success_url you provided.
In the mean time hypercharge notifies your backend by calling
notification_url
, providing the payment status.
The WPF is displayed in English by default ('en'
). If you want a German WPF simply change the redirection line to:
WPF PaymentNotification
With a PaymentNotification Hypercharge notifies your server about a Payment status change e.g. when a Payment was successfull (status approved
) or has failed in some way. A PaymentNotification is a server to server request in the background. Neither webbrowser nor user interaction is involved.
You place the php script under the url you specify as notification_url
(https://your-server.com/hypercharge-wpf-notifications.php
in the "Web Payment Form (WPF) session" example abough)
A scelleton:
See PaymentNotification class definition for how to use $notification
or $payment
.
An example with symbolic busineslogic as pseudocode:
Create Mobile Payment Session
Mobile Payments are quite similar to WPF Payments. The Session creation has slightly different data. The Notification code is the same as WPF Notification abough.
your_server -> POST XML -> hypercharge
Submit Mobile Payment from mobile device
Example Mobile Submit XML your mobile application posts to $payment->submit_url
to process the payment.
If you're concerned of POSTing cc data via internet: The $payment->submit_url
will look something like https://testpayment.hypercharge.net/mobile/submit/eabcb7a41044e764746b0c7e32c1e9d1
so the xml will be transmitted encrypted.
Tests
Running tests for hypercharge-php itself has to be done outside of MY_PROJECT
.
Clone hypercharge-php into its own directory
step into the directory
install composer (here 1.0.0-alpha7 feel free to use a more recent one)
install dev dependecies
Unit Tests
Run the unit tests
You might wonder what the output means:
Simply read the next chapter.
Remote Tests
The remote tests make https calls to the hypercharge sandbox (testing gateway).
At first you have to setup your login and channel tokens:
Copy test/credentials.json.example
to test/credentials.json
.
You received credentials when hypercharge created your test-acount.
Add the credentials to test/credentials.json
. See values marked with TODO
.
Run the remote tests
this will take about a minute.
You can use environment variables:
DEBUG=1
verbose output.CREDENTIALS=development
switch to "development" credentials. Default issandbox
Note:
test/credentials.json
should not be checked into your code repository. e.g. add it to.gitignore
- Do not run the remote tests on your live credentials.
Warranty
This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.
All versions of hypercharge-php with dependencies
ext-curl Version *
ext-hash Version *
ext-simplexml Version *
ext-dom Version *
hypercharge/hypercharge-schema Version *