PHPackages                             gjorgic/my-promisepay-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. gjorgic/my-promisepay-php

ActiveLibrary[API Development](/categories/api)

gjorgic/my-promisepay-php
=========================

PHP SDK for the PromisePay API

0356PHP

Since Aug 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/gjorgic/my-promisepay-php)[ Packagist](https://packagist.org/packages/gjorgic/my-promisepay-php)[ RSS](/packages/gjorgic-my-promisepay-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

\#PHP SDK - PromisePay API

[![Join the chat at https://gitter.im/PromisePay/promisepay-php](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/PromisePay/promisepay-php?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status](https://camo.githubusercontent.com/23b023b76b57c50918b0444629253cd4904b6c2d0e082f7be42fe7c734853d15/68747470733a2f2f7472617669732d63692e6f72672f50726f6d6973655061792f70726f6d6973657061792d7068702e737667)](https://travis-ci.org/PromisePay/promisepay-php) [![Latest Stable Version](https://camo.githubusercontent.com/6a9ada7353f627c971199d51ef93b60cc11c58e5fcde3164f004c47d27512916/68747470733a2f2f706f7365722e707567782e6f72672f70726f6d6973657061792f70726f6d6973657061792d7068702f762f737461626c65)](https://packagist.org/packages/promisepay/promisepay-php)[![Total Downloads](https://camo.githubusercontent.com/a9b6b72418c73d8bd7bd0084476e6419520f3041654150ca71946024044938d6/68747470733a2f2f706f7365722e707567782e6f72672f70726f6d6973657061792f70726f6d6973657061792d7068702f646f776e6c6f616473)](https://packagist.org/packages/promisepay/promisepay-php)[![Code Climate](https://camo.githubusercontent.com/e76e678dd94287d2ea1fa8cdec64bb67b9fe1f8d0b196dfdd39ae5c980cc1ff4/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f50726f6d6973655061792f70726f6d6973657061792d7068702f6261646765732f6770612e737667)](https://codeclimate.com/github/PromisePay/promisepay-php)

\#1. Installation

\###Composer

You can include this package via Composer.

```
{
  "require": {
    "promisepay/promisepay-php": "1.*"
  }
}
```

Install the package.

```
composer install

```

Require the package.

```
require init.php
```

\###Manual Installation Download the latest release from GitHub, then include the **init.php** file - see below.

```
require init.php
```

\#2. Configuration Before interacting with PromisePay API, you need to generate an API token. See [http://docs.promisepay.com/v2.2/docs/request\_token](http://docs.promisepay.com/v2.2/docs/request_token) for more information.

Once you have recorded your API token, configure the PHP package - see below.

Open the file **libs/promisepay-credentials.xml** and replace the existing credentials with the following:

```

   			https://test.api.promisepay.com/
   			user.name@yourdomain.com
   			Password
   			APIToken

```

\#3. Examples ##Tokens

##### Example 1 - Request session token

[](#example-1---request-session-token)

The below example shows the request for a marketplace configured to have the Item and User IDs generated automatically for them.

```
$repo = new TokenRepository();
$sessionToken = new Token($arr = array(
			   'current_user' 			=> 'seller',
           	   'item_name'				=> 'Test Item',
          		   'amount'					=> '2500',
           	   'seller_lastname' 		=> 'Seller',
           	   'seller_firstname'		=> 'Sally',
           	   'buyer_lastname'			=> 'Buyer',
           	   'buyer_firstname'		=> 'Bobby',
           	   'buyer_country'			=> 'AUS',
           	   'seller_country'			=> 'USA',
           	   'seller_email'			=> 'sally.seller@promisepay.com',
           	   'buyer_email'			=> 'bobby.buyer@promisepay.com',
           	   'fee_ids'				=> '',
           	   'payment_type_id'		=> '2'))
$repo->requestSessionToken($sessionToken)
```

\#####Example 2 - Request session token The below example shows the request for a marketplace that passes the Item and User IDs.

```
$repo = new TokenRepository();
$sessionToken = new Token($arr = array(
			   'current_user_id' 		=> 'seller1234',
           	   'item_name'				=> 'Test Item',
          		   'amount'					=> '2500',
           	   'seller_lastname' 		=> 'Seller',
           	   'seller_firstname'		=> 'Sally',
           	   'buyer_lastname'			=> 'Buyer',
           	   'buyer_firstname'		=> 'Bobby',
           	   'buyer_country'			=> 'AUS',
           	   'seller_country'			=> 'USA',
           	   'seller_email'			=> 'sally.seller@promisepay.com',
           	   'buyer_email'			=> 'bobby.buyer@promisepay.com',
           	   'external_item_id'		=> 'TestItemId1234',
           	   'external_seller_id'		=> 'seller1234',
           	   'external_buyer_id'		=> 'buyer1234',
           	   'fee_ids'				=> '',
           	   'payment_type_id'		=> '2'))
$repo->requestSessionToken($sessionToken)
```

\##Items

\#####Create an item

```
$repo = new ItemRepository();
$user = new Item($arr = array(
           'id'            => 'External_id',
           'name'          => 'Item Name',
           'amount'        => '2000',
           'payment_type'  => '1',
           'buyer_id'      => 'External_buyer_id',
           'seller_id'     => 'External_seller_id',
           'fee_ids'       => 'fee_id_1,fee_id_2',
           'description'   => 'Item Description'));
$repo->createItem($user)
```

\#####Get an item

```
$repo = new ItemRepository();
$item = $repo->getItemById('item_id');
```

\#####Get a list of items

```
$repo = new ItemRepository();
$listOfItems = $repo->getListOfItems;
```

\#####Update an item

```
$repo = new ItemRepository();
$item = new Item($arr = array(
           'id'            => 'External_id',
           'name'          => 'Item Name',
           'amount'        => '2000',
           'payment_type'  => '1',
           'buyer_id'      => 'External_buyer_id',
           'seller_id'     => 'External_seller_id',
           'fee_ids'       => 'fee_id_1,fee_id_2',
           'description'   => 'Item Description'));
$repo->updateItem($item, 'user', 'account', 'release_amount');
```

\#####Delete an item

```
$repo = new ItemRepository();
$repo->deleteItem('item_id');
```

\#####Get an item status

```
$repo = new ItemRepository();
$repo->getItemStatus('item_id');
```

\#####Get an item's buyer

```
$repo = new ItemRepository();
$buyer = $repo->getBuyerOfItem('item_id');
```

\#####Get an item's seller

```
$repo = new ItemRepository();
$seller = $repo->getSellerForItem('item_id');
```

\#####Get an item's fees

```
$repo = new ItemRepository();
$fees = $repo->getListFeesForItems('item_id');
```

\#####Get an item's transactions

```
$repo = new ItemRepository();
$transactions = $repo->getListOfTransactionsForItem('item_id');
```

\#####Get an item's wire details

```
$repo = new ItemRepository();
$wireDetails = $repo->getWireDetailsForItem('item_id');
```

\#####Get an item's BPAY details

```
$repo = new ItemRepository();
$bpayDetails = $repo->getBPayDetailsForItem('item_id');
```

\##Users

\#####Create a user

```
$repo = new UserRepository();
$user = new User($arr = array(
           'id'            => id,
           'first_name'    => 'First Name',
           'last_name'     => 'Last Name',
           'email'         => 'email'
           'mobile'        => 'mobile phone'
           'address_line1' => 'a line 1',
           'address_line2' => 'a line 2',
           'state'         => 'state',
           'city'          => 'city',
           'zip'           => '90210',
           'country'       => 'AUS'//country code,));
$repo->createUser($user)
```

\#####Get a user

```
$repo = new UserRepository();
$user = $repo->getUserById('User id');
```

\#####Get a list of users

```
$repo = new UserRepository();
$users = $repo->getListOfUsers();
```

\#####Delete a User

```
$repo = new UserRepository();
$repo->deleteUser('User_id');
```

\#####Get a user's card accounts

```
$repo = new UserRepository();
$usersCardAccounts = $repo->getListOfCardAccountsForUser('User_id');
```

\#####Get a user's PayPal accounts

```
$repo = new UserRepository();
$usersPayPalAccounts = $repo->getListOfPayPalAccountsForUser('User_id');
```

\#####Get a user's bank accounts

```
$repo = new UserRepository();
$usersBankAccounts = $repo->getListOfBankAccountsForUser('User_id');
```

\#####Get a user's items

```
$repo = new UserRepository();
$items = $repo->getListOfItemsForUser('User_id');
```

\#####Set a user's disbursement account

```
$repo = new UserRepository();
$repo->setDisbursementAccount('user_id', 'account_id');
```

\##Item Actions

\#####Make payment

```
$repo = new ItemRepository();
$repo->makePayment('External_item_id', 'Card_account_id', 'User_id')
```

\#####Request payment

```
$repo = new ItemRepository();
$requestPayment = $repo->requestPayment('Item_id', 'Seller_id');
```

\#####Release payment

```
$repo = new ItemRepository();
$releasePayment = $repo->releasePayment('Item_id', 'buyer_id', 'Release amount');
```

\#####Request release

```
$repo = new ItemRepository();
$requestRelease = $repo->requestRelease('Item_id', 'Seller_id', 'Release amount');
```

\#####Cancel

```
$repo = new ItemRepository();
$repo->cancelItem('Item_id');
```

\#####Acknowledge wire

```
$repo = new ItemRepository();
$acknowledgeWire = $repo->acknowledgeWire('Item_id', 'Buyer_id');
```

\#####Acknowledge PayPal

```
$repo = new ItemRepository();
$acknowledgePayPal = $repo->acknowledgePayPal('Item_id', 'Buyer_id');
```

\#####Revert wire

```
$repo = new ItemRepository();
$repo->revertWire('Item_id', 'Buyer_id');
```

\#####Request refund

```
$repo = new ItemRepository();
$repo->requestRefund('Item_id',  'Buyer_id',  'Refund amount',  'Refund message');
```

\#####Refund

```
$repo = new ItemRepository();
$repo = refund( 'Item id',  'Seller id',  'Refund Amount',  'Refund message')
```

\##Card Accounts #####Create a card account

```
$repo = new CardAccountRepository();
$user = new CardAccount($arr = array(
           'user_id'       => id,
           'full_name'     => 'Bobby Buyer',
           'number'        => '4111111111111111',
           'expiry_month'  => '06'
           'expiry_year'   => '2016'
           'cvv' 			=> '123'));
$repo->createCardAccount($user)
```

\#####Get a card account

```
$repo = new CardAccountRepository();
$card = $repo->getCardAccountById('Account_id')
```

\#####Delete a card account

```
$repo = new CardAccountRepository();
$repo->deleteCardAccount('Account_id')
```

\#####Get a card account's users

```
$repo = new CardAccountRepository();
$users = $repo->getUserForCardAccount('Card Account');
```

\##Bank Accounts #####Create a bank account

```
$repo = new BankAccountRepository();
$bankAccount = new BankAccount($arr = array(
			   'user_id' 			=> 'External_seller_id',
           	   'bank_name'			=> 'Test Bank',
          	   'account_name'		=> 'Sally Seller',
           	   'routing_number' 	=> '123456',
           	   'account_number'		=> '12345678',
           	   'account_type'		=> 'checking',
           	   'holder_type'		=> 'personal',
           	   'bank_country'		=> 'AUS'))
$repo->createBankAccount($bankAccount)
```

\#####Get a bank account

```
$repo = new BankAccountRepository();
$bankAccount = $repo->getBankAccountById('Account_id');
```

\#####Delete a bank account

```
$repo = new BankAccountRepository();
$repo->deleteBankAccount('Account_id');
```

\#####Get a bank account's users

```
$repo = new BankAccountRepository();
$user = $repo->getUserForBankAccount('Account_id');
```

\##PayPal Accounts #####Create a PayPal account

```
$repo  = new PayPalAccountRepository();
$params  = array(
    'user_id'=> 'User id',
    'active'=>'true',
    'paypal'=>array(
        'email'=>'User email'
        )
    );
$ppalAccount = new PayPalAccount($params);
$repo->createPayPalAccount($ppalAccount);
```

\#####Get a PayPal account

```
$repo = new PayPalAccountRepository();
$paypalAccount = $repo->getPayPalAccountById('account_id');
```

\#####Delete a PayPal account

```
$repo = new PayPalAccountRepository();
$repo->deletePayPalAccount('Account id')
```

\#####Get a PayPal account's users

```
$repo = new PayPalAccountRepository();
$users = $repo->getUserForPayPalAccount('Account id')
```

\##Fees #####Get a list of fees

```
$repo = new FeeRepository();
$fees = $repo->getListOfFees();
```

\#####Get a fee

```
$repo = new FeeRepository();
$fee = $repo->getFeeById('Fee id');
```

\#####Create a fee

```
$enum = new FeeType();
$repo = new FeeRepository();
$data = array(
    'id'=>'fee id',
    'amount'=>1000,
    'name'=>'fee name',
    'fee_type'=>$enum->Fixed,
    'cap'=>'1',
    'max'=>'3',
    'min'=>'2',
    'to'=>'buyer'
    );
$fee = new Fee($data);
$repo->createFee($fee);
```

\##Transactions #####Get a list of transactions

```
$repo = new TransactionRepository();
$trans = $repo->getListOfTransactions();
```

\#####Get a transaction

```
$repo = new TransactionRepository();
$transaction = $repo->getTransaction('transaction_id');
```

\#####Get a transaction's users

```
$repo = new TransactionRepository();
$users = $repo->getUserForTransaction('transaction id');
```

\#####Get a transaction's fees

```
$repo = new TransactionRepository();
$fees = $repo->getFeeForTransaction('transaction id');
```

\#4. Contributing 1. Fork it (  ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 65.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3842488?v=4)[Goran J](/maintainers/gjorgic)[@gjorgic](https://github.com/gjorgic)

---

Top Contributors

[![MVmironov](https://avatars.githubusercontent.com/u/12662244?v=4)](https://github.com/MVmironov "MVmironov (28 commits)")[![gjorgic](https://avatars.githubusercontent.com/u/3842488?v=4)](https://github.com/gjorgic "gjorgic (14 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

### Embed Badge

![Health badge](/badges/gjorgic-my-promisepay-php/health.svg)

```
[![Health](https://phpackages.com/badges/gjorgic-my-promisepay-php/health.svg)](https://phpackages.com/packages/gjorgic-my-promisepay-php)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
