doskyft/helloasso-php

Helloasso PHP Library

v1.1.3 2024-03-29 13:14 UTC

This package is auto-updated.

Last update: 2024-04-11 19:23:49 UTC


README

Un sdk pour utiliser l'api d'helloasso

Installation

composer require doskyft/helloasso-php

Utilisation

Pour commencer, il faut créer une instance de HelloassoClient.

use Helloasso\HelloassoClientFactory;

$helloassoClient = HelloassoClientFactory::create(
    'hello_asso_id',
    'hello_asso_secret',
    'hello_asso_organization_slug',
    true # sandbox
);

Maintenant, on peut commencer à utiliser le client

CheckoutIntent

Créer un CheckoutIntent
use Helloasso\Models\Carts\CheckoutPayer;
use Helloasso\Models\Carts\InitCheckoutBody;

$checkoutIntent = (new InitCheckoutBody())
    ->setTotalAmount(1000)
    ->setInitialAmount(1000)
    ->setItemName('Un produit')
    ->setBackUrl('https://localhost/back')
    ->setErrorUrl('https://localhost/error')
    ->setReturnUrl('https://localhost/return')
    ->setPayer((new CheckoutPayer())
        ->setFirstName()
        ->setLastName()
        ->setEmail()
    )
    ->setMetadata([
        '' => '',
    ])
;

$helloassoClient->checkout->create($checkoutIntent);

Voir la documentation

Évènements

use Helloasso\Models\Event;

$event = $helloassoClient->decodeEvent($rawEventReceivedFromHelloasso); // Returns an instance of Event

Contribuer

Ce projet inclut des tests fonctionnels qui nécessitent un accès à la sandbox d'Helloasso.

Pour lancer les tests :

HELLOASSO_CLIENT_ID=[YourClientId] HELLOASSO_CLIENT_SECRET=[YourClientSecret] HELLOASSO_ORGANISATION_SLUG=[YourOrganisation] vendor/bin/phpunit

Contributeurs

Damien Hebert
Damien Hebert
Olivier Dolbeau
Olivier Dolbeau