enupal / stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS
https://enupal.com/craft-plugins/stripe-payments/
Other
33 stars 19 forks source link

Adding Tax to payment form errors #375

Open splendidrob opened 1 year ago

splendidrob commented 1 year ago

Description

Error thrown when adding Tax to a payment form. Tax has been created in Stripe and is shown in Stripe Payments but adding to the payment form throws the following error:


TypeError
in_array(): Argument #2 ($haystack) must be of type array, null given
1. in /home/bristolcrewco/stage.bristolcrew.co.uk/craft/vendor/enupal/stripe/src/services/Vendors.phpat line 89
80818283848586878889909192939495969798        $connect->rate = $settings->globalRate;
        $connect->allProducts = false;

        $connects = Stripe::$app->connects->getConnectsByVendorId($vendor->id, false);
        if (!empty($connects)) {
            $connect = $connects[0];
            if (is_string($connect->products)){
                $products = json_decode($connect->products, true);
                $productId = "".$paymentForm->id;
                if (!in_array($productId, $products)) {
                    $products[] = $productId;
                } else {
                    return false;
                }
            }
        }

        $connect->products = json_encode($products);
'''
![screenshot_1249](https://github.com/enupal/stripe/assets/25520763/6e2914f7-0a1e-4561-8c36-0efcac243b96)
![screenshot_1248](https://github.com/enupal/stripe/assets/25520763/e4b01137-821a-4a8c-aee5-b7c470e78e30)
![screenshot_1247](https://github.com/enupal/stripe/assets/25520763/ef9729cc-3300-452a-8bfb-16e741410e50)

### Additional info

- Craft version: Craft Pro 4.5.9
- PHP version: 8.0.30
- Database driver & version: MySQL 5.7.43
- Plugin version: 5.5.0
- Is [SCA](https://docs.enupal.com/stripe-payments/getting-started/sca.html) and Stripe Checkout enabled?: YES
splendidrob commented 1 year ago

@andrelopez Just updating this - it seems making any change to a payment form or creating a new payment form causes this error...so payment forms can no longer be created at all...

splendidrob commented 1 year ago

Just to update this as per the error above this seems to be to do with Stripe Connect...I deleted all my connect data and turned off connect (turning off by its self didn't help) and now I am able to use payment forms again....

andrelopez commented 11 months ago

Thanks for following up and for sharing your findings