Jan 5, 2017
0
Level 5
How to retrieve invoices.created data from Stripe
I need to retrieve the invoices plan name from this call. But I cant seem to get it to work
This is how I'm calling it right now:
public function whenInvoiceCreated($payload) {
// Find user by Stripe ID
$this->retrieveUser($payload)
->payments()
->create([
'plan' => $payload['data']['object']['lines']['data']['plan']['name']
]);
}
This is the APi call:
{
"created": 1326853478,
"livemode": false,
"id": "evt_00000000000000",
"type": "charge.succeeded",
"object": "event",
"request": null,
"pending_webhooks": 1,
"api_version": "2016-07-06",
"data": {
"object": {
"id": "ch_00000000000000",
"object": "charge",
"amount": 900,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"balance_transaction": "txn_00000000000000",
"captured": true,
"created": 1483678938,
"currency": "usd",
"customer": "cus_00000000000000",
"description": null,
"destination": null,
"dispute": null,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": "in_00000000000000",
"livemode": false,
"metadata": {},
"order": null,
"outcome": {
"network_status": "approved_by_network",
"reason": null,
"risk_level": "normal",
"seller_message": "Payment complete.",
"type": "authorized"
},
"paid": true,
"receipt_email": null,
"receipt_number": null,
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"total_count": 0,
"url": ----
},
"review": null,
"shipping": null,
"source": {
"id": "card_00000000000000",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": "343434",
"address_zip_check": "pass",
"brand": "Visa",
"country": "US",
"customer": "cus_00000000000000",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 10,
"exp_year": 2022,
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": "-----"
"tokenization_method": null
},
"source_transfer": null,
"statement_descriptor": "Laracasts Subscription",
"status": "succeeded"
}
}
}
I would assume this part needs to be modified:
'plan' => $payload['data']['object']['lines']['data']['plan']['name']
Please or to participate in this conversation.