Skip to content

Conversation

@masterjanic
Copy link

What?

This PR adds basic support for Mollie as payment adapter to the ecommerce plugin.

Why?

Currently, only Stripe is supported for taking payments. However, Mollie is one of the largest PSPs in the European Economic Area.

We can utilise the existing adapter pattern and create a new adapter that supports one-time payments in a similiar way.

How?

The current adapter configuration is cloned and tailored to the Mollie ecosystem.

There are some important changes/limitations to note:

  • Mollie's webhooks only send payment status updates - they need to be fetched and there is no webhook secret. The implementation of the webhook handler differs slightly.
  • Mollie's webhook endpoint needs to be publicly reachable even during development. A local tunnel is required for testing. A hint must be placed in the docs.
  • Payments must have a valid description that appears on bank statement.
  • Mollie does not support querying customers via email directly. A field must be added to the payload customers collection (missing docs / maybe better solution?).
  • Currently, there is no client side SDK.
  • A custom hook createPayment was introduced to bypass above limitations.

This pull request is just for basic support and may need some additional changes. There are more options that can be passed to the Mollie client, but only apiKey is implemented for now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the only way I could think of for now. Maybe there is a better solution, because this required the field mollieCustomerID to be present on the customers collection?


const shippingAddressAsString = JSON.stringify(shippingAddressFromData)

const parameters = await createPayment?.({
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a custom function/hook here. This way users can override the payment object. Its also required for passing webhookUrl. We may use this pattern on other adapters as well.

// This will appear on the customer's bank statement
// Use the cart ID as a description for now
description: parameters?.description || `${cart.id}`,
// TODO: billingAddress: {},
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that billingAddress and shippingAddress are still missing. I wasn't sure how they are implemented correctly, because they are not typed. A user may override them with the createPayment hook,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant