Magento module
Accept cards, wallets, and local payment methods in a Magento 2 or Adobe Commerce store with the Pay.com module.
The Pay.com module for Magento 2 and Adobe Commerce adds Pay.com as a payment method at the Luma checkout. Customers pay with the cards, wallets, and local payment methods your Pay.com account offers, in a payment form rendered in Pay.com-hosted frames.
Magento places and validates the order before any payment is taken, and the store confirms every payment with Pay.com on its server before it marks the order paid.
To install the module and connect it to your Pay.com account, see Set up the Magento module. Every setting and its default is in Settings.
Supported features
The module supports these checkout and order management features.
| Feature | Description |
|---|---|
| Checkout | Cards, wallets, and local payment methods at the Luma checkout. By default, the card is entered in secure fields styled like your checkout, and each payment method is an option of its own. See Checkout settings. |
| Capture | Capture when the customer pays, or authorize at checkout and capture by invoicing the order with Capture Online. With Capture when the order ships, the first shipment captures the authorization. |
| Refunds | Refund a captured payment online from a credit memo, in full or in part. Void, or canceling an order that is only authorized, releases the authorization. |
| Payment review | A payment that doesn't match its order waits in Payment Review. Accept Payment takes it as it is, and Deny Payment refunds the payment and cancels the order. |
| Express checkout | Apple Pay and Google Pay buttons on product pages, the cart page, the mini-cart, and the top of the checkout page. Customers pay without going through the checkout form, and Magento still places and validates the order first. A product page button buys that one product and leaves the cart as it was. |
| Saved cards | Logged-in customers can save a card when they pay in Pay.com's payment form, pay with it later, and add or delete cards under My Account → Stored Payment Methods. With card fields, the default, cards aren't saved at checkout. Pay.com keeps the card. The store keeps only its brand, last four digits, and expiration date. |
| Apple Pay domain | The store serves Apple's domain association file and registers each website's domain with Apple through Pay.com. |
| Headless storefronts | Storefronts on Magento's GraphQL, such as PWA Studio, take payments through the mutations of the module's GraphQL companion. See Headless storefronts. |
How orders stay in sync
The store confirms each payment with Pay.com on its server. Webhooks, and a background check every 15 minutes on Magento's cron, reconcile payments when a customer closes the browser before returning to your store.
| Pay.com outcome | Magento order |
|---|---|
| Paid | Processing, with a paid invoice. Magento sends the order email. |
| Authorized (manual capture) | Processing, with an open authorization and a note to invoice the order with Capture Online before the authorization expires. |
| Funds pending, for example a bank debit | Payment Review, with no invoice and a note not to ship until the funds clear. |
| Failed | Canceled. The cart is kept, so the customer can pay again. |
| Requires manual review | Payment Review, with a note saying why. A paid order whose payment is disputed later goes On Hold. |
A payment that completes after its order was canceled is refunded, or its authorization released, with a note on the order. Before Magento's cleanup of pending orders cancels a Pay.com order, the module checks it with Pay.com. A paid order is settled instead, and an order with a payment in flight is kept.
A refund made in the Pay.com dashboard is noted on its order. Record it in Magento with an offline credit memo.
The module subscribes to the 12 shared plugin webhook events.
Apple Pay
The Apple Pay button shows only on a domain registered with Apple. Under Apple Pay domain in the settings, on the default scope or a website, click Register domain for each environment. The store sends its domain, the host of the website's secure base URL, to Pay.com, and Pay.com asks Apple to check the domain association file that the module serves. If Apple can't verify the domain, the settings page shows Apple's reason.
The store must be on HTTPS at the root of its domain. A real file at pub/.well-known/apple-developer-merchantid-domain-association takes precedence over the module's.
Headless storefronts
For a storefront that uses Magento's GraphQL, install the GraphQL module, pay-com/magento2-payments-graphql, next to this one. It adds these mutations to Magento's own, for the same flow. Magento places the order, then the browser pays.
| Mutation | What it does |
|---|---|
createPayComPaymentSession | Gives a cart a payment session to render Pay.com's payment form on. Charges nothing. |
attachPayComPaymentSession | Right after Magento's placeOrder with a Pay.com payment method, ties the session to the order's exact total. The browser pays once it returns READY, then goes to its return_url. |
payComOrderPaymentStatus | Called on the storefront's return page with the return URL's t parameter to confirm the payment with Pay.com, settle the order, and return the payment status. |
startPayComExpressCheckout, payComExpressQuote, placePayComExpressOrder | Apple Pay and Google Pay for a cart, priced with Magento's carriers and totals. |
With card fields and Each payment method is its own option, the defaults, Magento's available_payment_methods lists the card as pay_com, each of your payment methods as pay_com_<type>, such as pay_com_paypal or pay_com_applepay, and pay_com_other for the rest. They all pay the cart's one session. Set any of them with setPaymentMethodOnCart, then place the order and attach the session as with pay_com. In setPaymentMethodOnCart, payment_method.pay_com describes what the form pays. With code pay_com, method names the method it pays, and button: true means an Apple Pay or Google Pay button placed the order. An order for Apple Pay or Google Pay is refused without button: true. A storefront that uses only pay_com can set Payment methods at checkout to One option, with the payment methods listed inside it.
To pay with a saved card, set pay_com_vault with the card's public_hash in setPaymentMethodOnCart. Magento's customerPaymentTokens lists the cards. Set Headless return page to the storefront page customers come back to.
Data the module sends
The module communicates with Pay.com in three ways:
- The checkout page loads Pay.com.js from
https://js.pay.com/v1, through Magento's RequireJS. Card details are entered in Pay.com frames and sent only to Pay.com. The details a payment method asks for, such as a bank or a code, are sent only to Pay.com too. - The store's server calls the Pay.com API (
https://api.pay.com/v1, orhttps://api.sandbox.pay.com/v1for the sandbox) to read the payment methods your account offers, to create payment sessions, to confirm, capture, and refund payments, and to manage saved cards. - For Apple Pay, the store downloads Apple's domain association file from Pay.com at most once a day, and sends its domain to the Pay.com API when an administrator clicks Register domain.