Skip to content

Bug when using automatic_payment_methods parameter #218

@fiter92

Description

@fiter92
{
    "message": "Invalid boolean: 1",
    "exception": "Cartalyst\\Stripe\\Exception\\MissingParameterException",
    "file": "/www/vendor/cartalyst/stripe/src/Exception/Handler.php",
    "line": 125,
    "trace": [
        {
            "file": "/www/vendor/cartalyst/stripe/src/Exception/Handler.php",
            "line": 93,
            "function": "handleException",
            "class": "Cartalyst\\Stripe\\Exception\\Handler",
            "type": "->"
        },
        {
            "file": "/www/vendor/cartalyst/stripe/src/Api/Api.php",
            "line": 178,
            "function": "__construct",
            "class": "Cartalyst\\Stripe\\Exception\\Handler",
            "type": "->"
        },
        {
            "file": "/www/vendor/cartalyst/stripe/src/Api/Api.php",
            "line": 155,
            "function": "execute",
            "class": "Cartalyst\\Stripe\\Api\\Api",
            "type": "->"
        },
        {
            "file": "/www/vendor/cartalyst/stripe/src/Api/PaymentIntents.php",
            "line": 33,
            "function": "_post",
            "class": "Cartalyst\\Stripe\\Api\\Api",
            "type": "->"
        },

^ I'm getting this error when running the code below:

      $paymentIntent = $stripe->paymentIntents->create([
        'amount' => $order->amount,
        'currency' => 'usd',
        'automatic_payment_methods' => [
          'enabled' => true, // <------ boolean
        ],
      ] );

It took me an hour to figure out what the problem was. This code works:

      $paymentIntent = $stripe->paymentIntents->create([
        'amount' => $order->amount,
        'currency' => 'usd',
        'automatic_payment_methods' => [
          'enabled' => 'true', // <------ string
        ],
      ] );

Could you please fix this bug? Stripe API expects boolean, this error is really confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions