Skip to content

Commit 4132a7e

Browse files
committed
Add plugin option for setting an invoice expiry.
Defaults to 2hrs as most unpaid orders timeout in 2h.
1 parent 8d2ba52 commit 4132a7e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

woocommerce-gateway-lightning.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ public function init_form_fields() {
9999
'default' => 'You will pay using the Lightning Network.',
100100
'desc_tip' => true,
101101
),
102+
'invoice_expiry' => array(
103+
'title' => __('Invoice Expiry', 'lightning'),
104+
'type' => 'text',
105+
'description' => __('Time til an invoice expires. Examples: 2w (2 weeks), 1m (1 month), 3h (3 hours), 3600s (3600 seconds). Defaults to 2h.', 'lightning'),
106+
'default' => '2h',
107+
'desc_tip' => true,
108+
),
102109
);
103110
}
104111

@@ -116,6 +123,7 @@ public function process_payment( $order_id ) {
116123
'currency' => $order->get_currency(),
117124
'amount' => $order->get_total(),
118125
'description' => self::make_desc($order),
126+
'expiry' => $this->get_option('invoice_expiry', '2h'),
119127
'metadata' => [ 'source' => 'woocommerce-gateway', 'order_id' => $order->get_id(), 'url' => get_home_url() ],
120128
'webhook' => self::get_webhook_url($order->get_id())
121129
]);

0 commit comments

Comments
 (0)