Generate payment URL in custom email [closed]

The correct method for generating a payment URL is:

get_checkout_payment_url()

So my code changed to to:

$payment_page = $order->get_checkout_payment_url();

Which generates the following URL:

http://www.example.co.za/checkout/order-pay/[order-number]?pay_for_order=true&key=order_[order-key]

Which is what I was looking for.

Note that the order status must be set to unpaid or pending in order for the generated link to be valid

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)