3

I am using PaymentIntent API of stripe to process payments in my website. The CreateIntent method allows you set a email in which the receipt will be emailed. But in that email They only send the information of how much the amount was. I want to include the information of the product as well in the Receipt email.

This is my product.

p = stripe.Product.create(
        name="T-shirt",
        type="good",
        description="Comfortable cotton t-shirt",
        attributes=["size", "gender"],
            )

That how I create the PI object.

        intent = stripe.PaymentIntent.create(
                amount=100,
                currency='cad',
                metadata={'integration_check': 'accept_a_payment' , 'product_id' : p.id},
                receipt_email="random@outlook.com",
                description="What"
             )

Could anyone help me in including the product info in the receipt email. Do i do something in the create method.

vikram
  • 361
  • 5
  • 15
  • Your PaymentIntent creation is right. When you set the description, that is what will be output in the email receipt. If you go to your dashboard, on the payment, you can send yourself a test email, that should contain "What" as you've described here. You could write up your product description there for example. That all should work. – v3nkman May 25 '20 at 09:48
  • That works but the problem is the text written in description can't be formatted. I want to build a receipt that has order details. Also I want to send this receipt to multiple email addresses. Is there any other solution that could complete my requirements. – vikram May 25 '20 at 22:37
  • 1
    You're right, there is limited formatting within that string. For what it's worth I was able to use `\n` for newlines and make a kind of list of items, but I can't say for how long that might be supported. – v3nkman May 26 '20 at 14:14

1 Answers1

1

You could try creating an Invoice first, with the product as an InvoiceItem, as explained here.

The invoice will have a paymentIntent after you finalize it.

const finalInvoice = await stripe.invoices.finalizeInvoice(invoiceId) 

Then see if the resulting email contains the product info, after the payment is submitted.

Nelu
  • 16,644
  • 10
  • 80
  • 88