Payment Gateway Solutions in Crystallize
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.
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.
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
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.
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.