Skip to content
Snippets Groups Projects
Commit 164b6f19 authored by mattwire's avatar mattwire
Browse files

Fix Stripe checkout for events multiple participants

parent e6e2bbe5
Branches
Tags
1 merge request!217Implement Stripe Checkout (with support for SEPA and ACH)
......@@ -169,15 +169,27 @@ class CRM_Core_Payment_StripeCheckout extends CRM_Core_Payment_Stripe {
$stripeCustomerID = $existingStripeCustomer['customer_id'];
}
$lineItems = [];
if (!empty($paymentParams['skipLineItem']) || empty($paymentParams['line_item'])) {
$lineItems = [
'priceset' => [
'pricesetline' => [
'unit_price' => $paymentParams['amount'],
'field_title' => $paymentParams['source'],
'label' => $paymentParams['source'],
'qty' => 1,
]]];
if (!empty($paymentParams['participants_info'])) {
// Events: Multiple participants. Lineitem for each participant is in participantDetail.
foreach ($paymentParams['participants_info'] as $participantID => $participantDetail) {
$lineItems = array_merge($lineItems, $participantDetail['lineItem']);
}
}
else {
// Fallback if no lineitems (some contribution pages)
$lineItems = [
'priceset' => [
'pricesetline' => [
'unit_price' => $paymentParams['amount'],
'field_title' => $paymentParams['source'],
'label' => $paymentParams['source'],
'qty' => 1,
]
]
];
}
}
else {
$lineItems = $paymentParams['line_item'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment