PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 2.2.0
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v2.2.0
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / interfaces / gateway-adapter-interface.php

gateway-adapter-interface.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 2.2.0, at includes/interfaces/gateway-adapter-interface.php

43 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * GatewayAdapter — single contract for client-side payment-intent creation.
4 *
5 * Each payment gateway (Stripe, PayPal, Square, Razorpay, …) optionally
6 * implements this interface so both the traditional /checkout/ page (vanilla JS)
7 * and the embedded React checkout can share one REST endpoint
8 * (`POST /storeengine/v1/checkout/payment-intent/{gateway_id}`) for
9 * pre-confirmation client-side flows (Stripe PaymentIntents, PayPal order
10 * creation, etc.).
11 *
12 * For gateways that don't need a client-confirmation step (offline / COD),
13 * implementing this interface is unnecessary — the place_order endpoint runs
14 * gateway->process_payment() directly.
15 *
16 * @since 1.8.2
17 */
18
19 namespace StoreEngine\Interfaces;
20
21 use StoreEngine\Classes\Cart;
22 use StoreEngine\Classes\Order;
23 use WP_Error;
24
25 if ( ! defined( 'ABSPATH' ) ) {
26 exit;
27 }
28
29 interface GatewayAdapterInterface {
30
31 /**
32 * Create the gateway's client-side intent for the given order.
33 *
34 * @return array|WP_Error Normalised payload the React adapter / vanilla-JS client
35 * understands. Common keys (any may be omitted):
36 * - client_secret string Stripe/Square style.
37 * - intent_id string PaymentIntent / Order id.
38 * - redirect_url string Hosted-page redirect (PayPal redirect flow, etc.).
39 * - requires_action array Gateway-specific extra step.
40 */
41 public function create_intent( Order $order, Cart $cart );
42 }
43