Skip to main content

Saleor

To accept payments through MONEI in your Saleor store, install the official MONEI Payment App. MONEI hosts the app. It follows the Saleor payment app architecture and communicates with Saleor through synchronous webhooks. You configure it in Saleor Dashboard and add payments to your storefront with the @monei-js/saleor package.

This page describes app version 1.0.0 and later

Version 1.0.0 replaces the 0.1.0 app. If you installed 0.1.0, install the new app from its manifest URL, configure MONEI in Saleor Dashboard and map your channels. There are no payments or settings to migrate.

Features​

  • Hosted and onsite checkout — Send the buyer to the MONEI , or show MONEI components in your storefront.
  • Configuration in Saleor Dashboard — Connect with MONEI or enter an API key. Create Test and Live configurations and map each channel to one of them.
  • Authorize and capture later — all or part of an , or cancel the full authorization.
  • Refunds from Saleor — Request full or partial refunds in Saleor Dashboard, and record refunds that you made in MONEI Dashboard.
  • Saved cards — Signed-in buyers can save a card, pay with it again, or delete it.
  • Status from the MONEI API — The app checks the signature of each MONEI callback and reads the payment status from the MONEI API.

Supported payment methods​

Payment methodHostedOnsite
Cards, Bizum, PayPal, Apple Pay, Google PayYesYes
MB WAY, MultibancoYes—

Hosted checkout sends the buyer to the MONEI payment page. Onsite checkout displays MONEI components in the storefront. Bizum, MB WAY and Multibanco charge immediately, even in an authorization channel. These three methods require EUR.

Once MONEI Flex is activated for your account, eligible customers in Spain can also split a card payment into monthly installments.

Enable each payment method that you offer in MONEI Dashboard → Settings → Payment methods.

Requirements​

ComponentSupported versions
Saleor3.23 or later, 3.x series

You also need:

  • A MONEI account with the payment methods that you want to offer.
  • A Saleor GraphQL API that the app can reach over HTTPS on a public IP address.
  • Currencies with exactly two decimal places. See Limits.

Before you begin​

To test your integration:

Install​

  1. In Saleor Dashboard, open Extensions. Select Add Extension, then Install from manifest.
  2. Enter the manifest URL https://saleor.monei.com/api/manifest and select Install. If you host the app yourself, see Self-hosting.
  3. Approve the installation. Saleor uses the manifest to register the webhooks. The app requests MANAGE_USERS to link Saleor users with MONEI customers and to delete the linked customers when a user is deleted.
  4. Open MONEI in Saleor Dashboard.

Configure​

  1. Select Add configuration.
  2. Enter a name. Select Test or Live.
  3. Select the payment methods to offer. Enable these methods in your MONEI account.
  4. Use one of these methods to supply credentials:
    • Select Connect with MONEI. Approve access in the MONEI window. The MONEI window and Saleor Dashboard show the result for each mode, for example Test connected.
    • Enter a MONEI API key for the selected mode. Select Save configuration.
  5. In Channel mappings, select a configuration for each channel that accepts MONEI payments.

Each channel can use one configuration. Multiple channels can use the same configuration. Unmapped channels offer no MONEI payment methods. The app encrypts saved credentials.

To connect an existing configuration, select Connect with MONEI or Reconnect with MONEI on its row. Connect saves the credentials that MONEI supplies for each mode. The configuration's selected mode stays the same.

Order ID prefix​

The app adds the optional Order ID prefix to each MONEI orderId. Use up to eight letters, digits, underscores or hyphens. Use different prefixes for stores that share a MONEI account.

Change or delete a configuration​

The app uses the configuration, mode and MONEI account of the original payment for later actions. Deleting a configuration removes its channel mappings. The app keeps its credentials for existing payments. If you replace the credentials with those of a different account, restore credentials for the original account before you act on its payments.

If Saleor asks you to review configurations after a reinstall, select Use these configurations or Delete them. New payments require a confirmed setup and an active channel mapping.

A replacement Saleor instance with the same GraphQL URL, app ID and signing keys inherits the existing configuration confirmation state. If the configurations were already confirmed, the review prompt can be skipped.

After Saleor rotates its signing keys, re-register the app with Saleor and confirm or delete the existing configurations. The app accepts signatures from the newly registered keys after registration.

Storefront integration​

Use the @monei-js/saleor package to list methods, start payments, check the result and manage saved cards. Install it with @monei-js/components version 2:

npm install @monei-js/saleor @monei-js/components@^2

Pass a GraphqlClient to the functions that call Saleor. The client takes a query and variables, and returns the GraphQL response's data object. Make the client throw on HTTP or GraphQL errors. Use the buyer's Saleor access token when the buyer signs in.

FunctionWhat it does
getMethods(client, checkoutId)Returns methods, livemode and storedPaymentMethods. If Saleor offers no MONEI configuration, livemode is undefined.
startPayment(client, options)Starts a Saleor transaction. Pass checkoutId, method, flow and an absolute HTTPS returnUrl. The app uses that URL after success, failure or cancellation.
payHosted(result)Sends the browser to the MONEI page. Call it when the result contains a redirectUrl.
mountOnsite(result, element, { method, language })Adds a MONEI component to the given element for one payment attempt. Pass language if you want to set the language.
confirmStoredCard(result)Starts any required confirmation for a saved card in the onsite flow.
finish(client, transactionId)Calls Saleor to check the transaction. Call it after an onsite attempt or when the browser returns from a redirect.
deleteStoredCard(client, channelSlug, card.id)Deletes a saved card. Pass its Saleor id.

Use "hosted" or "onsite" for flow. The method IDs are card, bizum, paypal, applePay, googlePay, mbway and multibanco. Use the hosted flow for MB WAY and Multibanco.

startPayment and finish return a PaymentResult with the Saleor transactionId. Save the transactionId before you redirect or mount the component. If the app cannot determine the payment status, it returns pending: true. finish rechecks every three seconds for up to two minutes. If it still returns pending: true, show a pending message and check the same transaction later.

The storefront guide has the full result handling and a checkout example. The test storefront also creates the checkout and sets the delivery method.

Complete the checkout​

Set checkoutSettings.automaticCompletion.enabled to true for the channel in Saleor. Saleor can then create the order when the buyer leaves the page. A callback can confirm the funds while the buyer is away. The default delay is 30 minutes.

The storefront can call checkoutComplete when Saleor shows that the checkout has sufficient charges or authorizations. If Saleor already completed the checkout, show the existing order.

Content Security Policy​

For onsite payments, add https://js.monei.com to script-src and frame-src. Add https://api.monei.com to connect-src. Keep your storefront's Saleor API origin in connect-src.

Allow the inline styles that the MONEI components use. For onsite PayPal, also allow the origins that the PayPal JavaScript SDK uses. See the PayPal Content Security Policy guide.

Onsite Apple Pay​

  1. Download the MONEI domain association file. See Register Apple Pay domain.
  2. Serve the file at /.well-known/apple-developer-merchantid-domain-association on your HTTPS storefront. The URL must return HTTP 200 with the file content.
  3. In Saleor Dashboard, open MONEI. Select Register Apple Pay domain on the configuration for your channel.
  4. Enter the storefront hostname without a scheme, port or path. Submit it to register the domain with MONEI.

Payment status​

The app reads the payment status from the MONEI API. When MONEI sends a callback, the app checks its signature and fetches the payment. If the signature is unavailable or invalid, the app can fetch only a payment it already has on record for that configuration. The app reports the status from the API to Saleor.

Capture or cancel an authorization​

Set the channel's transaction flow to Authorization to hold funds for later capture. Bizum, MB WAY and Multibanco charge immediately, even in an authorization channel.

To capture funds, request a charge on the transaction in Saleor. Enter the full amount, or a smaller amount if your MONEI account supports partial capture. As in the MONEI plugin for WooCommerce, one partial capture releases the rest of the authorization. Saleor records the charge and the released amount. If MONEI refuses the capture, Saleor shows the reason.

To release the full authorization, cancel the transaction in Saleor. The app supports full cancellation only.

Refunds​

In Saleor Dashboard, request a full or partial refund on the transaction. To settle a granted refund, open it and select Transfer funds. The app reads the current refund totals from Saleor and MONEI for each request. When they agree, it asks MONEI to refund up to the remaining captured amount. Saleor retries if the app cannot read its current total.

To record a refund that you made in MONEI Dashboard, compare the total refunded on the same payment in both dashboards. In Saleor, request a refund for exactly the amount missing from its total. The app records the difference in Saleor without sending another refund to MONEI.

The app shows these messages on the Saleor transaction when it cannot complete the request:

MessageWhat to do
MONEI shows refunded funds that Saleor does not show. The message gives the missing amount.Request a refund for exactly that amount in Saleor.
Saleor shows more refunded than MONEI.Contact support.
A previous refund is still being confirmed.Wait a few minutes. Check the totals before you try again.

The app sets a marker for the payment when it sends a refund to MONEI or confirms an existing refund from the totals. After confirmation, the marker blocks other requests on the payment until the app sees that Saleor recorded the refund, for up to one minute. The marker lasts up to ten minutes when MONEI's result is unknown. A retry of the original request can check the totals again. A clear refusal from MONEI clears the marker.

Saved cards​

A signed-in buyer can save a card while paying, pay with it again, or delete it. The buyer must own the checkout to save or reuse a card. MONEI stores the card. The app keeps the payment token on the server. Saved cards are specific to the MONEI account and mode. When a staff member deletes a customer or a buyer deletes their Saleor account, the app tries to delete the linked MONEI customers.

In the storefront, use the signed-in checkout owner's client:

  • Start a card payment with saveCard: true to ask MONEI to save the card on success. Use getMethods to list the buyer's saved cards.
  • To pay with a saved card, set method: "card" and pass the card's paymentMethodId as storedPaymentMethodId to startPayment. For an onsite payment, save the transaction ID and call confirmStoredCard(result) in place of mountOnsite. Then call finish(client, result.transactionId).
  • To delete a card, call deleteStoredCard(client, channelSlug, card.id).

Saleor clears its cached list after a successful charge, authorization or deletion. At other times the list can be up to five minutes old.

Limits​

  • The app supports currencies with exactly two decimal places.
  • MONEI sends no callbacks for expired authorizations, captures, voids or refunds. Saleor can still show an expired authorization as active. A capture request then shows the reason from MONEI if MONEI refuses it. To record a refund made in MONEI Dashboard, see Refunds.
  • Cards, Bizum, Apple Pay and Google Pay share one order ID per checkout. The duplicate check allows one successful authorization or charge for that ID. A new attempt with one of these methods cancels earlier pending payments that use this order ID. The buyer must use the new payment page or form.
  • If you replace an account's credentials, an earlier payment on that account can block a new payment for the same checkout with these methods. Pending payments expire at MONEI. Restore the original account's credentials so the app can verify the earlier payment before it allows another attempt.
  • MONEI can accept two payments if both pass the duplicate check before its index updates. Saleor then shows an overcharge. Refund one payment.
  • If the checkout total increases after a card, Bizum or wallet payment, MONEI blocks another payment with these methods. Pay the balance with PayPal, MB WAY or Multibanco if available. Staff can also refund the first payment.
  • MONEI can keep the checkout order ID blocked after a void or full refund. This can occur when Saleor releases funds for an expired checkout. Use PayPal, MB WAY or Multibanco if available, or start a new checkout.
  • PayPal, MB WAY and Multibanco use a new order ID for each attempt. A buyer can pay an older attempt and then pay on a different attempt. Saleor records both transactions and shows an overcharge. Refund one payment.
  • If the app loses the response to a new payment and MONEI leaves it pending, the buyer gets no payment URL. The app waits two minutes for a payment record. When Saleor reports failure, the buyer can try again. The unused payment expires.
  • A refund can reach the buyer before MONEI adds it to the payment total. If the app also loses the response, a retry after MONEI's three-second duplicate check can send a second refund.
  • If the app fails to link a payment to Saleor and its original credentials are replaced, the app can lose the ability to verify the payment callback. This leaves the payment unlinked.
  • Connect shows the app hostname in the consent screen and in the default key name. You can rename the key in MONEI Dashboard.
  • Uninstalling the app leaves MONEI customers and app records in place. Delete customers in MONEI Dashboard if you no longer need them.

Self-hosting​

MONEI hosts the app. To host it yourself on AWS, follow Self-hosting in the app README. Then install the app from <PUBLIC_BASE_URL>/api/manifest.

Before you go live​