Skip to main content
More in Learn

Payment Gateways

A payment gateway facilitates a payment transaction by the transfer of information between a payment portal (such as a website, mobile phone, or interactive voice response service) and the frontend processor or acquiring bank.

Payment Integrations with Crystallize

Crystallize is agnostic when it comes to payments and you can work with any payment gateways you’d like.

The way it works is that you can save payment information on the order or on a subscription contract.

Common Flow

Payment flow is most likely the same with any gateway, please refer to the documentation to each of them, but it goes like this:

  • The checkout process is towards the end, and you want your user to pay for their cart
  • The checkout page will load a form from the payment gateway or a link to an external form hosted by the payment gateway
  • The user will input their payment information
  • The payment gateway will return information (maybe via redirection)
  • The UI will be updated for the user

And an invisible, asynchronous, server-to-server, crucial step: the payment gateway will call your service layer to notify the payment status.

Don’t validate the payment from the client side, it’s not secure

To make it even more secure, most payment gateways will sign their server-to-server requests.

Flow with Crystallize

Crystallize integrates smoothly at any point within this process, because you just need to mutate the payment information.

The mutation type includes specific payment gateways for semantic purposes, and we’ll be adding more of these over time. If your payment gateway does not have yet its corresponding type, you can use the Custom payment type, which is a key-value store.

When to Save the Order

This is a different topic, as it may require storage for the cart, but you have two main options:

  • save the Order in Crystallize before payment, then update the order with the payment information
  • save the Order in Crystallize after payment, then add the payment information directly

Existing Integrations

You can find existing integrations in our boilerplates and apply them to your own projects:

Order Fulfilment

Payment is the end of the checkout process and the beginning of the post-paid order lifecycle. Crystallize has a powerful fulfilment mechanism that you need to check out (or watch our livestream).

What happens is totally up to how you run your business. We advise you to set up proper fulfilment pipelines to orchestrate the orders, which you can use to manage order fulfilment in a structured and automated way.

Local Development Tips and Tricks

While you are developing on your local machine, payment gateways won’t be able to reach your computer. Using ngrok is usually the simplest and most efficient trick.

People showing thumbs up

Need further assistance?

Ask the Crystallize team or other enthusiasts in our slack community.

Join our slack community