PHP code example of whilesmart / eloquent-payments
1. Go to this page and download the library: Download whilesmart/eloquent-payments 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/ */
whilesmart / eloquent-payments example snippets
use Whilesmart\Payments\Contracts\Payable;
use Whilesmart\Payments\Traits\HasPayments;
class Invoice extends Model implements Payable
{
use HasPayments;
}
$invoice->recordPayment([
'amount_cents' => 50000,
'currency' => 'USD',
'status' => 'succeeded',
'method' => 'card',
'gateway' => 'stripe',
'gateway_reference' => 'ch_123...',
'succeeded_at' => now(),
]);
// Effect:
// invoice.amount_paid_cents += 50000 (or rather, set to sum of succeeded payments)
// invoice.paid_at = now() if cumulative >= total_cents