PrestaShop crypto payments: create the order after payment
A PrestaShop payment module that creates the order before the customer pays leaves an order behind every time a shopper opens the crypto payment page and walks away: stock sits reserved, status emails can go out, and someone has to cancel it. The CoinStack module for PrestaShop 8 and 9 waits instead. It creates the order only when a payment is detected, sets it to Awaiting crypto payment, and moves it to Payment accepted when the checkout completes. An abandoned checkout creates no order at all.
Why do redirect payment methods leave phantom orders?
Crypto at checkout is what PrestaShop's developer documentation calls an external payment scenario: the store "uses $action parameter to redirect to the PSP", the payment happens on the provider's page, and the provider usually sends the store a webhook with the result. The same page describes two module designs. Some modules "create the Order with a pending order status during the payment processing" and others "wait for the payment system's approval to create it".
With cards, the gap between redirect and result is usually short. With crypto it can be much longer, and some attempts never finish. The customer lands on the checkout page, picks a token and network, then switches to a wallet app or an exchange to send. Every one of those steps is a point where the customer can stop. If the module created an order at the redirect, each of those visits is now a real PrestaShop order in an awaiting status.
That order costs you three things:
- Reserved stock. PrestaShop's stock overview defines reserved stock as the quantity "currently in an open customer order", and "Physical stock - Reserved stock = Available stock". A product with 3 units, opened at the crypto step by 3 shoppers who never pay, shows 0 available until someone cancels the 3 orders.
- Emails. Order statuses can be set to "Send an e-mail to customer when his/her order status has changed", per the statuses page. A shopper who never paid receives mail about an order they think does not exist, and may write to support asking about it.
- Clean-up and bad numbers. Unpaid orders pile up in the order list, inflate conversion figures, and need a person or a cron job to cancel them, which then sends more emails.
How does creating the order on payment work?
The CoinStack module splits the flow into a checkout, which lives in CoinStack, and an order, which lives in PrestaShop and appears only when money is on its way. Each step below is what the module does for you.
| What happens | What the module does | PrestaShop order |
|---|---|---|
| Customer chooses Pay with crypto and places the order | Creates a checkout for the cart total and sends the customer to it | None yet. The cart is untouched |
| Customer follows the link back to the shop without paying | Closes the unpaid checkout and returns them to checkout with their cart | None |
| Customer closes the tab | Nothing. The checkout expires on its own | None |
| Customer returns to pay with the same cart | Sends them to the same checkout if it has more than 10 minutes left, or makes a new one | None |
| A payment is detected | Creates the order from the cart | Awaiting crypto payment |
| The checkout is completed | Records the payment on the order | Payment accepted |
The order reference is chosen when the checkout is created, not when the order is. The checkout page shows the customer "Order" followed by that reference, and the order created later gets the same one, so the number on the customer's screen matches your back office.
If the cart total or currency changes before the customer comes back to pay, the module closes the old unpaid checkout and creates one for the new total, so the customer is never sent to pay a stale amount.
The module learns about changes in two ways: a webhook it registers for itself during setup, and a check when the customer comes back through the return link. Either way, it asks CoinStack for the checkout's current status before it changes anything in PrestaShop, so a request that merely claims to be an update cannot create or pay an order. Updates for one cart are handled one at a time, which means a webhook and the customer's return arriving in the same second cannot produce two orders.
Which order statuses does the module use?
| Status | Set when | Who owns the status |
|---|---|---|
| Awaiting crypto payment | A payment was detected and the checkout is confirming or partly paid | Added by the module when you install it |
| Payment accepted | The checkout is completed, or you resolve an underpaid one | PrestaShop default |
| Payment error | A partly paid checkout expired, or the amount paid does not match the order total | PrestaShop default |
| Canceled | A detected payment could not be processed and was returned to the sender, and the checkout then expired with nothing received | PrestaShop default |
While an order is at Awaiting crypto payment, the customer's order page shows where it stands. A confirming payment gets a message that they can close the page. A partial payment gets a message and a Pay with crypto button that opens the same checkout, so they can send the rest to the same address. PrestaShop sends whatever emails you have attached to these statuses under Shop Parameters > Order Settings > Statuses.
How long an order stays at Awaiting crypto payment depends on the network the customer paid on: usually seconds to a few minutes. How long do crypto payments take? has the figures by network.
What happens when the cart changed after the checkout opened?
A customer opens the crypto checkout for a 60 EUR cart and copies the address. In another tab they add a 15 EUR item, then send the original amount from their wallet. CoinStack completes the checkout for 60 EUR, but the cart, and so the order created from it, is now 75 EUR.
The module does not mark that order paid. It moves the order to Payment error and leaves a private note in the order's messages with both figures: what the checkout was paid for and what the order totals. You then decide. You can create a checkout by hand in the CoinStack dashboard for the 15 EUR difference and send the customer its link, or refund the 60 EUR from your wallet and ask them to order again.
The same check protects you against an order edited in the back office between payment detection and completion.
What if the customer pays twice?
There are two variants.
Crypto after another payment method. The customer opens the crypto checkout, gives up, pays the same cart by bank transfer (which creates the order), and then their crypto payment arrives after all. The module will not create a second order for a cart that already has one. It leaves a note on the existing order saying the checkout was also paid for that cart, with the amount, so you can refund one of the two payments.
A completed checkout for an order that already moved on. If staff marked the order paid or shipped by hand before the checkout completed, the module leaves a note and does not record the payment a second time. Check whether the customer also paid another way.
When a customer really did pay twice, the extra money is already in your wallet as USDC. Refunds are always sent by you from that wallet; how to refund a crypto payment covers getting the customer's address and choosing the token and network.
Partial, over and late payments
Partial. A shortfall within your underpayment allowance (0.5% of the total by default, set under Settings, then Underpayment, in the CoinStack dashboard) still completes the checkout and the order goes to Payment accepted. A bigger shortfall leaves the order at Awaiting crypto payment while the customer can still send the rest. If the checkout expires first, the order moves to Payment error with a note showing how much has arrived against the checkout's value, both in US dollars. Selecting Mark as resolved on the checkout in the CoinStack dashboard moves the order to Payment accepted; otherwise refund what arrived. Underpaid crypto payments helps with that decision.
Over. A payment more than 2% above the total completes normally, and the module adds a note that the customer overpaid. All of it settles to your wallet, and refunding the difference is your choice.
Late. A payment that reaches the address after the checkout expired still counts if it covers the amount: CoinStack completes the checkout and flags it late. The module then creates the order and marks it paid. If that cart had become an order some other way in the meantime, you get the "also paid" note from the previous section instead. Overpaid and late crypto payments covers whether to fulfill or refund when the goods are gone.
How does creating the order on payment change stock and order lists?
Creating the order on payment is the better default for crypto, but it moves a few things.
- Stock is allocated when the payment arrives. Unpaid visits to the payment page never lock stock; the order and its stock movement are created when a payment is detected.
- Find the pre-payment checkout in CoinStack. Before payment, the checkout is in your CoinStack dashboard, and its reference is the future order reference with a
PS-prefix. - Abandoned crypto attempts are invisible in the order list. That is the point, but if you follow up abandoned carts, use PrestaShop's cart data rather than looking for unpaid orders.
The module is offered only for currencies you tick for it under Payment > Preferences, a restriction PrestaShop's payment preferences page describes for every payment module, and only where CoinStack accepts that currency. Installation and the API key are covered in the PrestaShop setup guide, and if you are still choosing a module, PrestaShop crypto payment modules compared looks at the others.
What if a payment arrives but no order appears?
The order depends on the update reaching your shop. The CoinStack PrestaShop docs list the two usual blockers: the shop address must start with https:// and have a valid certificate, and your firewall or security module must allow outside POST requests to index.php?fc=module&module=coinstack&controller=webhook (or module/coinstack/webhook with friendly URLs on). Errors are written to Advanced Parameters > Logs. Because the module also checks the checkout when the customer comes back through the return link, a customer who returns usually triggers the order even while the webhook is blocked, which can hide the problem until a customer closes the tab instead.
Frequently asked questions
Does a customer who abandons the crypto checkout get an order email?
No. No order exists until a payment is detected, so PrestaShop has nothing to send. The customer keeps their cart and can pick another payment method. Their unfinished checkout stays in your CoinStack dashboard and expires on its own, 24 hours after it was created by default.
What does the customer see when they come back from the checkout page?
The module checks the checkout first. If a payment has been detected, the order exists by then and the customer lands on PrestaShop's order confirmation page. If a payment is on its way but the order is not there yet, they see a notice that the payment is being processed and that an email follows once the order is confirmed. If nothing was paid, they return to checkout with their cart.
Can I refund a crypto order from the PrestaShop back office?
You send the refund from your own wallet, on your own timing, and record it in PrestaShop for your books. Send the customer the amount you agree on, in a token and network their wallet accepts, then note the transaction on the order.
Why did an order appear already at Payment accepted?
Some payments complete within seconds. If the checkout is already completed when the module first hears about it, the order is created and paid in the same step, so its history shows Awaiting crypto payment and Payment accepted a moment apart. That is normal and not a sign that anything was skipped.