This plugin will enable the connection between your app and WooCommerce orders for digital credits usage. It can be used to check the remaining credits in one order, or consume them.
Redirect to your app link on order paid page, carring on the order key.
Let’s assume the order_key=
wc_order_xQhmRjJ7, your app URL is
https://app.EXAMPLE.com/refill, your WordPress URL is
On the order Thank You page, show a button
<a href="https://app.EXAMPLE.com/refill?order_key=wc_order_xQhmRjJ7">Go back to app.EXAMPLE</a>.
$_POST[ 'num' ] = 'max', assume the consumed credits is 42 in returned JSON.
Add 42 credits into the corresponding user account.
1) Show balance:
// NOTE: only the order with status=
completed can be consumed credits.
2) Consume 100 credits:
[ 'num' => 100 ]
3) Consume all credits:
[ 'num' => 'max' ]
If an order contains only items that have valid credit in product detail, once the order is paid, the status will change to
completed automatically instead of
The reason to do this is because some unpaid getways (Bank Wire, Cheque, Cash on delivery) will have status
processing once the order is placed while not paid. Thus we can’t use
processing to detect if the order is paid or not.
To make the credits in the orders with the unpaid gateways available, please update the order status to
Description: The order key doesn’t match any order.
Description: The order isn’t in processing/completed status, maybe not paid yet?
Description: Need to specify the ammount to consume. Either numeric or a fixed string
Description: Not enough balance left in this order.