Giter Site home page Giter Site logo

paulupdev / php-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hyperwallet/php-sdk

0.0 0.0 0.0 1.07 MB

An SDK implementation in PHP for the v4 REST APIs.

Home Page: http://hyperwallet.github.io/php-sdk

License: MIT License

Shell 0.17% PHP 99.83%

php-sdk's Introduction

Build Status Coverage Status Latest Stable Version PHP Version Require Packagist Downloads Packagist Downloads

Hyperwallet REST SDK

A library to manage users, transfer methods and payments through the Hyperwallet v4 API.

For Hyperwallet v3 API calls, please use the latest SDK version 1.x.x. See [here|https://docs.hyperwallet.com/content/updates/v1/rest-api-v4] to learn about the differences between versions and the update process required to use REST API v4.

Prerequisites

Hyperwallet's PHP server SDK requires at minimum PHP 5.6 and above.

Installation

$ composer require hyperwallet/sdk

Documentation

Documentation is available at http://hyperwallet.github.io/php-sdk.

API Overview

To write an app using the SDK

  • Register for a sandbox account and get your username, password and program token at the Hyperwallet Program Portal.

  • Add dependency hyperwallet/sdk to your composer.json.

  • Create a instance of the Hyperwallet Client (with username, password and program token)

    $client = new \Hyperwallet\Hyperwallet("restapiuser@4917301618", "mySecurePassword!", "prg-645fc30d-83ed-476c-a412-32c82738a20e");
  • Start making API calls (e.g. create a user)

    $user = new \Hyperwallet\Model\User();
    $user
      ->setClientUserId('test-client-id-1')
      ->setProfileType(\Hyperwallet\Model\User::PROFILE_TYPE_INDIVIDUAL)
      ->setFirstName('Daffyd')
      ->setLastName('y Goliath')
      ->setEmail('[email protected]')
      ->setAddressLine1('123 Main Street')
      ->setCity('Austin')
      ->setStateProvince('TX')
      ->setCountry('US')
      ->setPostalCode('78701');
    
    try {
        $createdUser = $client->createUser($user);
    } catch (\Hyperwallet\Exception\HyperwalletException $e) {
        // Add error handling here
    }
  • Error Handling The HyperwalletException has an array of errors with code, message and fielName properties to represent a error.

      try {
        ... 
      } catch (\Hyperwallet\Exception\HyperwalletException $e) {
        // var_dump($e->getErrorResponse());
        // var_dump($e->getErrorResponse()->getErrors());
        foreach ($e->getErrorResponse()->getErrors() as $error) {
            echo "\n------\n";
            echo $error->getFieldName()."\n";
            echo $error->getCode()."\n";
            echo $error->getMessage()."\n";
        }
      }

Development

Run the tests using phpunit:

$ composer install
$ ./vendor/bin/phpunit -v

Reference

REST API Reference

License

MIT

php-sdk's People

Contributors

akalichety-hw avatar akreisman-epam avatar akswaminathan-pp-dev avatar andrej-griniuk avatar apryzhkov-epam avatar arao6 avatar aseveryn-hw avatar asingh-hw avatar bolynykhw avatar dyurchenko-epam avatar fkrauthan-hyperwallet avatar gmeyer-hw avatar grmeyer-hw-dev avatar hlahlou-pp-dev avatar igusar-epam avatar jchanghw avatar jkurra-hw avatar madhankumar3103 avatar ramahalingam avatar rhunterduvar-hw-dev avatar romeritocl avatar rrathinasabapath avatar rukaelin avatar skambar110 avatar specialtactics avatar whersbach-hw avatar wmews-hw avatar yherasym-hw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.