Mechanic is a development and ecommerce automation platform for Shopify. :)
This task will scan for all orders that have a financial status of "authorized", and will capture payment for them. This task can be scheduled to run daily, and can be run on demand.
Runs Occurs when a user manually triggers the task. Configuration includes include partially paid orders, run daily, and hours to wait after midnight when running daily.
This task will scan for all orders that have a financial status of "authorized", and will capture payment for them. This task can be scheduled to run daily, and can be run on demand.
This task will scan for all orders that have a financial status of "authorized", and will capture payment for them. Enable "Run daily" to perform this every day at midnight, or use the "Run task" button to perform this scan on demand.
Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Shopifolks, 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.
(By the way, have you seen our documentation? Have you joined the Slack community?)
{% if options.run_daily__boolean %}mechanic/scheduler/daily{% if options.hours_to_wait_after_midnight_when_running_daily__number %}+{{ options.hours_to_wait_after_midnight_when_running_daily__number | times: 60 | round }}.minutes{% endif %}{% endif %} mechanic/user/trigger
{% if event.preview %} {% action "shopify" %} mutation { orderCapture( input: { id: "gid://shopify/Order/1234567890" parentTransactionId: "gid://shopify/OrderTransaction/1234567890" amount: "10.00" currency: {{ shop.currency }} } ) { userErrors { field message } } } {% endaction %} {% else %} {% assign cursor = nil %} {% assign conditions = array %} {% assign conditions[0] = "financial_status:authorized" %} {% if options.include_partially_paid_orders__boolean %} {% assign conditions[1] = "financial_status:partially_paid" %} {% endif %} {% for n in (0..100) %} {% capture query %} query { orders( first: 200 after: {{ cursor | json }} query: {{ conditions | join: " OR " | json }} ) { pageInfo { hasNextPage } edges { cursor node { id transactions( capturable: true ) { id kind } totalCapturableSet { presentmentMoney { amount currencyCode } } } } } } {% endcapture %} {% assign result = query | shopify %} {% for edge in result.data.orders.edges %} {% assign transaction = edge.node.transactions | where: "kind", "AUTHORIZATION" | first %} {% action "shopify" %} mutation { orderCapture( input: { id: {{ edge.node.id | json }} parentTransactionId: {{ transaction.id | json }} amount: {{ edge.node.totalCapturableSet.presentmentMoney.amount | json }} currency: {{ edge.node.totalCapturableSet.presentmentMoney.currencyCode }} } ) { userErrors { field message } } } {% endaction %} {% endfor %} {% if result.data.pageInfo.hasNextPage %} {% assign cursor = result.data.orders.edges.last.cursor %} {% else %} {% break %} {% endif %} {% endfor %} {% endif %}