Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stripe: Received unknown parameter: receipt_email

I am creating a new Session with stripe and attempting to pass in the receipt_email property so that I can explicitely send a reciept to my buyer. The code below works fine without the receipt_email property but adding it throws the error: Received unknown parameter: receipt_email

$session_data = [
    'payment_method_types' => ['card'],
    'mode'=>'payment',
    'billing_address_collection'=> 'auto',
    'line_items'=> [['price' => STRIPE_PRICE, 'quantity'=> 1]],
    'success_url' => URL.'success',
    'cancel_url' => URL.'error',
    'receipt_email' => $email
];

$session = \Stripe\Checkout\Session::create($session_data);

I see that receipt_email is actually a property of the payment_intent. How/when should I set receipt_email?

Here is the revised $session_data object based on advice from @hmunoz (the chosen answer):

$session_data = [
    'payment_method_types' => ['card'],
    'mode'=>'payment',
    'billing_address_collection'=> 'auto',
    'line_items'=> [['price' => STRIPE_PRICE, 'quantity'=> 1]],
    'success_url' => URL.'success',
    'cancel_url' => URL.'error',
    'payment_intent_data' => ['receipt_email' => $email] //changed this line
];
like image 599
Shawn Cooke Avatar asked Oct 28 '25 21:10

Shawn Cooke


1 Answers

You can set the underlying PaymentIntent's receipt_email using payment_intent_data.receipt_email field on the CheckoutSession: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-receipt_email

like image 148
hmunoz Avatar answered Oct 31 '25 10:10

hmunoz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!