Stripe response 200 OK There was an errorColumn 'available_currency' cannot be null
please help how can I get json request "available" array and "pending" array store in a variable then store in DB
this is stripe json
{
"id": "evt_1Muxxxxxxxxxxxxxxx",
"object": "event",
"api_version": "2022-11-15",
"created": 1680827076,
"data": {
"object": {
"object": "balance",
"available": [
{
"amount": 7642,
"currency": "gbp",
"source_types": {
"card": 7642
}
}
],
"livemode": false,
"pending": [
{
"amount": 213601,
"currency": "gbp",
"source_types": {
"card": 213601
}
}
]
}
},
"livemode": false,
"pending_webhooks": 1,
"request": {
"id": null,
"idempotency_key": null
},
"type": "balance.available"
}
case 'balance.available':
$balance = $event->data->object; // contains a \Stripe\PaymentMethod
$available_currency = $event->data->object->available->currency;
$available_card = $event->data->object->available->source_types->card;
$pending_amount = $event->data->object->pending->amount;
$pending_currency = $event->data->object->pending->currency;
$pending_card = $event->data->object->pending->source_types->card;
$stmt_balance = $con->prepare("INSERT INTO tbl_balance (available_currency, available_card, pending_amount, pending_currency, pending_card) VALUES (?, ?, ?, ?, ?)");
$stmt_balance->bind_param("sidsi", $available_currency, $available_card, $pending_amount, $pending_currency, $pending_card);
// $stmt->execute();
if (!$stmt_balance->execute()) {
# code...
echo 'There was an error'.mysqli_error($con);
}
$stmt_balance->close();
$con->close();
// handlePaymentMethodAttached($paymentMethod);
break;
Stripe response 200 OK There was an errorColumn 'available_currency' cannot be null
please help how can I get json request "available" array and "pending" array store in a variable then store in DB