1. Go to this page and download the library: Download utopia-php/pay 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/ */
utopia-php / pay example snippets
use Utopia\Pay\Adapter\Stripe;
use Utopia\Pay\Adapter\Stripe\Currency;
$pay = new Stripe('SECRET_KEY', currency: Currency::USD);
$customer = $pay->createCustomer('Customer One', '[email protected]');
$purchase = $pay->purchase(5000, $customer->id, $paymentMethodId);
use Utopia\Pay\Payment\Options;
use Utopia\Pay\Payment\Status;
$payment = $pay->purchase(5000, $customer->id, $paymentMethodId,
new Options(offSession: false, confirm: false, metadata: ['invoiceId' => 'invoice_1']));
if ($payment->status === Status::RequiresConfirmation) {
$clientSecret = $payment->clientSecret;
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.