Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe.NET 28.2 Update #31

Merged
merged 8 commits into from Sep 2, 2019
Merged

Stripe.NET 28.2 Update #31

merged 8 commits into from Sep 2, 2019

Conversation

mattbrailsford
Copy link
Contributor

@mattbrailsford mattbrailsford commented Aug 17, 2019

Update to Stripe provider to use the latest 28.2 Stripe.NET DLL / latest API version. In addition this also brings back the "Capture" option.

Still to do:

  • Test the updates
  • Update the docs

…er before continuing. Also disabled the submit button in the payment form.
…uced the "Charge" option in settings to enable capture + authorize only payments [NEEDS TESTING]
@mattbrailsford mattbrailsford changed the title Stripe 28.2 Update Stripe.NET 28.2 Update Aug 17, 2019
@mattbrailsford mattbrailsford modified the milestones: 3.1.1, 3.1.2 Aug 17, 2019
@mattbrailsford
Copy link
Contributor Author

Ok, made another big update to this.

Ultimately there is an issue in that Stripes API is rapidly updating, but the webooks need to be registered against a specific API version as determined by the Stripe.NET dll version. This was fine on initial release when the latest version was the same as that in the dll used, but the problem now is their latest API is now newer than the one used in the dll and when manually registering webhooks via their dashboard, like we currently require people to, you can't unfortunately choose an explicit version (you can only choose the version your account is using or the very latest).

In order to get around this, it needs to be the code that registers the webhook. The webhook registration API supports passing an API version and when passed, means any webhook notifications to that endpoint will use that explicit API version. What this means however is that the Stripe provider needs to auto generate the webhook for you.

In this latest update I've added some startup handlers that listen for a payment method being saved, and if that provider uses the Stripe payment provider, then it looks through the payment methods settings and trys to work out if you have a valid webhook configured. If not, it will use the Stripe API credentials in the settings to register one for you, updating the payment method with a webhook ID and Secret.

This registration also takes into account the "mode" of the provider. So if you save it in test mode, it will generate a test webhook and save the details in "test_webhook_id" / "test_webhook_secret" settings. And when in live mode, it will create a live webhook and store the details in "live_webhook_id" / "live_webhook_secret" settings.

If you need to regenerate a webhook endpoint at any time (such as if you upgrade later to a newer release using a newer Stripe.NET dll) then you can edit the provider and clear those settings out and then on save, it will regenerate them.

In addition, I've also added 2 new settings "test_base_url" and "live_base_url". These are used to set an explicit base URL when registering the webhook URL. This is handy for occasions where you want to test the webhook locally, so you can pass an ngrok URL as the base URL instead of localhost.

I need to do some more testing on this and also to update the docs. This update has also force the payment providers to be based on the TC 3.3.0 dlls so anyone wanting the latest providers will need to uprgade TC too.

@mattbrailsford mattbrailsford merged commit a6dda86 into dev Sep 2, 2019
@mattbrailsford mattbrailsford deleted the wip/stripe-28-2-update branch September 2, 2019 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants