diff --git a/CRM/Stripe/AJAX.php b/CRM/Stripe/AJAX.php index 032e7cd58c8c961ff4d96fbbe0414531e2d04c91..263b679990c38065255451b5d517b045ca491c5c 100644 --- a/CRM/Stripe/AJAX.php +++ b/CRM/Stripe/AJAX.php @@ -1,5 +1,4 @@ <?php - /** * https://civicrm.org/licensing */ diff --git a/CRM/Stripe/Api.php b/CRM/Stripe/Api.php index ac1aa5f54ce0694bf9174509ba2fcde3a7743fa7..a672f4465eba4888d45899712bacec35a3b1c3b2 100644 --- a/CRM/Stripe/Api.php +++ b/CRM/Stripe/Api.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ class CRM_Stripe_Api { diff --git a/CRM/Stripe/Check.php b/CRM/Stripe/Check.php index c453cfef130307e86d16d948151212b8916329d6..f057cdbdd5c9344a7f61733c742153ef874c874b 100644 --- a/CRM/Stripe/Check.php +++ b/CRM/Stripe/Check.php @@ -1,5 +1,4 @@ <?php - /** * https://civicrm.org/licensing */ diff --git a/CRM/Stripe/Customer.php b/CRM/Stripe/Customer.php index c974c25c52d6ee0c71ce099292e78565111ed210..bf3002506e27ae1fd24c7acf8b4ad91b0ef76759 100644 --- a/CRM/Stripe/Customer.php +++ b/CRM/Stripe/Customer.php @@ -1,5 +1,11 @@ <?php +/** + * https://civicrm.org/licensing + */ +/** + * Class CRM_Stripe_Customer + */ class CRM_Stripe_Customer { /** diff --git a/CRM/Stripe/Form/UpdateWebhook.php b/CRM/Stripe/Form/UpdateWebhook.php index b0310296864af5beb9c14e2f7c1663657c46acb3..3e3faeaba8ebe09869aef05511a495187c56b29a 100644 --- a/CRM/Stripe/Form/UpdateWebhook.php +++ b/CRM/Stripe/Form/UpdateWebhook.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ use CRM_Stripe_ExtensionUtil as E; diff --git a/CRM/Stripe/Hook.php b/CRM/Stripe/Hook.php index 94ce4bbfde9e461e3c3d98d75b7be74c6c42ee07..c262aa0e496153d2ba76a3900d46b00f78f59b35 100644 --- a/CRM/Stripe/Hook.php +++ b/CRM/Stripe/Hook.php @@ -1,27 +1,7 @@ <?php -/*--------------------------------------------------------------------+ - | CiviCRM version 5.0 | -+--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2017 | -+--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM is distributed in the hope that it will be useful, but | - | WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | - | See the GNU Affero General Public License for more details. | - | | - | You should have received a copy of the GNU Affero General Public | - | License and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +-------------------------------------------------------------------*/ +/** + * https://civicrm.org/licensing + */ /** * This class implements hooks for Stripe diff --git a/CRM/Stripe/Upgrader.php b/CRM/Stripe/Upgrader.php index 30aacea59a5a12d2733e86d960f96051b9788cfd..509bced4ba8554eb5d2e0b808342f015f0cf82d3 100644 --- a/CRM/Stripe/Upgrader.php +++ b/CRM/Stripe/Upgrader.php @@ -1,4 +1,8 @@ <?php +/** + * https://civicrm.org/licensing + */ + /** * Collection of upgrade steps. * DO NOT USE a naming scheme other than upgrade_N, where N is an integer. diff --git a/CRM/Stripe/Webhook.php b/CRM/Stripe/Webhook.php index 07d4c3f74a8afaff8806b03420fd5ce601a1b627..5478d311efabd694686300c395193833a9cdeb25 100644 --- a/CRM/Stripe/Webhook.php +++ b/CRM/Stripe/Webhook.php @@ -1,7 +1,13 @@ <?php +/** + * https://civicrm.org/licensing + */ use CRM_Stripe_ExtensionUtil as E; +/** + * Class CRM_Stripe_Webhook + */ class CRM_Stripe_Webhook { use CRM_Stripe_WebhookTrait; diff --git a/README.md b/README.md index 1681b54e58d61216dcd1781a52ac9de385b933dc..46029ef3171078a28e9f1d58751898c74ad93d60 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,20 @@ -# CiviCRM Stripe Payment Processor - -Integrates the Stripe payment processor (for Credit/Debit cards) into CiviCRM so you can use it to accept Credit / Debit card payments on your site. - -* https://stripe.com/ - -Latest releases can be found here: https://civicrm.org/extensions/stripe-payment-processor - -## Documentation -Please see: https://docs.civicrm.org/stripe/en/latest - -## Configuration -All configuration is in the standard Payment Processors settings area in CiviCRM admin. -You will enter your "Publishable" & "Secret" key given by stripe.com. - -## Installation -There are no special installation requirements. -The extension will show up in the extensions browser for automated installation. -Otherwise, download and install as you would for any other CiviCRM extension. +# CiviCRM Stripe Payment Processor + +Integrates the Stripe payment processor (for Credit/Debit cards) into CiviCRM so you can use it to accept Credit / Debit card payments on your site. + +* https://stripe.com/ + +Latest releases can be found here: https://civicrm.org/extensions/stripe-payment-processor + +## Documentation +Please see: https://docs.civicrm.org/stripe/en/latest + +## Configuration +All configuration is in the standard Payment Processors settings area in CiviCRM admin. +You will enter your "Publishable" & "Secret" key given by stripe.com. + +## Installation +**The mjwshared extension is required and MUST be installed.** + +The extension will show up in the extensions browser for automated installation. +Otherwise, download and install as you would for any other CiviCRM extension. diff --git a/api/v3/Stripe/Cleanup.php b/api/v3/Stripe/Cleanup.php index 90e574481f2e0393f28fdca09822baf946407fb4..e8104f33cd4e441b3e44f0a7cc353eba321e610f 100644 --- a/api/v3/Stripe/Cleanup.php +++ b/api/v3/Stripe/Cleanup.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ /** * This api cleans up old data / tables in Stripe. diff --git a/api/v3/Stripe/Ipn.php b/api/v3/Stripe/Ipn.php index 46c7be7203edb257d69d60c0cad07d343cb97ded..6114cad286fc8e3ba1c4ee1b504796277b064fc4 100644 --- a/api/v3/Stripe/Ipn.php +++ b/api/v3/Stripe/Ipn.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ /** * This api allows you to replay Stripe events. diff --git a/api/v3/Stripe/Listevents.php b/api/v3/Stripe/Listevents.php index b1b02ebfd8720b0695652a3d4839a8fe4b834198..d3e4dc8ddb724c1a2839e7b2a68ebe892513ee03 100644 --- a/api/v3/Stripe/Listevents.php +++ b/api/v3/Stripe/Listevents.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ /** * This api provides a list of events generated by Stripe diff --git a/api/v3/Stripe/Populatelog.php b/api/v3/Stripe/Populatelog.php index 639a2b7f5d3c447fbe08fdf7bdeb325957a7fc30..cd221f709311bf15088f2e2113148d98319bbd17 100644 --- a/api/v3/Stripe/Populatelog.php +++ b/api/v3/Stripe/Populatelog.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ /** * Populate the CiviCRM civicrm_system_log with Stripe events. @@ -18,7 +21,7 @@ * @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards */ function _civicrm_api3_stripe_Populatelog_spec(&$spec) { - $spec['ppid']['title'] = ts("The id of the payment processor."); + $spec['ppid']['title'] = ts("The id of the payment processor."); } /** @@ -46,12 +49,12 @@ function civicrm_api3_stripe_Populatelog($params) { throw new API_Exception("Expected one live Stripe payment processor, but found none or more than one. Please specify ppid=.", 2234); } } - + $params = array('limit' => 100, 'type' => 'invoice.payment_succeeded'); - if ($ppid) { + if ($ppid) { $params['ppid'] = $ppid; } - + $items = array(); $last_item = NULL; $more = TRUE; @@ -60,7 +63,7 @@ function civicrm_api3_stripe_Populatelog($params) { $params['starting_after'] = $last_item->id; } $objects = civicrm_api3('Stripe', 'Listevents', $params); - + if (count($objects['values']['data']) == 0) { // No more! break; diff --git a/api/v3/Stripe/Setuptest.php b/api/v3/Stripe/Setuptest.php index 730fa809e62b20191381607684af9d35f777e64e..9ff8182b5ed34200969b994dc42b10fdf4cf495f 100644 --- a/api/v3/Stripe/Setuptest.php +++ b/api/v3/Stripe/Setuptest.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ /** * This api sets up a Stripe Payment Processor with test credentials. diff --git a/api/v3/StripeCustomer.php b/api/v3/StripeCustomer.php index ee254ee5460b50abb09c138c07a05f1c9ec87792..4a2a67fd8f07d2a2b52c32b43c2426d5bd53749d 100644 --- a/api/v3/StripeCustomer.php +++ b/api/v3/StripeCustomer.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ /** * Stripe Customer API diff --git a/api/v3/StripeSubscription.php b/api/v3/StripeSubscription.php index d152780a74030faaa2d3a0bce8a490292e061c2c..a22b4a3d1c43e4d7c5e518a403b7742a3d526220 100644 --- a/api/v3/StripeSubscription.php +++ b/api/v3/StripeSubscription.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ /** * Stripe Subscription API diff --git a/css/elements.css b/css/elements.css index 2718ae2d807bb3bf698e73e1d728b6a71d485816..bac09b5a32fc4619ceff9a5dbda47009faa38b2e 100644 --- a/css/elements.css +++ b/css/elements.css @@ -1,3 +1,7 @@ +/** + * https://civicrm.org/licensing + */ + #card-element { padding: 2%; margin: 2% auto; diff --git a/docs/contribution.md b/docs/contribution.md new file mode 100644 index 0000000000000000000000000000000000000000..e2a4db126a72c49a6129cc7f3f9e242749e31732 --- /dev/null +++ b/docs/contribution.md @@ -0,0 +1,31 @@ +# Contributions, Payments and Customers + +A CiviCRM **Contribution** is the equivalent of a Stripe **Invoice**. + +A CiviCRM **Payment** is the equivalent of a Stripe **Charge**. + +A CiviCRM **Contact** is the equivalent of a Stripe **Customer**. + +## Invoices and Charges? + +For a **one-off contribution** an invoice is *NOT* created, so we have to use the Stripe `Charge ID`. In this case we set the contribution `trxn_id` = Stripe `Charge ID`. + +For a **recurring contribution** an invoice is created for each contribution: +* We set the contribution `trxn_id` = Stripe `Invoice ID`. +* We set individual payments on that contribution (which could be a payment, a failed payment, a refund) to have `trxn_id` = Stripe `Charge ID` + +## Payment Metadata + +When we create a contribution in CiviCRM (Stripe Invoice/Charge) we add some metadata to that payment. +* The statement descriptor contains a parsable `contactID-contributionID` and then part of the description. +* The description contains the description, a parsable `contactID-contributionID` and then the CiviCRM (unique) invoice ID. + + +## Customer Metadata + +Every time we create a new contribution/recurring contribution we create/update a Stripe customer with the following metadata: +* Contact Name, Email address +* Description (`CiviCRM: ` + site name). +* Contact ID +* Link to CiviCRM contact record + diff --git a/docs/hooks.md b/docs/hooks.md index ce606c5766da1c6f567bcff5286e836684c50a4b..3bb1f651ada043eb19fa10bea0400c2f159d8437 100644 --- a/docs/hooks.md +++ b/docs/hooks.md @@ -6,7 +6,7 @@ In order to support other extensions that manipulate amounts etc we need to add Currently only a single hook is implemented, and is only called in one place. -#### hook_civicrm_smartdebit_updateRecurringContribution(&$recurContributionParams) +#### hook_civicrm_stripe_updateRecurringContribution(&$recurContributionParams) This hook allows modifying recurring contribution parameters during update. * @param array $recurContributionParams Recurring contribution params (ContributionRecur.create API parameters). diff --git a/docs/images/backend_cancelrecur.png b/docs/images/backend_cancelrecur.png new file mode 100644 index 0000000000000000000000000000000000000000..99846bbac906bf50a0d5ccb4c915111ee2810baf Binary files /dev/null and b/docs/images/backend_cancelrecur.png differ diff --git a/docs/images/stripedashboard_apiversion.png b/docs/images/stripedashboard_apiversion.png new file mode 100644 index 0000000000000000000000000000000000000000..179fddfc8d6216cd53e342a048ff7bb55161da22 Binary files /dev/null and b/docs/images/stripedashboard_apiversion.png differ diff --git a/docs/images/stripedashboard_cancelsubscription.png b/docs/images/stripedashboard_cancelsubscription.png new file mode 100644 index 0000000000000000000000000000000000000000..b37a58b5fb30c3d56175e68ee313620f79393ff6 Binary files /dev/null and b/docs/images/stripedashboard_cancelsubscription.png differ diff --git a/docs/images/stripedashboard_customerdetail.png b/docs/images/stripedashboard_customerdetail.png new file mode 100644 index 0000000000000000000000000000000000000000..6209920969ac4d0d2f1d8bbd67668ee4223fbdcf Binary files /dev/null and b/docs/images/stripedashboard_customerdetail.png differ diff --git a/docs/images/stripedashboard_paymentdetail.png b/docs/images/stripedashboard_paymentdetail.png new file mode 100644 index 0000000000000000000000000000000000000000..aa7add62823336c14b9d16e72f9b2e8ac9c4aa4e Binary files /dev/null and b/docs/images/stripedashboard_paymentdetail.png differ diff --git a/docs/index.md b/docs/index.md index 9c447d99616df107efdf95ba7009452469974064..c99d2a01c5cb217e8efb51349adfb51761e19b5a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,15 +13,15 @@ View this extension in the [Extension Directory](https://civicrm.org/extensions/ * Jquery 1.10 (Use jquery_update module on Drupal). * Drupal 7 / Joomla / Wordpress (latest supported release). *Not currently tested with other CMS but it may work.* * Stripe API version: 2019-09-09 -* Drupal webform_civicrm 7.x-4.22+ (if using webform integration) - -If using test mode with drupal webform_civicrm you need this patch: https://github.com/colemanw/webform_civicrm/pull/266 +* Drupal webform_civicrm 7.x-4.28+ (if using webform integration) - does NOT support test mode: + > If using test mode with drupal webform_civicrm you need this patch: https://github.com/colemanw/webform_civicrm/pull/266 +* MJWShared extension 0.3 - available here: https://civicrm.org/extensions/mjwshared ## Troubleshooting Under *Administer->CiviContribute->Stripe Settings* you can find a setting: * Enable Stripe Javascript debugging? -This can be switched on to output debug info to the browser console and can be used to debug problems with submitting your payments. +> This can be switched on to output debug info to the browser console and can be used to debug problems with submitting your payments. ## Credits Current Maintainer: Matthew Wire - https://www.mjwconsult.co.uk diff --git a/docs/install.md b/docs/install.md index 85d5e9f29a56d88f9801ebebf1fe0078c9ccb718..d0c877298675a634ec4e9fbbda9ca6a945487eb1 100644 --- a/docs/install.md +++ b/docs/install.md @@ -7,20 +7,22 @@ Please do help improve this documentation by submitting a PR or contacting me. Create an API key by logging in to your Stripe dashboard and selecting [API keys](https://dashboard.stripe.com/account/apikeys) from the left navigation. You can use the standard key, or you can click "Create restricted key" to have a more limited key. Example key restrictions are listed below. ### CiviCRM -All configuration is in the standard Payment Processors settings area in CiviCRM admin (**Administer menu » System Settings » Payment Processors**). -Add a payment processor and enter your "Publishable" & "Secret" keys given by stripe.com. +All configuration is in the standard Payment Processors settings area in CiviCRM admin (**Administer menu > System Settings > Payment Processors**). +Add a payment processor and enter your *Publishable* and *Secret* keys given by stripe.com. ## Installation -There are no special installation requirements. +**The mjwshared extension is required and MUST be installed.** + The extension will show up in the extensions browser for automated installation. Otherwise, download and install as you would for any other CiviCRM extension. ### How to update Stripe API version More info on how to change: https://stripe.com/docs/upgrades#how-can-i-upgrade-my-api -Go to _Account Settings_ -> _API Keys_ tab -> click _Upgrade available_ button. +Go to **Stripe Dashboard > Developers** to view and upgrade your API version: + -Don't forget to update the webhook API version as well. +The Webhook API versions will be configured / updated automatically by this Stripe extension but if you didn't create them using the automated method you may need to delete them and allow the extension to re-create them. ### Stripe API Key restrictions If you prefer, you can restrict the permissions available to the API key you create. The below is an example that may have more permissions than is needed, but works with one-time payments, recurring payments, and the webhook check built into this extension. If a permission isn't listed below, leave it as *None*. @@ -43,6 +45,6 @@ Application Fees: *Write* SKUs: *Write* **Webhook resources** Webhook Endpoints: *Write* (required for the webhook system check/auto-create webhooks) - + diff --git a/docs/recur.md b/docs/recur.md index f5f7c4b8f07f6d9ff93eea755a2983ef39354420..612a929ab407dd13b89e95b70af54a145517b300 100644 --- a/docs/recur.md +++ b/docs/recur.md @@ -1,52 +1,29 @@ -# Recurring Contributions and Webhooks -## Overview -If you are using recurring contributions with Stripe you **MUST** setup a webhook and check that it is working. Otherwise contributions will never be marked "Completed". +# Recurring Contributions -If you are not using recurring contributions the webhook is not required. +A CiviCRM **Recurring Contribution** is the equivalent of a Stripe **Subscription**. -## Details -Stripe notifies CiviCRM every time a recurring contribution is processed / updated / cancelled. +The CiviCRM Recurring Contribution `trxn_id` = Stripe `subscription ID`. -In order to take advantage of this feature, you must configure Stripe with the right "Webhook Endpoint". +When you create a recurring contribution in CiviCRM using the Stripe payment processor it is linked via the trxn_id to a Stripe subscription. -To do this, log into Stripe Dashboard and from the menu on the left, choose Developers > Webhooks and click Add Endpoint. - -At this point, you need to figure out the "URL to be called" value. To do this, you need to check what ID is assigned to the Stripe payment processor in CiviCRM. - -To determine the ID, go back to CiviCRM and click `Administer -> System Settings -> Payment Processor` - -Click Edit next to the payment processor you are setting up. - -Then, check the Address bar. You should see something like the following: - -https://example.com/civicrm/admin/paymentProcessor?action=update&id=3&reset=1 - -The end of the address contains id=3. That means that this Payment Processor id is 3. - -Therefore the call back address for your site will be: - - civicrm/payment/ipn/3 - -See below for the full address to add to the endpoint (replace NN with your actual ID number): - -* For Drupal and Backdrop: https://example.com/civicrm/payment/ipn/NN -* For Joomla: https://example.com/?option=com_civicrm&task=civicrm/payment/ipn/NN -* For Wordpress: https://example.com/?page=CiviCRM&q=civicrm/payment/ipn/NN - -Typically, you only need to configure the end point to send live transactions and you want it to send all events. - -Also, make sure you set the API version for the end point to 2018-11-08. +!!! tip If you are using recurring contributions make sure you have webhooks configured correctly + See [Webhooks](/docs/webhook.md) ## Cancelling Recurring Contributions -You can cancel a recurring contribution from the Stripe.com dashboard or from within CiviCRM. +You can cancel a recurring contribution from the Stripe Dashboard or from within CiviCRM. #### In Stripe + 1. Go to Customers and then to the specific customer. 1. Inside the customer you will see a Subscriptions section. 1. Click Cancel on the subscription you want to cancel. 1. Stripe.com will cancel the subscription, send a webhook to your site and the recurring contribution will be marked as "Cancelled" in CiviCRM. + + #### In CiviCRM 1. Click the "Cancel" link next to the recurring contribution. -1. Select the option to "Send cancellation request to Stripe ?" and click Cancel. +1. Select the option to *Send cancellation request to Stripe?* and click Cancel. 1. Stripe.com will cancel the subscription, send a webhook to your site and the recurring contribution will be marked as "Cancelled" in CiviCRM. + + diff --git a/docs/release/release_notes.md b/docs/release/release_notes.md index 94554e240ec38f68364e22f5924ffee280bd08f6..e348045b77ea5a8665119f772c5cb4d6f1bd173d 100644 --- a/docs/release/release_notes.md +++ b/docs/release/release_notes.md @@ -1,59 +1,34 @@ -## Release 6.0.beta1 - -*Thanks to Rich Lott (@artfulrobot) for contributing and testing release.* -* We don't need to confirm the payment until we capture it -* payment method id is not required when passing in an existing payment intent -* Add minified versions of js/css -* Remove onclick attribute from submit form so that CiviContribute forms do stripe processing before submission -* Description and Customer fields in Stripe backend - fixes #78 - -## Release 6.0.alpha3 - -* Support recurring payments with paymentIntents/Elements. Cancel subscription with Stripe when we reach recurring end date -* **Update required Stripe API version to 2019-09-09** -* Handle confirmation pages properly for contribution pages (make sure we pass through paymentIntentID). -* Handle card declined on client side. -* Support creating recurring payment (subscription). -* Handle IPN events for charges / invoices (support cancel/refund etc). -* Add basic support for PaymentProcessor.refund API. -* Remove membership_type_tag from plan name. - -## Release 6.0.alpha2 +## Release 6.0 -* Support Drupal Webform CiviCRM. -* Support Event Registration. -* Support Confirm/Thankyou pages on contribution pages / events. -* Support cards using 3dsecure and cards not using 3dsecure. - -### Not Supported (should be in final 6.0 release): -* Recurring payments. -* Backend payments. - -## Release 6.0.alpha1 - -* ONLY contribution pages with no confirm pages are supported. - -## Release 6.0 (not yet released) +*Switch to Stripe Elements for SAQ-A compliance on most sites and support the European Secure Customer Authentication (SCA) payments directive.* **This is a major new release. You cannot rollback once you've upgraded.** **This extension REQUIRES the mjwshared extension available here: https://lab.civicrm.org/extensions/mjwshared** +**You MUST update your API version on the stripe dashboard!** + * Use Stripe Elements: https://stripe.com/payments/elements. * Use PaymentIntents and comply with the European SCA directive (https://stripe.com/docs/strong-customer-authentication). * Require Stripe API Version: 2019-09-09 and ensure that all codepaths specify the API version. * Switch publishable key/secret key in settings (upgrader does this automatically) so they are now "correct" per CiviCRM settings pages. * Support cards using 3dsecure and cards not using 3dsecure (workflows with Stripe are slightly different but both are now handled). +* Use minified versions of js/css. +* Improve payment descriptors and customer information that is sent from CiviCRM to Stripe. +* Add basic support for PaymentProcessor.refund API. + +#### What is NOT supported: -### Not supported * CiviCRM Event Cart (requires additional funding, changes should probably be made in CiviCRM core to standardize that workflow rather than adding support via this extension). -* Card payments via the admin backend (this was supported in 5.4.1 but has unresolved issues with Stripe Elements when used via popup forms). +* Card payments via the admin backend (this was supported in 5.4.1 but has unresolved issues with Stripe Elements when used via popup forms and is not allowed in most situations when complying with the SCA payments directive unless you are approved to accept "MOTO" payments). ## Release 5.4.1 + * Don't overwrite system messages when performing webhook checks. * Add form to handle creating/updating webhooks instead of automatically during system check (Thanks @artfulrobot) ## Release 5.4 + This release fixes multiple bugs and introduces a few small features. **A major feature for this release is the automatic management of webhooks:** @@ -79,13 +54,16 @@ Note that when you upgrade you may end up with duplicate webhooks in Stripe with * Remove `is_live` field from `civicrm_stripe_customer` - we can get this from the payment processor ID. ## Release 5.3.2 + * Fix retrieving email receipt parameter on stripe IPN which stopped contributions from being marked as completed. * Fix webhook check for wordpress so we don't get false positives when everything is configured ok. ## Releae 5.3.1 + * Fix issue with event/membership payments failing to record in CiviCRM (introduced in 5.3). ## Release 5.3 + **All users should upgrade to 5.3.1 due to an issue with event/membership payments** There are no database changes in this release but you should update your Stripe webhook API version to 2019-02-19. @@ -147,3 +125,42 @@ Make sure you run the extension upgrades immediately after updating the code. T * Fix all known "Stripe.js token was not passed". * Tested support for Drupal 7 / Wordpress / Joomla for contributions/event payments. * Improvements to recurring payments (though you will want to upgrade to 5.2 if using recurring payments as recurring payments has had a major rewrite for 5.2). + + +# Alpha / Beta releases + +## Release 6.0.beta1 + +*Thanks to Rich Lott (@artfulrobot) for contributing and testing this release.* + +* We don't need to confirm the payment until we capture it +* payment method id is not required when passing in an existing payment intent +* Use minified versions of js/css. +* Remove onclick attribute from submit form so that CiviContribute forms do stripe processing before submission +* Description and Customer fields in Stripe backend - fixes #78 + +## Release 6.0.alpha3 + +* Support recurring payments with paymentIntents/Elements. Cancel subscription with Stripe when we reach recurring end date +* **Update required Stripe API version to 2019-09-09** +* Handle confirmation pages properly for contribution pages (make sure we pass through paymentIntentID). +* Handle card declined on client side. +* Support creating recurring payment (subscription). +* Handle IPN events for charges / invoices (support cancel/refund etc). +* Add basic support for PaymentProcessor.refund API. +* Remove membership_type_tag from plan name. + +## Release 6.0.alpha2 + +* Support Drupal Webform CiviCRM. +* Support Event Registration. +* Support Confirm/Thankyou pages on contribution pages / events. +* Support cards using 3dsecure and cards not using 3dsecure. + +### Not Supported (should be in final 6.0 release): +* Recurring payments. +* Backend payments. + +## Release 6.0.alpha1 + +* ONLY contribution pages with no confirm pages are supported. diff --git a/docs/webhook.md b/docs/webhook.md new file mode 100644 index 0000000000000000000000000000000000000000..c1490c5e09c5d6e5195f50ad18cca66a63798993 --- /dev/null +++ b/docs/webhook.md @@ -0,0 +1,23 @@ +# Webhooks + +## Overview +If you are using recurring contributions with Stripe you **MUST** setup a webhook and check that it is working. Otherwise contributions will never be marked "Completed". + +If you are not using recurring contributions the webhook, if available, will update contributions if they are refunded / cancelled / failed. + +## Configuring Webhooks +From version 5.4.1 the extension manages / creates the webhooks. A system check is run to verify if the webhooks are created and have the correct parameters. If not a *Wizard* is provided to create them for you. + +To check if webhooks are configured correctly login to your Stripe Dashboard and look at **Developers > Webhooks** + +## Notifications + +Stripe notifies CiviCRM in the following circumstances: +* A Charge is successful (not normally used as we are already notified during the actual payment process). +* A Charge fails - sometimes a charge may be delayed (eg. for Fraud checks) and later fails. +* A Charge is refunded - if a charge is refunded via the Stripe Dashboard it will update in CiviCRM. + +* An invoice is created and paid. +* An invoice payment fails. +* A subscription is cancelled. +* A subscription is updated. diff --git a/info.xml b/info.xml index e48e8c149137e4b9b0f4c62ca1fcd76c2acd0fe4..82762b5fc3eff36ccfe66b5ad65e863da707702c 100644 --- a/info.xml +++ b/info.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <extension key="com.drastikbydesign.stripe" type="module"> <file>stripe</file> - <name>Stripe (SCA payments development version)</name> - <description>Stripe Payment Processor</description> + <name>Stripe Payment Processor</name> + <description>Accept payments using https://stripe.com/</description> <urls> <url desc="Main Extension Page">https://lab.civicrm.org/extensions/stripe</url> <url desc="Support">https://lab.civicrm.org/extensions/stripe/issues</url> @@ -12,9 +12,9 @@ <author>Matthew Wire (MJW Consulting)</author> <email>mjw@mjwconsult.co.uk</email> </maintainer> - <releaseDate>2019-09-12</releaseDate> - <version>6.0.beta1</version> - <develStage>beta</develStage> + <releaseDate>2019-09-13</releaseDate> + <version>6.0</version> + <develStage>stable</develStage> <compatibility> <ver>5.13</ver> </compatibility> diff --git a/mkdocs.yml b/mkdocs.yml index c633b19b763502b04d62f9c3dad7a316e0ba4b0a..defec939291acaecf65499f57d034cd9ba1ef573 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -16,9 +16,11 @@ markdown_extensions: pages: - About: index.md - Installation: install.md +- Webhooks (Notifications): webhook.md +- Contributions, Payments and Customers: contribution.md - Recurring Contributions (Subscriptions): recur.md - Advanced: - API: api.md - Hooks: hooks.md - Testing: testing.md -- Release Notes: release/release_notes.md \ No newline at end of file +- Release Notes: release/release_notes.md diff --git a/settings/stripe.setting.php b/settings/stripe.setting.php index 2eb58cd04ca8160ed148f0f9e5552e5d0c59ceec..64f2af7c9ea44561c2eb45075739ffc609d82693 100644 --- a/settings/stripe.setting.php +++ b/settings/stripe.setting.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ use CRM_Stripe_ExtensionUtil as E; diff --git a/stripe.php b/stripe.php index c3bb467ab1a60654c4524fb1fa222532bdb52394..8ae84c96be37b24da8084e2510ba61f1a43d06c4 100644 --- a/stripe.php +++ b/stripe.php @@ -1,4 +1,7 @@ <?php +/** + * https://civicrm.org/licensing + */ require_once 'stripe.civix.php'; require_once __DIR__.'/vendor/autoload.php'; @@ -51,12 +54,6 @@ function stripe_civicrm_disable() { /** * Implementation of hook_civicrm_upgrade - * - * @param $op string, the type of operation being performed; 'check' or 'enqueue' - * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks - * - * @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending) - * for 'enqueue', returns void */ function stripe_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { return _stripe_civix_civicrm_upgrade($op, $queue); @@ -80,42 +77,6 @@ function stripe_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { _stripe_civix_civicrm_alterSettingsFolders($metaDataFolders); } -/** - * Implementation of hook_civicrm_validateForm(). - * - * Prevent server validation of cc fields - * - * @param $formName - the name of the form - * @param $fields - Array of name value pairs for all 'POST'ed form values - * @param $files - Array of file properties as sent by PHP POST protocol - * @param $form - reference to the form object - * @param $errors - Reference to the errors array. - * - */ - -function stripe_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) { - if (empty($form->_paymentProcessor['payment_processor_type'])) { - return; - } - // If Stripe is active here. - if ($form->_paymentProcessor['class_name'] == 'Payment_Stripe') { - if (isset($form->_elementIndex['stripe_token'])) { - if ($form->elementExists('credit_card_number')) { - $cc_field = $form->getElement('credit_card_number'); - $form->removeElement('credit_card_number', true); - $form->addElement($cc_field); - } - if ($form->elementExists('cvv2')) { - $cvv2_field = $form->getElement('cvv2'); - $form->removeElement('cvv2', true); - $form->addElement($cvv2_field); - } - } - } else { - return; - } -} - /** * Implementation of hook_civicrm_alterContent * @@ -150,7 +111,9 @@ function stripe_civicrm_alterContent( &$content, $context, $tplName, &$object ) * hook_civicrm_alterContent is not called for all forms (eg. CRM_Contribute_Form_Contribution on backend) * * @param string $formName - * @param CRM_Core_Form $form + * @param \CRM_Core_Form $form + * + * @throws \CRM_Core_Exception */ function stripe_civicrm_buildForm($formName, &$form) { // Don't load stripe js on ajax forms @@ -170,6 +133,8 @@ function stripe_civicrm_buildForm($formName, &$form) { * * @param string $formName * @param \CRM_Core_Form $form + * + * @throws \CRM_Core_Exception */ function stripe_civicrm_postProcess($formName, &$form) { // We're only interested in forms that have a paymentprocessor @@ -209,6 +174,8 @@ function stripe_civicrm_postProcess($formName, &$form) { /** * Implements hook_civicrm_check(). + * + * @throws \CiviCRM_API3_Exception */ function stripe_civicrm_check(&$messages) { CRM_Stripe_Webhook::check($messages); diff --git a/templates/CRM/Stripe/Form/UpdateWebhook.tpl b/templates/CRM/Stripe/Form/UpdateWebhook.tpl index bc821ab57ac6b393cdf535df036e3a6d130a68cc..b1dc5e2d9bb2a135ef52e23dd143fab5adf0ebab 100644 --- a/templates/CRM/Stripe/Form/UpdateWebhook.tpl +++ b/templates/CRM/Stripe/Form/UpdateWebhook.tpl @@ -1,3 +1,5 @@ +{* https://civicrm.org/licensing *} + <div class="crm-block crm-content-block"> {if $isAllOk} <div class="alert alert-success">{$intro}</div> @@ -41,4 +43,4 @@ {include file="CRM/common/formButtons.tpl" location="bottom"} </div> {/if} -</div> \ No newline at end of file +</div>