PHP code example of rentercheck / rentercheck-php

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

    

rentercheck / rentercheck-php example snippets


// .env
// RENTERCHECK_API_KEY=rc_test_...

use RenterCheck\Laravel\Facades\RenterCheck;

$result = RenterCheck::bookings()->save([
    'bookingId' => (string) $booking->id,
    'renter' => ['fullName' => $booking->renter_name, 'phone' => $booking->renter_phone, 'email' => $booking->renter_email],
    'status' => $booking->status,          // your own words work: confirmed, returned, canceled...
    'startsAt' => $booking->starts_at->toIso8601String(),
    'endsAt' => $booking->ends_at?->toIso8601String(),
    'amount' => (float) $booking->total,
    'renterConsent' => true,
]);

$booking->update(['rentercheck' => $result['renter']]);



use RenterCheck\Badge;
use RenterCheck\RenterCheck;
use RenterCheck\RenterCheckException;

$rentercheck = new RenterCheck(getenv('RENTERCHECK_API_KEY'));

try {
    $result = $rentercheck->bookings->save([
        'bookingId' => 'BK-1042',
        'renter' => ['fullName' => 'Maria Santos', 'phone' => '0917 555 0142'],
        'status' => 'confirmed',
        'startsAt' => '2026-11-08',
        'renterConsent' => true,
    ]);
    echo Badge::html($result['renter']);
} catch (RenterCheckException $e) {
    // $e->status, $e->errorCode, $e->details, $e->isRetryable()
}
sh
composer test # unit tests, no dependencies
RENTERCHECK_TEST_KEY=rc_test_... php tests/integration.php