PHPackages                             intasend/intasend-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. [Payment Processing](/categories/payments)
4. /
5. intasend/intasend-php

ActiveLibrary[Payment Processing](/categories/payments)

intasend/intasend-php
=====================

The official PHP SDK for IntaSend Payment Gateway

v1.1.1(1y ago)610.0k↓10.8%6MITPHPPHP &gt;=7.0

Since Jul 23Pushed 1y ago2 watchersCompare

[ Source](https://github.com/IntaSend/intasend-php)[ Packagist](https://packagist.org/packages/intasend/intasend-php)[ RSS](/packages/intasend-intasend-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (12)Used By (0)

IntaSend Payments Gateway - PHP SDK
===================================

[](#intasend-payments-gateway---php-sdk)

[![Codacy Badge](https://camo.githubusercontent.com/f66bc1888cb443ca4143fe83646d3a0b10941ff089341f6ef35bac2a44078c1b/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3137303663343832666461313435386239376635626135306630353636613362)](https://app.codacy.com/gh/IntaSend/intasend-php?utm_source=github.com&utm_medium=referral&utm_content=IntaSend/intasend-php&utm_campaign=Badge_Grade_Settings)

Official documentation
----------------------

[](#official-documentation)

PHP SDK for [IntaSend Payment Gateway](https://intasend.com). IntaSend enables you to easily add payments to your application with a few lines of code.

Follow the instruction below to install and get started.

Visit our [sandbox/developers](https://sandbox.intasend.com) test for your API Keys.

Checkout our [API documentation](https://developers.intasend.com/) for more details and for payload references.

How to install
--------------

[](#how-to-install)

```
composer require intasend/intasend-php

```

How to authenticate
-------------------

[](#how-to-authenticate)

IntaSend-php supports various IntaSend's payment features. Below are the credentials needed for authentication.

**token** - Is the API token and is required for status checks, chargeback request, send money, and wallet services. **publishable\_key** - Also know as the public key is required during payment collections/checkout only.

### How to pass your credentials

[](#how-to-pass-your-credentials)

Add your credentials from the `.env` (recommended) in an array and include it in your requests. Example:

```
$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$checkout = new Checkout();
$checkout->init($credentials);

```

How to receive payments using Checkout URL
------------------------------------------

[](#how-to-receive-payments-using-checkout-url)

With IntaSend, you can generate a secure checkout page where you redirect your users to complete payments.

Below is a basic example on how to set up. Check full example in your [Laravel playground](examples/laravel-setup/).

```
use IntaSend\IntaSendPHP\Checkout;
use IntaSend\IntaSendPHP\Customer;

$credentials = [
'publishable_key' =>  env('INTASEND_PUBLISHABLE_KEY'),
'test' =>  env('INTASEND_TEST_ENVIRONMENT', true),
];

$customer = new Customer();
$customer->first_name = "Joe";
$customer->last_name = "Doe";
$customer->email = "joe@doe.com";
$customer->country = "KE";

$amount = 10;
$currency = "KES";

// Add your website and redirect url where the user will be redirected on success
$host = "https://example.com";
$redirect_url = "https://example.com/callback";
$ref_order_number = "test-order-10";

$checkout = new Checkout();
$checkout->init($credentials);
$resp = $checkout->create($amount = $amount, $currency = $currency, $customer = $customer, $host=$host, $redirect_url = $redirect_url, $api_ref = $ref_order_number, $comment = null, $method = null);

// Redirect the user to the URL to complete payment
print_r($resp->url);

```

Send M-Pesa STK-Push
--------------------

[](#send-m-pesa-stk-push)

Checkout API generates a URL that enables you to do M-Pesa collection and other payment methods. In case you want to leverage only the M-Pesa STK-Push option, you might want to consider this the `collection->mpesa_stk_push()` option.

```
use IntaSend\IntaSendPHP\Collection;
$credentials = [
'publishable_key' =>  env('INTASEND_PUBLISHABLE_KEY'),
'test' =>  env('INTASEND_TEST_ENVIRONMENT', true),
];

$collection = new Collection();
$collection->init($credentials);

$response = $collection->create($amount=10, $phone_number="2547...", $currency="KES", $method="MPESA_STK_PUSH", $api_ref="Your API Ref", $name="", $email="john@example.com");
print_r($response);

```

How to create Payment links
---------------------------

[](#how-to-create-payment-links)

Payment links are free forms that you can share with your customers on email and social media. Unlike Checkout URL, payment links do not required/include customer details when creating them. The customer is expected to put all the details required.

### Create a payment link

[](#create-a-payment-link)

```
use IntaSend\IntaSendPHP\PaymentLink;

$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$paymentLink = new PaymentLink();
$paymentLink->init($credentials);

$title = "Service 1";
$currency = "KES";
$amount = 100;

# Specify who should take care of the charges. Set to BUSINESS_PAYS for business to handle.

$mobile_tarrif =  "CUSTOMER_PAYS";
$card_tarrif =  "CUSTOMER_PAYS";
$is_active = "true";

$response = $paymentLink->create($title, $currency, $amount, $mobile_tarrif, $card_tarrif, $is_active);
print_r($response);

```

### List or retrive details of payment links by ID

[](#list-or-retrive-details-of-payment-links-by-id)

```
$response = $paymentLink->retrieve()
print_r($response);

$link_id = "AKSL1O1";
$response = $paymentLink->details($link_id);
print_r($response);

```

How to Send Money to M-Pesa B2C
-------------------------------

[](#how-to-send-money-to-m-pesa-b2c)

```
use IntaSend\IntaSendPHP\Transfer;

$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$transactions = [
    ['account'=>'254723890353','amount'=>'20'],
    ['account'=>'254723890260','amount'=>'15']
];

$transfer = new Transfer();
$transfer->init($credentials);

$response=$transfer->mpesa("KES", $transactions);

//call approve method for approving last transaction
$response = $transfer->approve($response);
print_r($response);

// How to check or track the transfer status
$response = $transfer->status($response->tracking_id);
print_r($response);

```

How to Send Money to M-Pesa PayBill
-----------------------------------

[](#how-to-send-money-to-m-pesa-paybill)

To send money to M-Pesa PayBills, specify business number under account and an account reference as shown below.

```
use IntaSend\IntaSendPHP\Transfer;

$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$transactions = [
    ['account'=>'247247', 'account_type'=>'PayBill', 'account_reference'=>'1001200010',  'amount'=>'2000', 'narrative'=>'Trip']
];

$transfer = new Transfer();
$transfer->init($credentials);

$response=$transfer->mpesa("KES", $transactions);

//call approve method for approving last transaction
$response = $transfer->approve($response);
print_r($response);

```

How to Send Money to M-Pesa Till Number or PayBill
--------------------------------------------------

[](#how-to-send-money-to-m-pesa-till-number-or-paybill)

To send money to Till Numbers, simply specify the account number. No account reference is requred.

```
use IntaSend\IntaSendPHP\Transfer;

$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$transactions = [
    ['name' => 'Business A','account'=>'524311','amount'=>'200', 'account_type'=>'PayBill', 'account_reference'=>'29822182', 'narrative'=> 'Bill Payment'],
    ['name' => 'Business B','account'=>'17626','amount'=>'150', 'account_type'=>'TillNumber', 'narrative'=> 'Purchase']
];

$transfer = new Transfer();
$transfer->init($credentials);

$response=$transfer->mpesa_b2b("KES", $transactions);

//call approve method for approving last transaction
$response = $transfer->approve($response);
print_r($response);

```

How to Send to Bank
-------------------

[](#how-to-send-to-bank)

You'll need a bank code and account numbers to send bank payments. Here is a [list of bank codes](https://developers.intasend.com/docs/bank#list-of-bank-codes) for your reference

```
use IntaSend\IntaSendPHP\Transfer;

$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$transactions = [
    ['name' => 'Joe Doe','account'=>'0129292920202','amount'=>'200', 'bank_code'=>'2', 'narrative'=> 'Bill Payment'],
    ['name' => 'Mary Doe','account'=>'525623632321','amount'=>'150', 'bank_code'=>'11', 'narrative'=> 'Purchase']
];

$transfer = new Transfer();
$transfer->init($credentials);

$response=$transfer->bank("KES", $transactions);

//call approve method for approving last transaction
$response = $transfer->approve($response);
print_r($response);

```

How to Send Airtime
-------------------

[](#how-to-send-airtime)

```
use IntaSend\IntaSendPHP\Transfer;

$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$transactions = [
    ['account'=>'254723890353','amount'=>'20', 'narrative'=>'Airtime'],
    ['account'=>'254723890260','amount'=>'15', 'narrative'=>'Airtime']
];

$transfer = new Transfer();
$transfer->init($credentials);

$response=$transfer->airtime("KES", $transactions);

//call approve method for approving last transaction
$response = $transfer->approve($response);
print_r($response);

```

Working with Wallets
--------------------

[](#working-with-wallets)

Example on how to create a new wallet, list wallets and other details

### Create a new wallet

[](#create-a-new-wallet)

```
use IntaSend\IntaSendPHP\Wallet;

$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$wallet = new Wallet();
$wallet->init($credentials);

$response = $wallet->create($currency='KES', $label='MY-WALLET-ID', $can_disburse=true);
print_r($response);

```

### List all wallets in your account

[](#list-all-wallets-in-your-account)

```
$response = $wallet->retrieve();
print_r($response);

```

### View wallet details and its transactions

[](#view-wallet-details-and-its-transactions)

```
$response = $wallet->transactions('');
print_r($response);

$response = $wallet->transactions($wallet_id);
print_r($response);

```

### Direct deposit to wallet using M-Pesa STK Push

[](#direct-deposit-to-wallet-using-m-pesa-stk-push)

```
$response = $wallet->fund_mpesa_stk_push($wallet_id="", $phone_number='2547...',$email='john@doe.com', $amount=10, $api_ref="API Request");
print_r($response);

```

### Direct deposit to wallet with Checkout Method

[](#direct-deposit-to-wallet-with-checkout-method)

```
use IntaSend\IntaSendPHP\Customer;

$customer = new Customer();
$customer->first_name = "Joe";
$customer->last_name = "Doe";
$customer->email = "joe@doe.com";
$customer->country = "KE";

$host = "https://example.com";
$redirect_url = "https://example.com";

$ref_order_number = "fund-wallet-10";

$response = $wallet->fund_checkout($wallet_id="", $phone_number='2547..', $currency='USD', $customer=$customer, $amount=10, $host=$host, $redirect_url=$redirect_url, $api_ref=$ref_order_number, $card_tarrif = "BUSINESS-PAYS", $mobile_tarrif = "BUSINESS-PAYS");
print_r($response->url);

```

### Wallet to wallet transfers (Intra-transfer)

[](#wallet-to-wallet-transfers-intra-transfer)

Transfer funds between wallets in your account

```
$origin_wallet_id = "ABSKC10";
$destination_wallet_id = "DDS0911";
$amount = 100;
$narrative = "Commission deduction";

$response = $wallet->intra_transfer($origin_wallet_id, $destination_wallet_id, $amount, $narrative);
print_r($response);

```

### External Wallet Transfer to M-PESA

[](#external-wallet-transfer-to-m-pesa)

```
use IntaSend\IntaSendPHP\Transfer;

$transactions = [
            ['account'=>'254...','amount'=>'20'],
            ['account'=>'254...','amount'=>'15']
        ];

$response=$transfer->mpesa("KES", $transactions=$transactions, $callback_url=null,  $wallet_id='');
print_r($response);

Like all other Send Money APIs, the above request is also a two step. Please go through the send money examples on full implementation for M-Pesa B2C, M-Pesa B2B, Bank Payouts and IntaSend P2P.

```

Chargebacks Management
----------------------

[](#chargebacks-management)

Examples on how to process refunds using the API

### Raise new refund request

[](#raise-new-refund-request)

```
use IntaSend\IntaSendPHP\Chagebacks;

$credentials = [
    'token'=>'',
    'publishable_key'=>''
];

$chagebacks = new Chagebacks();
$hagebacks->init($credentials);

$invoice_id = "INVOS012";
$amount = 100;
$reason = "Delayed delivery";

$response = $chagebacks->create($invoice_id, $amount, $reason);
print_r($response);

```

### Retrieve list of refunds/chargebacks in your account

[](#retrieve-list-of-refundschargebacks-in-your-account)

```
$response = $chagebacks->retrieve();
print_r($response);

```

### Get details of a chargeback/refund request

[](#get-details-of-a-chargebackrefund-request)

```
$chagebacks_id = "CHSK102";

$response = $chagebacks->details($chagebacks_id);
print_r($response);

```

Documentation and Resources
---------------------------

[](#documentation-and-resources)

1. [Developers Documentation](https://developers.intasend.com)
2. [Test and sandbox environment](https://sandbox.intasend.com)
3. [Support](https://support.intasend.com)
4. [Telegram](https://t.me/joinchat/2vIT1nrYvkc0MWQ0)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.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.

###  Release Activity

Cadence

Every ~130 days

Recently: every ~200 days

Total

9

Last Release

719d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c5e27c3e9034a981463225bbdb8138ede5cef55f4991b5e5da855658cbedec8f?d=identicon)[intasend-devs](/maintainers/intasend-devs)

---

Top Contributors

[![felixcheruiyot](https://avatars.githubusercontent.com/u/1054590?v=4)](https://github.com/felixcheruiyot "felixcheruiyot (32 commits)")[![mugendi-gitonga](https://avatars.githubusercontent.com/u/89004329?v=4)](https://github.com/mugendi-gitonga "mugendi-gitonga (10 commits)")[![kishanmnpatel](https://avatars.githubusercontent.com/u/85978294?v=4)](https://github.com/kishanmnpatel "kishanmnpatel (3 commits)")[![AlmeidaManzolo](https://avatars.githubusercontent.com/u/83277755?v=4)](https://github.com/AlmeidaManzolo "AlmeidaManzolo (1 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")

### Embed Badge

![Health badge](/badges/intasend-intasend-php/health.svg)

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

###  Alternatives

[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

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