smart2pay / sdk-php
Smart2Pay SDK - enable payments on your site easily 200+ methods, 80+ countries
Installs: 19 692
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 5
Forks: 3
Open Issues: 0
Requires
- php: >=5.3.3
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- dev-master
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.1
- 3.0.0
- 2.1.32
- 2.1.31
- 2.1.30
- 2.1.29
- 2.1.28
- 2.1.27
- 2.1.26
- 2.1.25
- 2.1.24
- 2.1.23
- 2.1.22
- 2.1.21
- 2.1.20
- 2.1.19
- 2.1.18
- 2.1.16
- 2.1.15
- 2.1.14
- 2.1.13
- 2.1.12
- 2.1.11
- 2.1.10
- 2.1.9
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- dev-develop
- dev-psr4-compatibility-fixes
- dev-psr4-compatibility
This package is auto-updated.
Last update: 2025-03-27 10:17:39 UTC
README
NB: If you installed our SDK using composer, please read the note at the end of the file.
For quick information about available SDK methods and functionalities, please open {SDK directory}/play.php
script in a browser (requires a web server).
For live demo of methods and functionalities available in current version of SDK, please open {SDK directory}/demo.php
script in a browser (requires a web server).
Please note that in order to test a full end-to-end transaction you will require a valid Smart2Pay test account which you can obtain at https://www.smart2pay.com/en/SignUpStart. After you registered a test account, use API Key and Site ID found at Technical Integration > Integration Roadmap > Integration Site and configure your SDK by copying config.dist.php
to config.php
and fill in S2P_SDK_SITE_ID
, S2P_SDK_API_KEY
and S2P_SDK_ENVIRONMENT
constants.
Creating your test merchant account
- Go to https://www.smart2pay.com/en/SignUpStart and complete the form. Make sure you tick the checkbox REST API interface to let system know you will integrate SDK solution. If you will also use any e-commerce plugins specify this by ticking plugins checkbox.
- Log into your account and go to Technical Integration > Integration Roadmap > Integration Site.
- You should use Site ID and API Ke
- y found on that page to fill constants in
config.php
of your test SDK environment.
Configuring your SDK
-
Copy
config.dist.php
file located in root directory of your SDK toconfig.php
and edit the file. -
Paste Site ID (from Technical Integration > Integration Roadmap > Integration Site) in constant definition
S2P_SDK_SITE_ID
like below:if( !defined( 'S2P_SDK_SITE_ID' ) ) define( 'S2P_SDK_SITE_ID', 'SiteID_of_your_Integration_Site' );
-
Paste API Key (from Technical Integration > Integration Roadmap > Integration Site) in constant definition
S2P_SDK_API_KEY
like below:if( !defined( 'S2P_SDK_API_KEY' ) ) define( 'S2P_SDK_API_KEY', 'APIKey_of_your_Integration_Site' );
-
Configure environment to test:
if( !defined( 'S2P_SDK_ENVIRONMENT' ) ) define( 'S2P_SDK_ENVIRONMENT', 'test' ); // live or test
-
When environment is set to custom, you can provide a custom REST API base URL (used for debugging purposes). In production leave this empty:
if( !defined( 'S2P_SDK_CUSTOM_BASE_URL' ) ) define( 'S2P_SDK_CUSTOM_BASE_URL', '' );
-
Setup return URL. This URL is the location where end-user will be redirected after a transaction finishes (successful or not):
if( !defined( 'S2P_SDK_PAYMENT_RETURN_URL' ) ) define( 'S2P_SDK_PAYMENT_RETURN_URL', 'https://www.myshop.com/sdk/samples/_return.php' );
Once all above steps are completed you can test a full end-to-end transaction and check log files generated.
demo.php
script will generate logs when redirected back to return page in log_return.log
and also for notifications in log_demo.log
. Please make sure PHP has rights to create and write in these files located in root of SDK directory. If PHP doesn't have creation rights on SDK directory create these two log files first and give PHP write rights on them.
For quick samples on how you should implement SDK methods and functionalities please check samples
directory.
Composer installs note
If you installed our SDK using composer and you don't want to create a custom config.php
file, you will have to define S2P_SDK_SITE_ID
, S2P_SDK_API_KEY
and S2P_SDK_ENVIRONMENT
constants in SDK wrapper script. Please check files in samples
directory.
There were reports about composer deleting config.php
file in SDK root dir when updating the SDK. To overcome this, you can define S2P_SDK_CONFIG_PATH
constant in your wrapper script which contains directory where config.php
file resides in your project.