PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 3.4.1
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v3.4.1
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / packages / blocks / Controllers / SubscriptionController.php
SubscriptionController.php
705 lines 19.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace SureCartBlocks\Controllers;
3
4 use SureCart\Models\Component;
5 use SureCart\Models\Price;
6 use SureCart\Models\Product;
7 use SureCart\Models\Subscription;
8 use SureCart\Models\SubscriptionProtocol;
9 use SureCart\Models\User;
10 use SureCartBlocks\Controllers\Middleware\MissingPaymentMethodMiddleware;
11 use SureCartBlocks\Controllers\Middleware\UpdateSubscriptionMiddleware;
12 use SureCartBlocks\Controllers\Middleware\SubscriptionPermissionsControllerMiddleware;
13 use SureCartBlocks\Controllers\Middleware\SubscriptionNonceVerificationMiddleware;
14 /**
15 * The subscription controller.
16 */
17 class SubscriptionController extends BaseController {
18 /**
19 * The middleware for this controller.
20 *
21 * @var array
22 */
23 protected $middleware = [
24 'confirm' => [
25 SubscriptionPermissionsControllerMiddleware::class,
26 UpdateSubscriptionMiddleware::class,
27 MissingPaymentMethodMiddleware::class,
28 ],
29 'confirm_amount' => [
30 SubscriptionPermissionsControllerMiddleware::class,
31 UpdateSubscriptionMiddleware::class,
32 MissingPaymentMethodMiddleware::class,
33 ],
34 'confirm_variation' => [
35 SubscriptionPermissionsControllerMiddleware::class,
36 UpdateSubscriptionMiddleware::class,
37 MissingPaymentMethodMiddleware::class,
38 ],
39 'update_payment_method' => [
40 SubscriptionNonceVerificationMiddleware::class,
41 SubscriptionPermissionsControllerMiddleware::class,
42 UpdateSubscriptionMiddleware::class,
43 MissingPaymentMethodMiddleware::class,
44 ],
45 ];
46
47 /**
48 * Render the block
49 *
50 * @param array $attributes Block attributes.
51 * @return function
52 */
53 public function preview( $attributes = [] ) {
54 return wp_kses_post(
55 Component::tag( 'sc-subscriptions-list' )
56 ->id( 'customer-subscriptions-preview' )
57 ->with(
58 [
59 'heading' => $attributes['title'] ?? null,
60 'isCustomer' => User::current()->isCustomer(),
61 'allLink' => add_query_arg(
62 [
63 'tab' => $this->getTab(),
64 'model' => 'subscription',
65 'action' => 'index',
66 ],
67 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
68 ),
69 'query' => apply_filters(
70 'surecart/dashboard/subscription_list/query',
71 [
72 'customer_ids' => array_values( User::current()->customerIds() ),
73 'status' => [ 'active', 'trialing', 'past_due', 'canceled' ],
74 'page' => 1,
75 'per_page' => 5,
76 ]
77 ),
78 ]
79 )->render( $attributes['title'] ? "<span slot='heading'>" . $attributes['title'] . '</span>' : '' )
80 );
81 }
82
83 /**
84 * Render the block
85 *
86 * @return function
87 */
88 public function index() {
89 \SureCart::assets()->addComponentData(
90 'sc-subscriptions-list',
91 '#customer-subscriptions-index',
92 [
93 'heading' => $attributes['title'] ?? __( 'Plans', 'surecart' ),
94 'isCustomer' => User::current()->isCustomer(),
95 'query' => apply_filters(
96 'surecart/dashboard/subscription_list/query',
97 [
98 'customer_ids' => array_values( User::current()->customerIds() ),
99 'status' => [ 'active', 'trialing', 'canceled' ],
100 'page' => 1,
101 'per_page' => 20,
102 ]
103 ),
104 ]
105 );
106 ob_start();
107 ?>
108 <sc-spacing style="--spacing: var(--sc-spacing-large)">
109 <sc-breadcrumbs>
110 <sc-breadcrumb href="<?php echo esc_url( add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>">
111 <?php esc_html_e( 'Dashboard', 'surecart' ); ?>
112 </sc-breadcrumb>
113 <sc-breadcrumb>
114 <?php esc_html_e( 'Plans', 'surecart' ); ?>
115 </sc-breadcrumb>
116 </sc-breadcrumbs>
117 <sc-subscriptions-list id="customer-subscriptions-index"></sc-subscriptions-list>
118 </sc-spacing>
119 <?php
120 return ob_get_clean();
121 }
122
123 /**
124 * Show and individual checkout session.
125 *
126 * @return function
127 */
128 public function edit() {
129 $id = $this->getId();
130
131 if ( ! $id ) {
132 return $this->notFound();
133 }
134
135 // fetch subscription.
136 $subscription = Subscription::with(
137 [
138 'price',
139 'price.product',
140 'product.product_group',
141 'current_period',
142 'period.checkout',
143 'purchase',
144 'discount',
145 'discount.coupon',
146 'purchase.license',
147 'license.activations',
148 ]
149 )->find( $id );
150
151 $should_delay_cancellation = $subscription->shouldDelayCancellation();
152 ob_start();
153 ?>
154
155 <sc-spacing style="--spacing: var(--sc-spacing-large)">
156 <sc-breadcrumbs>
157 <sc-breadcrumb href="<?php echo esc_url( add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>">
158 <?php esc_html_e( 'Dashboard', 'surecart' ); ?>
159 </sc-breadcrumb>
160 <sc-breadcrumb href="
161 <?php
162 echo esc_url(
163 add_query_arg(
164 [
165 'tab' => $this->getTab(),
166 'action' => 'index',
167 'model' => 'subscription',
168 ],
169 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
170 )
171 );
172 ?>
173 ">
174 <?php esc_html_e( 'Plans', 'surecart' ); ?>
175 </sc-breadcrumb>
176 <sc-breadcrumb>
177 <?php esc_html_e( 'Plan', 'surecart' ); ?>
178 </sc-breadcrumb>
179 </sc-breadcrumbs>
180
181 <?php
182 echo wp_kses_post(
183 Component::tag( 'sc-subscription' )
184 ->id( 'customer-subscription-edit' )
185 ->with(
186 [
187 'heading' => __( 'Current Plan', 'surecart' ),
188 'showCancel' => \SureCart::account()->customer_portal_protocol->subscription_cancellations_enabled && ! $subscription->remaining_period_count && ! $should_delay_cancellation,
189 'protocol' => SubscriptionProtocol::with( [ 'preservation_coupon' ] )->find(), // \SureCart::account()->subscription_protocol,
190 'subscription' => $subscription,
191 'updatePaymentMethodUrl' => esc_url_raw(
192 home_url(
193 add_query_arg(
194 [
195 'tab' => $this->getTab(),
196 'action' => 'update_payment_method',
197 'nonce' => wp_create_nonce( 'subscription-switch' ),
198 ]
199 )
200 )
201 ),
202 ]
203 )->render()
204 );
205 ?>
206
207 <?php
208 // show switch if we can change it.
209 if ( $subscription->canBeSwitched() ) :
210 echo wp_kses_post(
211 Component::tag( 'sc-subscription-switch' )
212 ->id( 'customer-subscription-switch' )
213 ->with(
214 [
215 'heading' => __( 'Update Plan', 'surecart' ),
216 'productId' => $subscription->price->product->id,
217 'productGroupId' => ( $subscription->price->product->product_group
218 ? ( $subscription->price->product->product_group->archived
219 ? null
220 : $subscription->price->product->product_group->id )
221 : null ),
222 'subscription' => $subscription,
223 'successUrl' => home_url(
224 add_query_arg(
225 [
226 'tab' => $this->getTab(),
227 'nonce' => wp_create_nonce( 'subscription-switch' ),
228 ]
229 )
230 ),
231 ]
232 )->render()
233 );
234 endif;
235 ?>
236
237 </sc-spacing>
238
239 <?php
240 return ob_get_clean();
241 }
242
243 /**
244 * Update the subscription payment method
245 *
246 * @return string
247 */
248 public function update_payment_method() {
249 $id = $this->getId();
250
251 if ( ! $id ) {
252 return $this->notFound();
253 }
254
255 // fetch subscription.
256 $subscription = Subscription::with(
257 [
258 'price',
259 'price.product',
260 'current_period',
261 'period.checkout',
262 'discount',
263 'discount.coupon',
264 ]
265 )->find( $id );
266
267 ob_start();
268 ?>
269
270 <sc-spacing style="--spacing: var(--sc-spacing-large)">
271 <sc-breadcrumbs>
272 <sc-breadcrumb href="<?php echo esc_url( add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>">
273 <?php esc_html_e( 'Dashboard', 'surecart' ); ?>
274 </sc-breadcrumb>
275 <sc-breadcrumb href="
276 <?php
277 echo esc_url(
278 add_query_arg(
279 [
280 'tab' => $this->getTab(),
281 'action' => 'index',
282 'model' => 'subscription',
283 ],
284 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
285 )
286 );
287 ?>
288 ">
289 <?php esc_html_e( 'Plans', 'surecart' ); ?>
290 </sc-breadcrumb>
291 <sc-breadcrumb href="
292 <?php
293 echo esc_url(
294 add_query_arg(
295 [
296 'tab' => $this->getTab(),
297 'action' => 'edit',
298 'model' => 'subscription',
299 'id' => $this->getId(),
300 ],
301 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
302 )
303 );
304 ?>
305 ">
306 <?php esc_html_e( 'Plan', 'surecart' ); ?>
307 </sc-breadcrumb>
308 <sc-breadcrumb>
309 <?php esc_html_e( 'Update Payment Method', 'surecart' ); ?>
310 </sc-breadcrumb>
311 </sc-breadcrumbs>
312
313 <?php
314 echo wp_kses_post(
315 Component::tag( 'sc-subscription' )
316 ->id( 'customer-subscription-edit' )
317 ->with(
318 [
319 'heading' => __( 'Current Plan', 'surecart' ),
320 'showCancel' => false,
321 'subscription' => $subscription,
322 ]
323 )->render()
324 );
325 ?>
326
327 <?php
328 echo wp_kses_post(
329 Component::tag( 'sc-subscription-payment-method' )
330 ->id( 'customer-subscription-payment-method' )
331 ->with(
332 [
333 'heading' => __( 'Change Payment Method', 'surecart' ),
334 'subscription' => $subscription,
335 ]
336 )->render()
337 );
338 ?>
339
340 </sc-spacing>
341
342 <?php
343 return ob_get_clean();
344 }
345
346
347 /**
348 * Get the terms text.
349 */
350 public function getTermsText() {
351 $account = \SureCart::account();
352 $privacy_url = $account->customer_portal_protocol->privacy_url ?? \get_privacy_policy_url();
353 $terms_url = $account->customer_portal_protocol->terms_url ?? '';
354
355 if ( ! empty( $privacy_url ) && ! empty( $terms_url ) ) {
356 return sprintf( __( 'By updating or canceling your plan, you agree to the <a href="%1$1s" target="_blank">%2$2s</a> and <a href="%3$3s" target="_blank">%4$4s</a>', 'surecart' ), esc_url( $terms_url ), __( 'Terms', 'surecart' ), esc_url( $privacy_url ), __( 'Privacy Policy', 'surecart' ) );
357 }
358
359 if ( ! empty( $privacy_url ) ) {
360 return sprintf( __( 'By updating or canceling your plan, you agree to the <a href="%1$1s" target="_blank">%2$2s</a>', 'surecart' ), esc_url( $privacy_url ), __( 'Privacy Policy', 'surecart' ) );
361 }
362
363 if ( ! empty( $terms_url ) ) {
364 return sprintf( __( 'By updating or canceling your plan, you agree to the <a href="%1$1s" target="_blank">%2$2s</a>', 'surecart' ), esc_url( $terms_url ), __( 'Terms', 'surecart' ) );
365 }
366
367 return '';
368 }
369
370 /**
371 * Confirm the ad_hoc amount.
372 *
373 * @return void
374 */
375 public function confirm_amount() {
376 $price = Price::find( $this->getParam( 'price_id' ) );
377 ob_start();
378 ?>
379
380 <sc-spacing style="--spacing: var(--sc-spacing-xx-large)">
381 <sc-breadcrumbs>
382 <sc-breadcrumb href="<?php echo esc_url( add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>">
383 <?php esc_html_e( 'Dashboard', 'surecart' ); ?>
384 </sc-breadcrumb>
385 <sc-breadcrumb href="
386 <?php
387 echo esc_url(
388 add_query_arg(
389 [
390 'tab' => $this->getTab(),
391 'action' => 'edit',
392 'model' => 'subscription',
393 'id' => $this->getId(),
394 ],
395 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
396 )
397 );
398 ?>
399 ">
400 <?php esc_html_e( 'Plan', 'surecart' ); ?>
401 </sc-breadcrumb>
402 <sc-breadcrumb>
403 <?php esc_html_e( 'Enter Amount', 'surecart' ); ?>
404 </sc-breadcrumb>
405 </sc-breadcrumbs>
406
407 <?php
408
409 echo wp_kses_post(
410 Component::tag( 'sc-subscription-ad-hoc-confirm' )
411 ->id( 'subscription-ad-hoc-confirm' )
412 ->with(
413 [
414 'heading' => __( 'Enter An Amount', 'surecart' ),
415 'price' => $price,
416 'variant' => $this->getParam( 'variant' ),
417 ]
418 )->render()
419 );
420 ?>
421
422 </sc-spacing>
423
424 <?php
425 return ob_get_clean();
426 }
427
428 /**
429 * Confirm the product variation.
430 *
431 * @return void
432 */
433 public function confirm_variation() {
434 $price = Price::find( $this->getParam( 'price_id' ) );
435 $id = $this->getId();
436
437 if ( ! $id ) {
438 return $this->notFound();
439 }
440
441 // fetch subscription.
442 $subscription = Subscription::with(
443 [
444 'price',
445 'price.product',
446 ]
447 )->find( $id );
448
449 if ( ! $subscription ) {
450 return $this->notFound();
451 }
452
453 // fetch subscription product.
454 $product = Product::with(
455 [
456 'variants',
457 'variant_options',
458 'prices',
459 ]
460 )->find( $price->product );
461
462 ob_start();
463 ?>
464
465 <sc-spacing style="--spacing: var(--sc-spacing-xx-large)">
466 <sc-breadcrumbs>
467 <sc-breadcrumb href="<?php echo esc_url( add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>">
468 <?php esc_html_e( 'Dashboard', 'surecart' ); ?>
469 </sc-breadcrumb>
470 <sc-breadcrumb href="
471 <?php
472 echo esc_url(
473 add_query_arg(
474 [
475 'tab' => $this->getTab(),
476 'action' => 'edit',
477 'model' => 'subscription',
478 'id' => $this->getId(),
479 ],
480 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
481 )
482 );
483 ?>
484 ">
485 <?php esc_html_e( 'Plan', 'surecart' ); ?>
486 </sc-breadcrumb>
487 <sc-breadcrumb>
488 <?php esc_html_e( 'Choose Variation', 'surecart' ); ?>
489 </sc-breadcrumb>
490 </sc-breadcrumbs>
491
492 <?php
493
494 echo wp_kses_post(
495 Component::tag( 'sc-subscription-variation-confirm' )
496 ->id( 'subscription-ad-hoc-confirm' )
497 ->with(
498 [
499 'heading' => __( 'Choose a Variation', 'surecart' ),
500 'product' => $product,
501 'subscription' => $subscription,
502 'price' => $price,
503 ]
504 )->render()
505 );
506 ?>
507
508 </sc-spacing>
509
510 <?php
511 return ob_get_clean();
512 }
513
514 /**
515 * Confirm changing subscription
516 *
517 * @return function
518 */
519 public function confirm() {
520 $back = add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
521 ob_start();
522 ?>
523
524 <sc-spacing style="--spacing: var(--sc-spacing-xx-large)">
525 <sc-breadcrumbs>
526 <sc-breadcrumb href="<?php echo esc_url( add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>">
527 <?php esc_html_e( 'Dashboard', 'surecart' ); ?>
528 </sc-breadcrumb>
529 <sc-breadcrumb href="
530 <?php
531 echo esc_url(
532 add_query_arg(
533 [
534 'tab' => $this->getTab(),
535 'action' => 'edit',
536 'model' => 'subscription',
537 'id' => $this->getId(),
538 ],
539 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
540 )
541 );
542 ?>
543 ">
544 <?php esc_html_e( 'Plan', 'surecart' ); ?>
545 </sc-breadcrumb>
546 <sc-breadcrumb>
547 <?php esc_html_e( 'Confirm', 'surecart' ); ?>
548 </sc-breadcrumb>
549 </sc-breadcrumbs>
550
551 <?php
552 $terms = $this->getTermsText();
553 $quantity_enabled = (bool) \SureCart::account()->customer_portal_protocol->subscription_quantity_updates_enabled;
554 if ( $this->getParam( 'ad_hoc_amount' ) ) {
555 $quantity_enabled = false;
556 }
557
558 echo wp_kses_post(
559 Component::tag( 'sc-upcoming-invoice' )
560 ->id( 'customer-upcoming-invoice' )
561 ->with(
562 [
563 'heading' => __( 'New Plan', 'surecart' ),
564 'subscriptionId' => $this->getId(),
565 'priceId' => $this->getParam( 'price_id' ),
566 'variantId' => $this->getParam( 'variant' ),
567 'adHocAmount' => $this->getParam( 'ad_hoc_amount' ),
568 'successUrl' => esc_url_raw( $back ),
569 'quantityUpdatesEnabled' => (bool) $quantity_enabled,
570 'quantity' => 1,
571 ]
572 )->render( $terms ? '<span slot="terms">' . wp_kses_post( $terms ) . '</span>' : '' )
573 );
574 ?>
575
576
577 </sc-spacing>
578
579 <?php
580 return ob_get_clean();
581 }
582
583 /**
584 * Confirm cancel subscription
585 *
586 * @return function
587 */
588 public function cancel() {
589 $back_url = add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
590 $edit_subscription_url = add_query_arg(
591 [
592 'tab' => $this->getTab(),
593 'action' => 'edit',
594 'model' => 'subscription',
595 'id' => $this->getId(),
596 ],
597 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
598 );
599 ob_start();
600 ?>
601 <sc-spacing style="--spacing: var(--sc-spacing-xx-large)">
602 <sc-breadcrumbs>
603 <sc-breadcrumb href="<?php echo esc_url( $back_url ); ?>">
604 <?php esc_html_e( 'Dashboard', 'surecart' ); ?>
605 </sc-breadcrumb>
606 <sc-breadcrumb href="<?php echo esc_url( $edit_subscription_url ); ?>" >
607 <?php esc_html_e( 'Plan', 'surecart' ); ?>
608 </sc-breadcrumb>
609 <sc-breadcrumb>
610 <?php esc_html_e( 'Cancel', 'surecart' ); ?>
611 </sc-breadcrumb>
612 </sc-breadcrumbs>
613
614 <?php
615 echo wp_kses_post(
616 Component::tag( 'sc-subscription-cancel' )
617 ->id( 'customer-subscription-cancel' )
618 ->with(
619 [
620 'subscriptionId' => $this->getId(),
621 'backUrl' => esc_url_raw( $edit_subscription_url ),
622 'successUrl' => esc_url_raw( $back_url ),
623 ]
624 )->render()
625 );
626 ?>
627
628 </sc-spacing>
629 <?php
630 return ob_get_clean();
631 }
632
633 /**
634 * Update payment
635 *
636 * @return function
637 */
638 public function payment() {
639 $back_url = add_query_arg( [ 'tab' => $this->getTab() ], remove_query_arg( array_keys( $_GET ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
640
641 $edit_subscription_url = add_query_arg(
642 [
643 'tab' => $this->getTab(),
644 'action' => 'edit',
645 'model' => 'subscription',
646 'id' => $this->getId(),
647 ],
648 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
649 );
650
651 $confirm_subscription_url = add_query_arg(
652 [
653 'tab' => $this->getTab(),
654 'action' => 'confirm',
655 'model' => 'subscription',
656 'ad_hoc_amount' => $this->getParam( 'ad_hoc_amount' ),
657 'id' => $this->getId(),
658 'price_id' => $this->getParam( 'price_id' ),
659 'nonce' => wp_create_nonce( 'subscription-switch' ),
660 ],
661 remove_query_arg( array_keys( $_GET ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
662 );
663
664 $subscription = Subscription::find( $this->getId() );
665 ob_start();
666 ?>
667
668 <sc-spacing style="--spacing: var(--sc-spacing-xx-large)">
669 <sc-breadcrumbs>
670 <sc-breadcrumb href="<?php echo esc_url( $back_url ); ?>">
671 <?php esc_html_e( 'Dashboard', 'surecart' ); ?>
672 </sc-breadcrumb>
673 <sc-breadcrumb href="<?php echo esc_url( $edit_subscription_url ); ?>">
674 <?php esc_html_e( 'Plan', 'surecart' ); ?>
675 </sc-breadcrumb>
676 <sc-breadcrumb href="<?php echo esc_url( $confirm_subscription_url ); ?>">
677 <?php esc_html_e( 'Confirm', 'surecart' ); ?>
678 </sc-breadcrumb>
679 <sc-breadcrumb>
680 <?php esc_html_e( 'Payment Method', 'surecart' ); ?>
681 </sc-breadcrumb>
682 </sc-breadcrumbs>
683
684 <?php
685 echo wp_kses_post(
686 Component::tag( 'sc-subscription-payment' )
687 ->id( 'customer-subscription-payment' )
688 ->with(
689 [
690 'customerIds' => $this->customerIds(),
691 'subscription' => $subscription,
692 'backUrl' => esc_url_raw( $confirm_subscription_url ),
693 'successUrl' => esc_url_raw( $confirm_subscription_url ),
694 'quantity' => 1,
695 ]
696 )->render()
697 );
698 ?>
699 </sc-spacing>
700
701 <?php
702 return ob_get_clean();
703 }
704 }
705