ixopay / ixopay-php-client
Ixopay Client for PHP
Installs: 82 037
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 11
Forks: 10
Open Issues: 2
Requires
- php: >=5.6
- ext-curl: *
- psr/log: *
- dev-master
- dev-main
- v3.x-dev
- v3.18.1
- v3.18.0
- v3.17.0
- v3.16.0
- v3.15.0
- v3.14.1
- v3.14.0
- v3.13.0
- v3.12.0
- v3.11.0
- v3.10.0
- v3.9.0
- v3.8.0
- v3.7.0
- v3.6.0
- v3.5.0
- v3.4.0
- v3.3.1
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.x-dev
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4
- v2.3.1
- v2.3
- v2.2
- v2.1.13
- v2.1.12
- v2.1.11
- v2.1.10
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-feature/industy_practice_for_transaction_indicator
- dev-feature/disputes
- dev-feature/deregister-type
- dev-feature/recipient-account-pan-correction
- dev-feature/sender-account-pan
- dev-feature/ngorbacs/add-scheme-reference-id
- dev-feature/3ds-fields
- dev-feature/update-documentation-links
- dev-feature/cp-pt-token-in-statuscall
- dev-feature/delayed-capture-x2148
- dev-feature/add-support-for-partial-deregisters
- dev-sandbox-beta
- dev-prerelease-dev
- dev-feature/level-2-3-data
- dev-feature/browser-platform
- dev-feature/eight-digit-bins
- dev-request-dcc-parameter
- dev-feature/rhofer/redirectQrCode
- dev-feature/error-object-improvements
- dev-feature/fix-error-parsing
- dev-feature/capture-description
- dev-feature/crosse/indicator-trait
- dev-feature/splitTx
- dev-feature/additionalWalletData
- dev-feature/json-api-phase2
- dev-feature/pay-by-link
- dev-feature/incremental-auths
- dev-feature/json-api-phase1
- dev-feature/sbuchegger/updateScheduleAPI
- dev-feature/mk/custom-headers
- dev-feature/customer-profiles
- dev-php7
- dev-feature/dku/customer-profiles
- dev-feature/account-updater
- dev-prerelease/2018_07
- dev-feature/rb/risk-checks-without-processing
- dev-php56
This package is auto-updated.
Last update: 2024-12-26 16:53:35 UTC
README
Accept payments and integrate 100+ payment methods on your PHP backend: the IXOPAY PHP SDK provides convenient access to the IXOPAY REST APIs.
Table of Contents
Installation
Requirements
- PHP 5.6 or newer
- Installed Composer
Composer
Add the IXOPAY PHP SDK to your composer.json
.
composer require ixopay/ixopay-php-client
Documentation
Please see IXOPAY Gateway Documentation for general information about how to use the transaction processing API.
See the IXOPAY API Reference for a reference of all transaction processing API calls.
Usage
Prerequisites
- IXOPAY account
- API User - consisting of:
- username, and
- password
- Connector - consisting of:
- API key, and
- optional: shared secret
Setting up credentials
Instantiate a new Ixopay\Client\Client
authenticated via your API user & password,
connecting it to a payment adapter identified by an API key and authenticated using a shared secret.
<?php use Ixopay\Client\Client; use Ixopay\Client\Data\Customer; use Ixopay\Client\Transaction\Debit; use Ixopay\Client\Transaction\Result; // Include the autoloader (if not already done via Composer autoloader) require_once('path/to/initClientAutoload.php'); // Instantiate the "Ixopay\Client\Client" with your credentials $api_user = "your_username"; $api_password = "your_username"; $connector_api_key = "your_chosen_connector_api_key"; $connector_shared_secret = "your_generated_connector_shared_secret"; $client = new Client($api_user, $api_password, $connector_api_key, $connector_shared_secret);
Process a debit transaction
Once you instantiated a client with credentials, you can use the instance to make transaction API calls.
// define your transaction ID: e.g. 'myId-'.date('Y-m-d').'-'.uniqid() $merchantTransactionId = 'your_transaction_id'; // must be unique $customer = new Customer() $customer = $customer ->setBillingCountry("AT") ->setEmail("customer@example.org"); // after the payment flow the user is redirected to the $redirectUrl $redirectUrl = 'https://example.org/success'; // all payment state changes trigger the $callbackUrl hook $callbackUrl = 'https://api.example.org/payment-callback'; $debit = new Debit(); $debit = $debit->setTransactionId($merchantTransactionId) ->setSuccessUrl($redirectUrl) ->setCancelUrl($redirectUrl) ->setCallbackUrl($callbackUrl) ->setAmount(10.00) ->setCurrency('EUR') ->setCustomer($customer); // send the transaction $result = $client->debit($debit); // now handle the result if ($result->isSuccess()) { //act depending on $result->getReturnType() $gatewayReferenceId = $result->getReferenceId(); //store it in your database if ($result->getReturnType() == Result::RETURN_TYPE_ERROR) { //error handling $errors = $result->getErrors(); //cancelCart(); } elseif ($result->getReturnType() == Result::RETURN_TYPE_REDIRECT) { //redirect the user header('Location: '.$result->getRedirectUrl()); die; } elseif ($result->getReturnType() == Result::RETURN_TYPE_PENDING) { //payment is pending, wait for callback to complete //setCartToPending(); } elseif ($result->getReturnType() == Result::RETURN_TYPE_FINISHED) { //payment is finished, update your cart/payment transaction //finishCart(); } } ?>
Support
If you have suggestions for new features, spotted a bug, or encountered a technical problem, create an issue here. Also, you can always contact IXOPAY's Support Team as defined in your contract.
Licence
This repository is available under the MIT License.