Skip to Content
Docs
E-commerce pluginscommercetools

commercetools connector

Accept cards, wallets, and local payment methods in a commercetools storefront with the Pay.com connector for commercetools Connect.

The Pay.com connector for commercetools runs in commercetools Connect and adds Pay.com payments to a storefront built on Composable Commerce. 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, which your storefront mounts with the connector's browser component.

The connector validates the cart and locks it before any payment is taken, and creates the commercetools order only once it has confirmed the payment with Pay.com on its server.

To deploy the connector and connect it to your Pay.com account, see Set up the commercetools connector. Every setting and its default is in Settings.

Cart locking and order creation

On commercetools, an order is the signal that a purchase was placed. Subscriptions export it, send its confirmation, and reserve its stock. So the connector validates the cart instead of creating an unpaid order. When the customer places the order, it recalculates the cart, checks that it's complete, then freezes and locks it in one update, so your cart API Extensions can still refuse it before anything is charged. A locked cart can't change until the connector releases it, and the order is created from exactly that version of the cart once the payment is confirmed.

commercetools still checks stock and runs order API Extensions when it creates the order, after the payment. If it refuses the order, the connector refunds the charge or releases the authorization, unlocks the cart, and tells the customer. With Authorize, capture once the order exists, a refused order only releases an authorization.

Supported features

The connector supports these checkout and order management features.

FeatureDescription
CheckoutCards, wallets, and local payment methods. By default, the card is entered in secure fields in your storefront's layout, and your storefront lists the other payment methods, in one list or each as an option of its own. Apple Pay and Google Pay can be among them, each paid with its own button. Pay.com's Universal checkout can show every payment method instead. See Checkout.
CaptureCapture immediately, capture once the order exists, or authorize only and capture on fulfillment or from the order.
RefundsRefund a captured payment through commercetools' payment intents, from the Merchant Center or Checkout, in full or in part. Refunds made in the Pay.com dashboard reach the payment. Canceling the payment releases an authorization.
Payment reviewA payment that doesn't match its cart is held. Accept or Deny it under Held payments in the Pay.com application in the Merchant Center.
Express checkoutApple Pay and Google Pay buttons on the cart, on product pages, and at the top of the checkout, priced with your commercetools shipping methods. A product page button buys that one product. At the top of the checkout, the order is placed from the details the wallet collects, not from the checkout form. The wallet asks for a phone number when you list phone among the checkout's required fields.
Saved cardsSigned-in customers can save a card when they pay in Pay.com's Universal checkout, pay with it later, and add or delete cards from their account. With card fields, a card is saved at checkout only for a Recurring Order. Pay.com keeps the card.
Recurring OrdersEach cycle of a commercetools Recurring Order is charged to the card saved with its first order. A first cycle that costs nothing saves the card without a charge. The card is saved even with saved cards turned off, and is then kept only for the Recurring Order.
Apple Pay domainThe connector serves Apple's domain association file for your storefront to pass on, and registers your storefront's domains with Apple through Pay.com.

How orders stay in sync

The connector confirms each payment with Pay.com on its server. Webhooks, and the connector's job every 5 minutes, reconcile payments when a customer closes the browser before returning to your store. The connector records each outcome on the commercetools payment it adds to the cart.

Pay.com outcomecommercetools
PaidThe order is created, with payment state Paid. The payment has a successful Charge transaction.
Authorized (manual capture)The order is created, with payment state Pending. The payment has a successful Authorization transaction to capture before it expires.
Funds pending, for example a bank debitThe order is created, with payment state Pending, until the funds clear. If they don't, it's Failed.
FailedNo order. The cart is unlocked, so the customer can pay again.
Requires manual reviewThe order is created, with payment state Pending, and the payment moves to the pay-com-review state with the reason.

A customer who goes back to change the cart releases it. The connector blocks the payment session first, and keeps the cart locked while a payment is in flight. A cart that stays locked and unpaid for the pending timeout is released the same way.

A payment that completes after its cart was released still creates the order when the cart is as it was. Otherwise it's refunded, or its authorization released.

The connector subscribes to the 12 shared plugin webhook events.

Capture and refunds

Capture, refund, and cancel payments through commercetools' payment intents, as the Merchant Center and Checkout do, or add a transaction in the Initial state to the payment through the API. The connector runs it and sets its state. A refund after a manual capture goes through the capture's charge.

With Authorize only; capture on fulfilment or from the order, the order's shipment state reaching Shipped or Delivered, or the order becoming Complete, captures the authorization. A capture that fails puts the payment in review. Canceling an authorized order releases its authorization.

Apple Pay

The Apple Pay button shows only on a domain registered with Apple. Proxy /.well-known/apple-developer-merchantid-domain-association on your storefront's domain to the same path on the connector's service, which serves Pay.com's file. Then, under Apple Pay domains in the Pay.com application, enter the domain in Storefront domains and click Register. Pay.com asks Apple to check the file. The sandbox and live register separately, and the storefront must be on HTTPS at the root of its domain.

Data the connector sends

The connector and its browser component communicate with Pay.com as follows:

  • The browser component loads Pay.com.js from https://js.pay.com/v1. Card details are entered in Pay.com frames and sent only to Pay.com. Details a payment method asks for, such as a BLIK code or a bank, are also sent only to Pay.com, not to the connector.
  • The connector calls the Pay.com API (https://api.pay.com/v1, or https://api.sandbox.pay.com/v1 for the sandbox) to create payment sessions, to confirm, capture, and refund payments, to manage saved cards, and to read your account's payment methods.
  • For Apple Pay, the connector downloads Apple's domain association file from Pay.com at most once a day, and sends your domains to the Pay.com API when you register them.
  • Neither your storefront nor the Merchant Center gets a Pay.com key. They call the connector with the customer's commercetools session or a commercetools token.

API keys and webhook secrets are kept in the deployment's secured configuration, and the Pay.com application never shows more than a key's last characters.

Was this page helpful?