1. Go to this page and download the library: Download origami/stripe 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/ */
// Make a Payment from a payment_intent ID.
$payment = Origami\Stripe\Payment::find($id);
// Or create a Payment as a new payment_intent
$payment = Origami\Stripe\Payment::create([
'amount' => 1000,
'currency' => 'gbp',
'payment_method' => $method,
'capture_method' => 'manual',
'payment_method_types' => ['card'],
'confirmation_method' => 'manual',
'confirm' => true,
]));
$payment->amount();
public function hasStatus($status)
$payment->hasStatus(['
$payment->>isCancelled();
$payment->isSucceeded();
$payment->isSuccessful(); // Alias for above
try {
$payment = Origami\Stripe\Payment::create([
'amount' => 1000,
'currency' => 'gbp',
'payment_method' => $method,
'capture_method' => 'manual',
'payment_method_types' => ['card'],
'confirmation_method' => 'manual',
'confirm' => true,
]));
if (!$payment) {
throw new Exception('Error fetching Stripe payment');
}
$payment->validate();
// PaymentIntent is valid
// capture_method: manual above means we need to capture in another controller
// capture_method: automatic above means the payment was successully taken
return response([
'payment_intent_id' => $payment->id,
'success' => true,
]);
} catch (Origami\Stripe\PaymentActionRequired $e) {
// Action is
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.