Reputation: 51
Trying to get a customer email using Stripe endpoint / webhook. The email address isn't showing.
This is what I've got so far:
<?php
require_once('stripe/init.php');
\Stripe\Stripe::setApiKey("sk_test_xxxxxxxxxxxxxxxxxxxxxxxxx");
$input = @file_get_contents("php://input");
$event_json = json_decode($input);
$customer = $event_json->data->object->email;
$email_stripe = $customer->email;
if ($event_json->type == 'charge.failed') {
}
if ($event_json->type == 'charge.succeeded') {
}
?>
Upvotes: 1
Views: 3045
Reputation: 2345
There's no email
in that object, however there's the receipt_email which could be used for this. This you'd have to set at the charge time to get it back.
Otherwise there's the customer where the customer ID is returned. That you can use to make an additional call to get all the customer's details
Upvotes: 1