PHP code example of hyperwallet / sdk

1. Go to this page and download the library: Download hyperwallet/sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hyperwallet / sdk example snippets


  $client = new \Hyperwallet\Hyperwallet("restapiuser@4917301618", "mySecurePassword!", "prg-645fc30d-83ed-476c-a412-32c82738a20e");
  

  $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
  }
  
 
    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";
      }
    }