Allow payment completion via webhook

Created on 5 April 2024, 8 months ago
Updated 18 May 2024, 6 months ago

Problem/Motivation

While in stripe checkout hosted page when user press "Pay" the payment process in stripe starts, if for any reason user closes browser, lose connection, a power cut happens... the payment in stripe still happens and drupal never gets aware of the payment completion.

I check onNotify method in CommerceStripeCheckoutCheckout, but if uses as an endpoint for webhook this actually just throws and error.

Steps to reproduce

Proposed resolution

Use onNotify as an endpoint for a webhook, verify the signing secret of the webhook, check the event type and then handle completion of payment, also add payment remote id.

Also using onReturn allow us to implement an onNotify with ease, since we let commerce handle if it has to call onReturn o not.
In case onNotify already has completed the payment the onReturn won't be called.

Move all possible logic to on return, retrieve the session_id from the query param populated by stripe.

Remaining tasks

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

1.2

Component

Code

Created by

🇪🇸Spain SadySierralta

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024