diff --git a/api/v3/Stripe/Ipn.php b/api/v3/Stripe/Ipn.php index 8c5896976ceb3a17f31b53993beff938f1d00ccf..1bf05ec2fb25f26d9148d560491c622f6cb957c9 100644 --- a/api/v3/Stripe/Ipn.php +++ b/api/v3/Stripe/Ipn.php @@ -30,9 +30,9 @@ function _civicrm_api3_stripe_Ipn_spec(&$spec) { $spec['id']['title'] = ts("CiviCRM System Log id to replay from system log."); $spec['evtid']['title'] = ts("An event id as generated by Stripe."); $spec['ppid']['title'] = ts("The payment processor to use (required if using evtid)"); - $spec['noreceipt']['title'] = ts("Set to 1 to override contribution page settings and do not send a receipt (default is off or 0). )"); - $spec['noreceipt']['api.default'] = FALSE; - $spec['noreceipt']['type'] = CRM_Utils_Type::T_BOOLEAN; + $spec['suppressreceipt']['title'] = ts("Set to 1 to override contribution page settings and do not send a receipt (default is to use contribution page settings). )"); + $spec['suppressreceipt']['api.default'] = 0; + $spec['suppressreceipt']['type'] = CRM_Utils_Type::T_INT; } /** @@ -98,12 +98,20 @@ function civicrm_api3_stripe_Ipn($params) { } if (class_exists('CRM_Core_Payment_StripeIPN')) { + // By default, set emailReceipt to NULL so the default receipt setting + // will kick in. + $emailReceipt = NULL; + if ($params['suppressreceipt'] == 1) { + // Override, do not send receipt. + $emailReceipt = 0; + } + try { $paymentProcessor->processPaymentNotification( $ppid, json_encode($object), FALSE, - ($params['noreceipt'] === TRUE) ? 0 : NULL); + $emailReceipt); } catch(Throwable $e) { return civicrm_api3_create_error($e->getMessage()); }