PHPackages                             sfolador/heidipay-saloon - 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. sfolador/heidipay-saloon

ActiveLibrary[API Development](/categories/api)

sfolador/heidipay-saloon
========================

Integrate HeidiPay API in PHP with Saloon

1.1(3y ago)278[2 PRs](https://github.com/sfolador/heidipay-saloon/pulls)1MITPHPPHP ^8.1

Since Apr 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sfolador/heidipay-saloon)[ Packagist](https://packagist.org/packages/sfolador/heidipay-saloon)[ RSS](/packages/sfolador-heidipay-saloon/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (5)Used By (1)

[![](https://camo.githubusercontent.com/218954276d261393f0a1e555ea8d776e3e070ebcf6d9a9d056632a2baa56181e/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f48656964695061792532302d25323053616c6f6f6e2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d73666f6c61646f7225324668656964697061792d73616c6f6f6e267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d496e746567726174652b796f75722b6170706c69636174696f6e2b776974682b48656964695061792b7573696e672b53616c6f6f6e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d73686f7070696e672d63617274)](https://camo.githubusercontent.com/218954276d261393f0a1e555ea8d776e3e070ebcf6d9a9d056632a2baa56181e/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f48656964695061792532302d25323053616c6f6f6e2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d73666f6c61646f7225324668656964697061792d73616c6f6f6e267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d496e746567726174652b796f75722b6170706c69636174696f6e2b776974682b48656964695061792b7573696e672b53616c6f6f6e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d73686f7070696e672d63617274)

[![Latest Version on Packagist](https://camo.githubusercontent.com/94ad1fb3799a8b40924f61608d2705732c2d29e65cb79eb29cdb654c16cd2221/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73666f6c61646f722f68656964697061792d73616c6f6f6e3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sfolador/heidipay-saloon)[![GitHub Tests Action Status](https://camo.githubusercontent.com/575075ea7b368fc71ed68f2b763deaf1e7833e566a8ad41117ad9703f82df85d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73666f6c61646f722f68656964697061792d73616c6f6f6e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/sfolador/heidipay-saloon/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f76d332bf9fad470e17d31f5bd6bbe4183956c0b0bec1ceb7a88335dd51d210e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73666f6c61646f722f68656964697061792d73616c6f6f6e2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/sfolador/heidipay-saloon/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/eeb85d26d9f1eb6d29a34d382ab6cbf35367f100fc8d5db0a9434d793a66f455/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73666f6c61646f722f68656964697061792d73616c6f6f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sfolador/heidipay-saloon)

Integrate your application with HeidiPay API using Saloon
=========================================================

[](#integrate-your-application-with-heidipay-api-using-saloon)

This package provides a simple way to integrate your application with the [HeidiPay API](https://heidipay.com).

```
use Sfolador\HeidiPaySaloon\Services\HeidiPay;
use Sfolador\HeidiPaySaloon\Dto\AuthDto;

$apiUrl = 'https://api.heidipay.com';

$heidipay = new HeidiPay(apiUrl: $apiUrl);

$authDto = AuthDto::from(merchantKey: "merchant-key");
$heidipay->auth($authDto);

//The next requests will use the token returned by the `auth` API

$contractResponse = $heidipay->contract($contractInitDto);

// the response is a `Response` object, you can get the DTO using the `dtoOrFail` method
$contractResponseDto = $contractResponse->dtoOrFail();
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require sfolador/heidipay-saloon
```

Usage
-----

[](#usage)

### Auth

[](#auth)

Before calling any of the API endpoint it is necessary to authenticate with the HeidiPay API and obtain a token. Please read the official documentation at [HeidiPay API](https://docs.heidipay.com/reference/getting-started-with-your-api) for more information.

```
use Sfolador\HeidiPaySaloon\Services\HeidiPay;
use Sfolador\HeidiPaySaloon\Dto\AuthDto;

$apiUrl = 'https://sandbox-origination.heidipay.com';

//for production use $apiUrl = 'https://api.heidipay.com';

$heidipay = HeidiPay::init(apiUrl: $apiUrl);

$authDto = AuthDto::from(merchantKey: "merchant-key"); // the merchant key is provided by HeidiPay
$token = $heidipay->auth($authDto);
```

### Contract init

[](#contract-init)

Initialize a new contract for a user. Please read the official documentation at [HeidiPay API](https://docs.heidipay.com/reference/getting-started-with-your-api) for more information.

```
use Sfolador\HeidiPaySaloon\Services\HeidiPay;
use Sfolador\HeidiPaySaloon\Models\Amount;
use Sfolador\HeidiPaySaloon\Models\Customer;
use Sfolador\HeidiPaySaloon\Models\Webhooks;
use Sfolador\HeidiPaySaloon\Models\CreditInitProduct;
use Sfolador\HeidiPaySaloon\Dto\ContractInitDto;

$heidipay = HeidiPay::init(apiUrl: $apiUrl);

 $amount = new Amount( currency: 'BRL',amount: 100, amountFormat: AmountFormat::DECIMAL);
 $customer = new Customer(
        email: 'customer@example.com', title: '', firstname: 'Test', lastname: 'Test', dateOfBirth: '', contactNumber: '', companyName: '', residence: ''
 );

$webhooks = new Webhooks(
    success: 'https://www.example.com/success',
    failure: 'https://www.example.com/failure',
    cancel: 'https://www.example.com/cancel',
    status: 'https://www.example.com/status',
    mappingScheme: 'default'
);

// remember to set a token for the webhooks and save it in your database to verify the webhooks later
    $webhooks->setToken(str()->random(32));

$products = [new CreditInitProduct(
    sku: null,
    name: 'Test',
    quantity: 1,
    price: '100',
    imageThumbnailUrl: null,
    imageOriginalUrl: null,
    description: null
)];

$contractInitDto = new ContractInitDto($amount, $customer, $webhooks, $products);

$contractResponse = $heidipay->contract($contractInitDto);

// the response is a `Response` object, you can get the DTO using the `dtoOrFail` method
$contractResponseDto = $contractResponse->dtoOrFail();

// $contractResponseDto will be a ContractDto object and have these properties:

$contractResponseDto->action;
$contractResponseDto->redirectUrl; // the url to redirect the user to complete the contract
$contractResponseDto->external_contract_uuid // the contract uuid
$contractResponseDto->application_uuid // the application uuid
```

Credits
-------

[](#credits)

- [sfolador](https://github.com/sfolador)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.5% 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 ~29 days

Total

2

Last Release

1095d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54c6b8884e3bd4e86d26de024ca07094728adc7db2a8a483538222121b00f9f1?d=identicon)[sfolador](/maintainers/sfolador)

---

Top Contributors

[![sfolador](https://avatars.githubusercontent.com/u/36632?v=4)](https://github.com/sfolador "sfolador (16 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

apiheidipaysaloonsaloonsfoladorheidipay

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sfolador-heidipay-saloon/health.svg)

```
[![Health](https://phpackages.com/badges/sfolador-heidipay-saloon/health.svg)](https://phpackages.com/packages/sfolador-heidipay-saloon)
```

###  Alternatives

[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M468](/packages/saloonphp-saloon)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

765.7M125](/packages/saloonphp-laravel-plugin)[marceloeatworld/falai-php

Professional PHP client for the fal.ai serverless AI platform

105.5k](/packages/marceloeatworld-falai-php)

PHPackages © 2026

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