API documentation: https://docs.stripe.com/elements/express-checkout-element

The Express Checkout Element integration has a few high-level components:

  1. Configuration for the various express checkout options.
  2. Creation and mounting of the element.
  3. Event handlers to react to user interaction with the element.
  4. Payment confirmation and finalization.

The element should be integrated within the context of the existing Payment Element plugin, as it would not make sense for a single site to have multiple gateway configurations for the same Stripe account. The element may be used in contexts outside the cart form, but for the sake of this integration, we will only provide integration to the cart form out of the box along with the various options and event handlers. The solution should include:

  1. Payment Element gateway configuration should include a new fieldset above the “Webhooks” fieldset titled “Express Checkout configuration.” This should include the following options:
    1. A boolean field with a checkbox labeled, “Show Express Checkout buttons on the shopping cart page.”
    2. A multi-value checkboxes field called “Payment method types” with the description, “Only include Express Checkout buttons for these types even if other payment method types are enabled at Stripe.” The options should be the various payment methods supported by the element, and we can default it to include Apple Pay and Google Pay.
    3. Two select lists for each supported payment method type labeled with the pattern “Apple Pay button theme” / “Apple Pay button type”, “Google Pay button theme” / “Google Pay button type”, etc. The options should come from: Stripe JS Reference .
      Note: we won’t try to support every appearance customization option here, but theme / type seemed like a good starting point. The module should make it easy for the JavaScript used to create the element to be altered before it is actually outputted at render time.
    4. A boolean field with a checkbox labeled, “Collect a phone number in express checkout.”
    5. A boolean field with a checkbox labeled, “Collect the billing address in express checkout.” (This one should default to TRUE.)
  2. If the Express Checkout Element is enabled on the shopping cart page, the element should be appended to the form with a configuration array as specified in the gateway settings.
  3. The element includes various handlers that can be used to respond to user interactions.
    1. The click event handler gives us the opportunity to pass options to the element, including listing line items, requiring a shipping address for shippable orders (with the list of allowed countries), setting the default shipping rates if possible, and collecting payer information per the configuration. It appears we may need our click handler to disable user interactions on the underlying page … I don’t see an example of this in the docs, so this may require further research.
    2. The shippingaddresschange event handler will let us update the order in Drupal Commerce via a custom callback with the selected shipping address, rejecting it if need be or otherwise “resolving” the change by revising the line items or shipping rates shown in the element. Reference the resolve parameters for the event.
    3. The shippingratechange event handler will let us update the order in Drupal Commerce via a custom callback with the selected shipping rate, again revising line items (e.g., to update the tax amount in the event the selected shipping rate includes tax). Resolve parameters same as above.
    4. The cancel event handler would see us reset the amount on the element to the original order subtotal and unblock any operation on the underlying page that was blocked on click.
    5. The confirm event handler will be responsible for creating the payment intent via a custom callback and then invoking the element’s confirmPayment() method with the necessary parameters, including a return_url that points to the checkout completion page for the order. This should result in the payment being created at Stripe according to the payment gateway configuration (e.g., the future usage setting, authorize vs. capture, etc.) and then redirect the customer to the checkout completion page.
  4. To support the above elements, we’ll need at least the three mentioned callbacks:
    1. One to update the shipping address on the order.
    2. One to update the shipping rate selection.
    3. One to create the payment intent that is then used to confirm the payment.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vmarchuk created an issue. See original summary.

vmarchuk’s picture

Issue summary: View changes

redsky’s picture

We've applied this as a patch and tested, it works great. We're deploying it to a production site tomorrow. Not sure if you want to call that "Reviewed and tested by the community or not".

Thanks!

niharika.s changed the visibility of the branch 3477028-stripe-express-checkout to hidden.

anybody’s picture

Whao, super nice to see this, really looking forward to the express functionality, this will be huge! Thank you!

anybody changed the visibility of the branch 3477028-stripe-express-checkout to active.

anybody changed the visibility of the branch 8.x-1.x to hidden.

anybody’s picture

Any further plans here @vmarchuk I think this is a super important feature. It's assigned to you currently, so nobody else will work on it so far.

vmarchuk’s picture

StatusFileSize
new63.58 KB
rszrama’s picture

Status: Active » Needs review

Does this patch currently reset things properly when someone exits the Express Checkout Element and goes through normal checkout to pay via the Payment Element? We're getting reports from production usage that someone exiting one path and going to the other causes data loss.

anybody’s picture

Assigned: vmarchuk » Unassigned

Any feedback or plan to share @vmarchuk?

vmarchuk’s picture

Assigned: Unassigned » vmarchuk
Status: Needs review » Needs work

@anybody
We're currently working on this and want to launch it soon.

anybody’s picture

@vmarchuk thanks for the feedback, that's great news! 🎉 Let us and @rszrama know when it's ready for review by the community.

vmarchuk’s picture

StatusFileSize
new60.88 KB
vmarchuk’s picture

StatusFileSize
new60.12 KB
vmarchuk’s picture

StatusFileSize
new60.14 KB
vmarchuk’s picture

StatusFileSize
new60.12 KB

vmarchuk’s picture

Added a patch for compatibility with version 1.3.

vmarchuk’s picture

StatusFileSize
new61.29 KB
rszrama’s picture

Status: Needs work » Needs review
anybody’s picture

@vmarchuk, @rszrama is there work going on in the background on this issue or any further plan or should we simply review & test it and send feedback as-is?

Thank you! :)

tomtech’s picture

@anybody,

This is already being used on production sites.

We are in final testing before committing. (We generally try to test in different use cases/scenarios before committing, especially a larger feature add like this.)

Found some minor issues during recent testing that @vmarchuk has since addressed.

If you have any issues/feedback, please provide! (Note that, depending on the issue, we will likely still commit and tag a release, then follow up in a future commit/release.)

anybody’s picture

Cool, thank you @tomtech! Then we'll also try it now! That sounds amazing, very much looking forward to the official release!

anybody’s picture

StatusFileSize
new61.29 KB

Latest MR as patch attached.

anybody’s picture

StatusFileSize
new61.29 KB
new60.26 KB

Clearer versioned patches attached.

anybody’s picture

Hi, we just tried the Stripe Express Checkout Element and these are our observations:

The wrappers are correctly placed on the cart page:
<div id="payment-errors"></div><div id="stripe-express-checkout-element" data-drupal-selector="edit-stripe-express-checkout-element"></div>

The JavaScript initializes the Express Checkout within the element:

<div id="stripe-express-checkout-element" data-drupal-selector="edit-stripe-express-checkout-element" data-once="stripe-processed" class="StripeElement">
    <div class="__PrivateStripeElement" style="margin: -4px 0px !important; padding: 0px !important; border: medium !important; display: block !important; background: transparent !important; position: relative !important; opacity: 1 !important; transition: height 0.35s !important;">
        <iframe name="__privateStripeFrame3093" frameborder="0" allowtransparency="true" scrolling="no" role="presentation" src="https://js.stripe.com/v3/elements-inner-express-checkout-with-shared-39bb4efb86b60c9971566f493d873828.html#__shared_params__[version]=v3&amp;wait=false&amp;rtl=false&amp;publicOptions[paymentMethods][applePay]=never&amp;publicOptions[paymentMethods][googlePay]=never&amp;publicOptions[paymentMethods][amazonPay]=never&amp;elementsInitSource=stripe.elements&amp;componentName=expressCheckout&amp;keyMode=live&amp;apiKey=pxx&amp;referrer=https%3A%2F%2Fwww.example.com%2Fcart%3FWDEBUG&amp;controllerId=__privateStripeController3091" title="Sicherer Rahmen für schnelle Bezahlvorgänge" style="border: 0px !important; margin: -4px; padding: 0px !important; width: calc(100% + 8px); min-width: 100% !important; overflow: hidden !important; display: block !important; user-select: none !important; transform: translate(0px) !important; color-scheme: light only !important; height: 80px; transition: height 0.35s, opacity 0.4s 0.1s;"></iframe>
    </div>
</div>

But the iframe is empty (white) and shows no payment methods.

So either I'm doing something wrong or miss something. Maybe it needs additional documentation for the setup?

Because of https://docs.stripe.com/elements/express-checkout-element#supported-brow... I tried it in Firefox and Chrome as logged-in user.

Maybe other users will run into similar issues in the future, so I hope my comment helps.

Within the iframe we have an empty div finally:

<div id="root"><div class="p-ExpressCheckoutElement de7zKgf4__p-Root p-Locale-de p-Animatable p-LTR"><div class="p-HeightObserverProvider"><div class="p-HeightObserverProvider-container"><div class="p-ExpressCheckoutView"><div class="p-ExpressCheckoutButtonGroup"></div></div></div><div class="p-HeightObserverProvider-clone" aria-hidden="true"></div></div></div></div>
vmarchuk’s picture

StatusFileSize
new78.73 KB

@anybody
You can try to test it here https://express-checkout-ttkizeq-gugct5y3vw43w.us-2.platformsh.site/ (this is our demo environment). If you don't see the payment button, it means something is wrong with your environment settings.
There are many reasons why buttons may not be showing: Stripe configurations, browser, no wallet for the account, etc.
See a screenshot of what I see here: https://express-checkout-ttkizeq-gugct5y3vw43w.us-2.platformsh.site/
Express checkout

anybody’s picture

@vmarchuk the testing environment is currently broken, could you revive it?
TypeError: Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}(): Argument #1 ($definition) must be of type Drupal\Core\Field\FieldStorageDefinitionInterface, __PHP_Incomplete_Class given in Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}() (line 175 of core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php).

So we could proceed the investigations.

Would it be possible to share a screenshot of your Drupal Stripe payment gateway settings? (admin/commerce/config/payment-gateways/manage/stripe_payment_element)

anybody’s picture

Version: 8.x-1.x-dev » 2.x-dev
grevil’s picture

@vmarchuk the testing environment is currently broken, could you revive it?

Already told Jonathan about that via Slack, he is already at it / forwarded it.

grevil’s picture

Note, that !MR 129 is against 2.0.x, seems like that is a mirror of 2.x?

jsacksick’s picture

The environment is fixed.

vmarchuk’s picture

StatusFileSize
new560.16 KB

Would it be possible to share a screenshot of your Drupal Stripe payment gateway settings? (admin/commerce/config/payment-gateways/manage/stripe_payment_element)

See the attached screenshot.

anybody’s picture

Thank you so much @jsacksick and @vmarchuk! We're on it!

grevil’s picture

Status: Needs review » Needs work

Added a few comments on the MR. Furthermore, when pressing e.g. the amazonPay checkout button, I get the following error in console:

Uncaught (in promise) IntegrationError: The amount 1986 is less than the total amount of the line items provided.

And the Amazon popup just loads infinitely.

I do not get this error when e.g. using the express checkout buttons from commerce_paypal.

grevil’s picture

StatusFileSize
new19.11 KB

Ok, the problem is the VAT that is part of the line items, even if it should be already included in the price of the products:
screenshot

I'll have a closer look at this tommorow.

anybody’s picture

@grevil: I think the logical mistake is, that only product line items should be included in the JSON generally and never adjustments. I didn't look into the code, but hopefully it's easy to find the reason how VAT comes in here.

grevil’s picture

Ok, I found the issue. Adjustments were added as "extra_line_items", leading to this error.

Although this code seems intentional, I could not yet find the reason it was coded this way. @vmarchuk could you give feedback, on why the adjustments were added as line items? It might be needed for "onShippingRateChange()" and "onShippingAddressChange()" but not passed to the js eventually? Or we need to revert https://git.drupalcode.org/project/commerce_stripe/-/merge_requests/129/... again and just add a check?

grevil’s picture

Ignore #40 we now skip the adjustment if it is of type "tax" and already included in the line item price. Meaning, the original implementation of "commerce_stripe_get_express_checkout_order_line_items" by @vmarchuk is restored again (with the mentioned check included).

But I am still unsure if is the correct approach, to pass the tax as a line item. But according to the Stripe AI assistan it is:

Certainly! Here's how you can add tax to a line item using Stripe.js without automatic tax calculation:

example.js
const stripe = Stripe('your_publishable_key');

const lineItems = [
  {
    price_data: {
      currency: 'usd',
      unit_amount: 2000,
      product_data: {
        name: 'T-shirt',
      },
    },
    quantity: 1,
  },
  {
    price_data: {
      currency: 'usd',
      unit_amount: 200,
      product_data: {
        name: 'Sales Tax',
      },
    },
    quantity: 1,
  }
];

stripe.checkout.sessions.create({
  mode: 'payment',
  line_items: lineItems,
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
}).then(function(session) {
  // Handle the session
});
In this example:

We define two line items in the lineItems array:

The T-shirt priced at $20.00 (2000 cents)
The sales tax as a separate line item, priced at $2.00 (200 cents)
We don't use the automatic_tax parameter, as we're manually adding the tax as a separate line item.

But on docs provided as resources by the AI I couldn't find this approach. But yea seems good enough.

grevil’s picture

Assigned: vmarchuk » Unassigned
Status: Needs work » Needs review

Alright, this is pretty far now.

Regarding the payment methods:

Klarna
Works great and as expected.

AmazonPay
Works great and as expected.

GooglePay
Works great and as expected.

ApplePay
Not tested. I do not have Safari.

Link
Could not test link, since I couldn't log into my account for some reason

PayPal
After confirming the payment I get an error and get sent to the "checkout/{order_id}/order_information" page with the error:

Payment failed at the payment server. Please review your information and try again.

There are still a couple of console errors and I feel like a few parts of code should use existing commerce services instead of "reinventing the wheel" (e.g. the shipping address validation). But generally speaking, this is fairly close!
We will test it in a live environment tommorow and give further feedback.

grevil’s picture

Status: Needs review » Needs work

Sorry, back to "Needs work" regarding PayPal.

anybody’s picture

Great work @grevil for a great feature based on the work done by @vmarchuk! Thanks for the various important finding and fixes!

@vmarchuk will you or your team have a look soon so we don't lose focus here? Would be wonderful to have this feature released soon IMHO!

tomtech’s picture

Assigned: Unassigned » tomtech

We are working to land this ASAP.

Appreciate the testing and feedback!

PayPal and Link are NOT supported at this time, as we have not landed Payment Method Types for them. (This needs to land with PaymentElement in order for Express Checkout to be able to support it.)

(If you are able to enable either of these, then that is something that needs to be addressed in this MR.)

After we land the Payment Method Types, we can then enable them in Express Checkout. (PayPal has a proposed MR that is under consideration. Link needs additional work, as it it not only needs a PaymentMethodType, but also some js/UX changes for support. Specifically, Link works with a very simple PaymentMethodType for new payments, but does not work for saved payment methods.)

grevil’s picture

StatusFileSize
new63.57 KB

@tomtech thanks for the feedback! And great to hear, that you guys are on it! Really appreciate the work of your team (and especially by @vmarchuk for working on this issue!).

I disabled support for link and PayPal. We will test it live now and come back to you guys again!

Static patch of the current MR attached.

grevil’s picture

StatusFileSize
new63.58 KB

New patch. Old patch had a bug I introduced, sorry for that.

grevil’s picture

Status: Needs work » Needs review

Alright! Seems to work as expected! We just had 2 test purchases inside a live environment using amazonPay and googlePay. Both worked as expected (Klarna was tested before inside a sandbox environment, which also worked great).

Setting this to "Needs review" for the Centarro people to take a final look at the changes!

grevil’s picture

Hey @tomtech, just wanted to ask how soon we can expect to get this reviewed / merged?

Also, I couldn't find an issue regarding the missing PayPal / Link PaymentMethodTypes, so I created one here: #3524967: Add Stripe Link payment method support to Payment Element Gateway. Not sure if you guys plan to implement that yourself? Otherwise, we could also chime in to help implement the PayPal integration, as the "commerce_paypal" Express Checkout Buttons are currently no option for us (see #3525818: Anonymous user can't finish checkout using PayPal Express Checkout, when shipping rates exist).
EDIT: I found it and updated the one I created to target Stripe Link.

Thanks for the feedback! 🙂👍

grevil’s picture

Ignore #49. Updated the former related issue, just a heads-up.

Still very eager to get this merged! 🤩

jsacksick’s picture

@grevil: Could you address the phpcs & CSPELL issues? Those are pretty simple to address so this can all be green. Tom would still be the one signing off on this as I wasn't really involved, but would be great to have a green MR.

grevil’s picture

Done! Everything is green now!

jsacksick’s picture

Status: Needs review » Needs work

Reviewed the code quickly and left a few feedbacks. We don't necessarily need to address everything, but was curious to why we're duplicating the logic for handling the guest checkout registration as this should already be handled by core.

We're also duplicating logic from the ShippingOrderManager (for determining whether shipping is required), not sure why we are not using the method defined by the shipping order manager directly?

And the biggest NO to me here is making commerce_stripe dependent on commerce_shipping. We should go with conditional dependency injection when/if needed, but we shouldn't require commerce_shipping just to install commerce_stripe.

I see for example the code largely inspired from Commerce Paypal (for the express checkout buttons builder), but Commerce PayPal does NOT depend on shipping.

vmarchuk’s picture

Assigned: tomtech » vmarchuk
vmarchuk’s picture

@jsacksick Added some fixes, but not all, as per your comment. Please check my comment regarding anonymous checkout. I also need to check if the applyRate() method can be used.

jsacksick’s picture

Regarding the subscriber; if we have no other option fine. I'm just wondering if we should add a setting for this behavior? Was creating an account part of the requirements?

Also, regarding applyRate(), does it work without? I don't see where the rate is applied otherwise? All we do is setting a shipping method?
I also merged 2.x changes to fix the test failures.

jsacksick’s picture

Updated the target branch to be 2.x (and not 2.0.x).

grevil’s picture

jsacksick’s picture

@grevil: Could you elaborate on what needs to be adjusted? Not too familiar with the other issue linked... Also the links from your comment #58 aren't working for me (I'm getting a "Couldn't fetch the linked file" error).

jsacksick’s picture

@vmarchuk: Reviewing the code once again, and regarding your feedback:

@jsacksick
When an anonymous user is on the cart page (not going deep into the checkout process), we don't have a "checkout_flow" value, so we can't check if we can use the "guest_new_account"/"guest_order_assign" settings. I don't want to duplicate the logic, but otherwise, we need to "force" site owners to use "guest_new_account"/"guest_order_assign" settings. Maybe we should add an "Allow anonymous checkout" setting to the payment gateway that will only be available when "guest_new_account"/"guest_order_assign" is checked (we can specify this in the field description). But this will affect the entire checkout process.
Another option is to leave everything as is and just document it (as you said).

The duplicated code runs on CheckoutEvents::COMPLETION, I see that Stripe firing that event manually but there is also a checkout flow set, so the duplicated code shouldn't be necessary?

@tomtech: thoughts?

Also pasting here the feedbacks from Tom regarding the JS file:

We got rid of jQuery in the paymentintent js file. We are regressing by re-introducing it in this new js file.
closest() is a native call since ~2015.
Same for forEach() (as a replacement for jQuery each())
$.ajax is replaceable by either Drupal.ajax or just js native fetch().

tomtech’s picture

I've pushed a commit to fix an inconsistency in the config schema. A few more commits to follow to address a couple other issues.

grevil’s picture

@jsacksick concerning #59:

We need to add "paypal" to the "$supported_payment_method_types" array in "src/Plugin/Commerce/PaymentGateway/StripePaymentElement.php" line 286 (https://git.drupalcode.org/project/commerce_stripe/-/merge_requests/129/...) and remove the explicit removal of "paypal" as a "expressCheckoutOption" in line 117 of "src/ExpressCheckoutButtonsBuilder.php" (https://git.drupalcode.org/project/commerce_stripe/-/merge_requests/129/...).

tomtech’s picture

3 new commits added.

Commit 51 is primarily to cleanup and modernize the javascript.

Main items of note:
1. Removes jQuery dependency (e.g. replaced jQuery Ajax with fetch)
2. Removes dead code (e.g. there was an "off"/removeEventListener for an event that was never added.)

The commit also passes the isShippable setting, so that we can properly handle non-shippable orders.

Commit 52 is mainly some additional fixes needed for non-shippable orders.

Commit 53 removes redundant guest checkout order assignment/account creation logic.

tomtech’s picture

eslint configuration updated to properly test classes with fields.

tomtech’s picture

merged in the latest 2.x and resolved merge conflicts.

tomtech’s picture

Assigned: vmarchuk » tomtech
Status: Needs work » Needs review

Going to merge with the latest changes, unless there is something critical someone wants to call out.

@grevil, we'll handle enabling PayPal in the other issue after this is merged in.

grevil’s picture

Status: Needs review » Needs work

Added a few comments. Also, the issue from #37 is back.

Probably because the VAT is once again part of the line items, even when it is set as included (see #38).

There are also still multiple threads open on the MR

vmarchuk’s picture

@TomTech

I found another issue that was committed here https://git.drupalcode.org/project/commerce_stripe/-/merge_requests/129/....

For both shippable and non-shippable orders, we need to clear the checkout data set during the regular checkout process.
For the shippable orders, the onShippingAddressChange() method will be called first, so we can clear the data there (this is not currently happening).

Or we can change the overall approach and clean up checkout data from one place. In the onClick() JS event (it is always called when a popup opens), we can make an Ajax call to a new URL where we will clear the checkout data set during the regular checkout process.

anybody’s picture

@vmarchuk & @tomtech are there plans for the next steps here? This is still assigned to @tomtech

vmarchuk’s picture

@anybody @grevil
Do you mind tagging the release?
The only issue on our end is this - we need to clear the checkout data set during regular checkout when the pop-up opens. After that, we will be ready for release.
Is there anything else that needs to be fixed before release? We may have missed some comments here.

grevil’s picture

Hey @vmarchuk!

For us, it is working great! I created a branch combining this issue together with #3421392: Add PayPal support to Payment Element Gateway, which I just did some successful testing on! I'll check on the MR comments again and try to highlight the important once.

we need to clear the checkout data set during regular checkout when the pop-up opens

I have only tested express and regular checkout in isolation with this patch. What exactly are the steps to reproduce? Do you mean going through the express checkout, then cancelling it and going into the regular checkout?

Here is a 3477028 x 3421392 "franken-patch" for the time being.

grevil changed the visibility of the branch 3477028-stripe-express-checkout-with-3421392-add-paypal-support to hidden.

vmarchuk’s picture

@grevil

What exactly are the steps to reproduce? Do you mean going through the express checkout, then cancelling it and going into the regular checkout?

No, vice versa (when we cancel Express Checkout, we already clear the data). Go through regular checkout and then get back to the cart page and open Express Checkout. The data set during the regular checkout should be cleared when we open the pop-up.

grevil’s picture

StatusFileSize
new6.41 KB

@vmarchuk I can't reproduce this behavior.

Went through the standard checkout, then back to the cart and bought the product through the express checkout while debugging. The ExpressCheckoutController, "onPaymentConfirm" clears the checkout data as expected before continuing, and you can even see that reflected in the stripe logs:

screenshot
(EDIT: Don't wonder about "PayPal", I am currently testing this patch together with #3421392: Add PayPal support to Payment Element Gateway, which works great btw.)

grevil’s picture

Status: Needs work » Reviewed & tested by the community

Yea, all in all this LGTM! RTBC!

Are you able to merge this @vmarchuk? Once this is merged, I can add the Express Checkout PayPal support in #3421392: Add PayPal support to Payment Element Gateway.

anybody’s picture

@tomtech @vmarchuk any plans here? See #77 So we could finish both.

grevil’s picture

Status: Reviewed & tested by the community » Needs work

PayPal support is now added. We can enable PayPal again.

grevil changed the visibility of the branch 3477028-stripe-express-checkout-compatible-1.3 to hidden.

grevil’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new13.26 KB
new8.22 KB
new22.77 KB
new65.56 KB

Alright, all done!

I just had a successful transaction using the PayPal Express Checkout Button with current commerce_stripe dev + the current MR as a patch applied to my site:
screenshot
screenshot2
screenshot3

Static patch applied to this comment for the time being.

anybody’s picture

Confirming RTBC, this works perfectly fine, also with the merged #3421392: Add PayPal support to Payment Element Gateway

grevil’s picture

Re-added Link Payment express checkout, since the payment method was implemented through #3524967: Add Stripe Link payment method support to Payment Element Gateway. I can see the Express Checkout button, but couldn't figure out which credentials to use in test mode to log in to link.

Although, everything should work as expected.

anybody’s picture

@tomtech & @vmarchuk any plans to finish this? I think this will clearly be a highlight for the module, besides supporting all the various payment types finally. This is HUGE :)

vmarchuk’s picture

StatusFileSize
new65.28 KB
yannickbaettig’s picture

Re-roll of #85 with display mode support for Apple Pay and Google Pay
This patch adds the ability to configure the display mode (auto or always) for Apple Pay and Google Pay Express Checkout buttons.
Why this is needed:
According to Stripe's documentation, certain browser/platform combinations require paymentMethods.applePay or paymentMethods.googlePay to be set to always instead of auto:

Apple Pay on desktop Chromium browsers (MacOS) requires always
Google Pay on Safari browsers requires always
Google Pay on Firefox browsers requires always
Without this option, these payment methods won't appear in the affected browsers.

https://docs.stripe.com/js/elements_object/create_express_checkout_element#express_checkout_element_create-options-paymentMethods-applePay

grevil’s picture

Status: Reviewed & tested by the community » Needs work

Thank you @yannickbaettig.

Could you push your changes to the current Issue branch (https://git.drupalcode.org/issue/commerce_stripe-3477028/-/tree/3477028-...)?

This way we can easily see the diff as well.

tomtech’s picture

I've merged in the latest 2.x changes into the feature branch.

I tried reproducing #75, but did not encounter the issue. (In some respects, the issue, if I understand it correctly, could be considered a feature by some.)

For #86, I don't see a commit for the changes. I skimming the patch, and it appears partially implemented, as it is missing an update to the configuration schema.

This has been simmering long enough. Going to merge this, and we can tackle 75 and 86 (and any other issues that come up) as separate follow-up issues, as needed.

  • tomtech committed b8c2d325 on 2.x authored by vmarchuk
    feat: #3477028 Stripe Express Checkout Element Integration
    
    By: vmarchuk...
tomtech’s picture

Component: Code » Payment Element
Status: Needs work » Fixed

Merged. Thanks all!

Let's keep this issue to this initial implementation. For anything else, please create a separate issue.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

anybody’s picture

Thank you very very much @tomtech!! Nice to see this merged finally, now only the missing payment methods are left 🤩 WHAO!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

anybody’s picture

Using the wonderful Express Checkout in production for >6 months now, this is a great UX & conversions improvement.
Still we're now seeing some race conditions, and it seems that the immediate order completion without validation and review might be an antipattern.

So I created a follow-up for the Express Checkout #3590893: Refactor Express Checkout with Review as last step, not completing the order directly to ensure it's valid and the race conditions we see using this in combination with webhooks: #3590914: [META] Ensure Webhooks and onReturn don't race, do the same things twice or overwrite each other (especially with Express Checkout)

Express Checkout was definitely a huge step, let's see how to further improve things now.