PHP code example of doskyft / helloasso-php

1. Go to this page and download the library: Download doskyft/helloasso-php 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/ */

    

doskyft / helloasso-php example snippets


use Helloasso\HelloassoClientFactory;

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

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);

$helloassoClient->order->cancel($orderId);

use Helloasso\Models\Event;

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