承接 ixolit/ixopay-php-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ixolit/ixopay-php-client

最新稳定版本:v3.21.0

Composer 安装命令:

composer require ixolit/ixopay-php-client

包简介

Ixopay Client for PHP

关键字:

README 文档

README

Packagist PHP Version License

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

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;

// 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.

<?php

// 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.

See also

统计信息

  • 总下载量: 27.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 10
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-14