AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

PaymentGateway.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Commerce\Payments;
  3. use App\Models\Order;
  4. /**
  5. * The one interface the app uses to take payments.
  6. * Stripe is the first provider. Another provider only needs a class that implements this.
  7. */
  8. interface PaymentGateway
  9. {
  10. /** The name saved on the order, such as "stripe". */
  11. public function name(): string;
  12. /**
  13. * Create a payment page for the order and say where to send the shopper.
  14. *
  15. * @throws PaymentException
  16. */
  17. public function startCheckout(Order $order, string $successUrl, string $cancelUrl): CheckoutLink;
  18. /**
  19. * Ask the provider about a payment page we created earlier.
  20. *
  21. * @throws PaymentException
  22. */
  23. public function checkPayment(string $checkoutId): PaymentStatus;
  24. /**
  25. * Read a message the provider sent to our webhook address.
  26. * Returns null when the message is about something we do not handle.
  27. *
  28. * @throws PaymentException When the message is not genuine.
  29. */
  30. public function readWebhook(string $payload, string $signature): ?PaymentStatus;
  31. }