Search code examples
phpstripe-paymentsshopping-cart

Multiple products (shopping cart) stripe API


I'd like to be able to itemize multiple products when charging with the stripe API. That way the automatically sent out receipt will list out each product. I don't want to just charge the total shopping cart amount and a general description.

How would I also add a $5 tie with the description 'tie' to the charge below.

$charge = \Stripe\Charge::create(array(
    "amount" => 1100,
    "currency" => "usd",
    "source" => $_POST['stripeToken'],
    'receipt_email' => $email,
    "description" => 'shirt'))

Solution

  • That is not something that Stripe supports today. When you create a one-time charge via the API, you can only pass the total amount to charge.

    Another option would be to use the Orders API. This lets you define Products in your account and then create an Order that lists all the products being bought. The limitation though is that email receipts still won't display the list of items and you would have to use a third-party application.