| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
-
- namespace App\Commerce\Payments;
-
- use App\Models\Order;
-
- /**
- * The one interface the app uses to take payments.
- * Stripe is the first provider. Another provider only needs a class that implements this.
- */
- interface PaymentGateway
- {
- /** The name saved on the order, such as "stripe". */
- public function name(): string;
-
- /**
- * Create a payment page for the order and say where to send the shopper.
- *
- * @throws PaymentException
- */
- public function startCheckout(Order $order, string $successUrl, string $cancelUrl): CheckoutLink;
-
- /**
- * Ask the provider about a payment page we created earlier.
- *
- * @throws PaymentException
- */
- public function checkPayment(string $checkoutId): PaymentStatus;
-
- /**
- * Read a message the provider sent to our webhook address.
- * Returns null when the message is about something we do not handle.
- *
- * @throws PaymentException When the message is not genuine.
- */
- public function readWebhook(string $payload, string $signature): ?PaymentStatus;
- }
|