PHP code example of orcarail / orcarail-php

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

    

orcarail / orcarail-php example snippets


use OrcaRail\OrcaRailClient;

$orcarail = new OrcaRailClient([
    'api_key' => 'pk_live_...',
    'api_secret' => 'sk_live_...',
]);

$intent = $orcarail->paymentIntents->create([
    'price_id' => 'price_...',
    'return_url' => 'https://example.com/return',
]);

echo $intent->id;

$event = \OrcaRail\Webhook::constructEvent(
    file_get_contents('php://input'),
    $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '',
    'sk_live_...',
);
bash
composer