stripe / stripe-php

PHP library for the Stripe API.
https://stripe.com
MIT License
3.75k stars 850 forks source link

Fixed empty param for v2 requests #1754

Closed prathmesh-stripe closed 2 months ago

prathmesh-stripe commented 2 months ago

Creating a meter event session was failing(400) because we were trying to send an invalid json body in the request.

$stripeClient->v2->billing->meterEventSession->create([]);
json_encode([]) // '[]' - string brackets
json_encode(null) // 'null' - String null

In order to fix this, I added a check to skip encoding params when the params are empty.