Auto-capture order payment after 30 days, with Mechanic.

Mechanic is an automation development platform for Shopify. :)

Auto-capture order payment after 30 days

by Isaac Bowen (team@usemechanic.com)

Short and simple. Captures order payment for un-cancelled orders that have a financial status of "authorized", after waiting 30 days (or another timespan of your choice).

Runs 30 days after an order is created. Configuration includes days to wait before capturing.

15-day free trial – unlimited tasks

Documentation

This task captures order payment for un-cancelled orders that have a financial status of "authorized", after waiting 30 days (or another timespan of your choice).

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Gurus, everybody.

That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.

Events
30 days after an order is created (shopify/orders/create+30.days)
Options
days to wait before capturing (number, required)
Script
{% comment %}
  Since we're running on a delay, make sure we have up-to-date data.
{% endcomment %}
{% assign order = order.reload %}

{% assign order_qualifies = false %}
{% if order.financial_status == "authorized" and order.cancelled_at == blank %}
  {% assign order_qualifies = true %}
{% endif %}

{% if event.preview or order_qualifies %}
  {% action "shopify" %}
    [
      "post",
      "/admin/orders/{{ order.id }}/transactions.json",
      { "transaction": { "kind": "capture" } }
    ]
  {% endaction %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Defaults
Days to wait before capturing
30