1

We are using Stripe on our website. Craft CMS 2.6.2997 and Commerce 1.2.1351. Can we use the apple pay function?

I read the Stripe document(https://stripe.com/docs/stripe-js/elements/payment-request-button#html-js-testing-chrome). It seems possible to do that. But, I am not sure is it work on Commerce 2...

Anyone know?

Thanks!

3

Quick answer.

Yes you can use Apple Pay with Craft Commerce and the first-party Stripe Gateway Plugin.

In order to do that, you need to customise your template and add the functionality for the Payment Request button. What this does is more or less generating a charge promise token for Stripe (same way it does for card).

Charging the token is then handled by the gateway itself as you would with a card charge.

You can choose to display the button by checking if a relevant Payment API is supported with paymentRequest.canMakePayment() method.

I hope this helps in terms of a high overview.

[EDIT]

The above answer was for use with Craft Commerce 2, as originally set by the question.

Requirement changed to Commerce 1.

The quick answer is still yes. We have completed a similar task before (with Stripe Elements and Stripe Sources), though that's before SCA. But Elements are SCA ready as far as I know and you need to use the PaymentIntents API PaymentMethods API.

Difference is that the main Stripe Gateway for commerce 1 (by omnipay) doesn't seem to support webhooks from Stripe, which informs your system whether a token (Source at the time) can be charged or not.

Hence, you need to build kind of your own plugin that loads an extra stripe gateway either new or extending the existing Stripe gateway class (extending is easier as you don't need to rebuild everything). Might need to add a custom Payment Form to your plugin.

  • You still need to build a custom template.
  • The template should use Stripe elements.
  • Logic is same, chargeable promise token which you need to charge.
  • Request for charging
  • Await webhook that notifies your system if your intent can be charged
  • And then continue with charging if available, otherwise inform user for any errors.

That's still a high overview of how the process works. You would need to use Payment Intents API and Payment Methods API

[/EDIT]

| improve this answer | |
  • Thanks so much for the clear answer!! I will work on it next week. Thank you! – Sam Cheung Feb 20 at 6:46
  • No problem at all. FYI, we handled the waiting for webhook process, by keeping the user on the checkout screen (with a spinner to show process being done) and hitting a custom endpoint of the plugin using AJAX that would inform us when the token can be charged before continuing. Feel free to mark it as accepted answer if everything worked for you. – RoussKS Feb 20 at 9:02
1

Have you seen this plugin? -> https://plugins.craftcms.com/web-payments

edit: this is an answer for Craft 3/Commerce 2

| improve this answer | |
  • Yes, I read it. But, we are using Craft 2, not Craft 3... – Sam Cheung Feb 18 at 6:48
  • If you are using Craft Commerce 2, you should be using Craft CMS 3. The plugin doesn't need Craft Commerce. I believe you just got a bit confused there. Answer below – RoussKS Feb 18 at 14:07
  • Wait, you can actually run Commerce 2 on Craft 2? – dmatthams Feb 18 at 15:47
  • Oh.. we are using Craft CMS 2.6.2997, Commerce 1.2.1351 – Sam Cheung Feb 19 at 6:44
  • that kind of changes the whole answer to your query. it's still doable though. – RoussKS Feb 19 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.