{"id":467,"date":"2025-03-20T17:27:00","date_gmt":"2025-03-20T17:27:00","guid":{"rendered":"http:\/\/documentation.wpgetpaid.com\/?post_type=gd_place&#038;p=467"},"modified":"2025-03-26T14:46:53","modified_gmt":"2025-03-26T14:46:53","slug":"how-to-add-payment-link-to-invoices","status":"publish","type":"gd_place","link":"https:\/\/wpgetpaid.com\/documentation\/article\/code-snippets\/how-to-add-payment-link-to-invoices\/","title":{"rendered":"How to Add Payment Link to Invoices?"},"content":{"rendered":"\n<p>You can add a payment link to your invoices. Your users can then click the said link to pay for the items on the invoice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Adding a Payment Link to Invoices<\/h2>\n\n\n\n<p>Use the following code snippet to add a payment link below the items on your invoices:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_action( &#039;getpaid_email_cart_totals_total&#039;, function ( $invoice ) {\n\t\/* @var WPInv_Invoice $invoice *\/\n\tif ( $invoice-&gt;needs_payment() ) {\n\t\tprintf( &#039;&lt;div style=&quot;margin-top: 10px;&quot;&gt;&lt;a href=&quot;%s&quot;&gt;%s&lt;\/a&gt;&lt;\/div&gt;&#039;, esc_url( $invoice-&gt;get_checkout_payment_url() ), __( &#039;Pay Securely Online&#039; ) );\n\t}\n} );<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\">We recommend using the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\" target=\"_blank\" rel=\"noreferrer noopener\">Code Snippets<\/a> plugin to add snippets to your site.<\/span><\/div>\n\n\n\n<p>The above code snippet\u00a0first checks if an invoice requires payment. If yes, it displays a payment link below the invoice total on the invoices list table.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can add a payment link to your invoices. Your users can then click the said link to pay for the items on the invoice. Adding a Payment Link to Invoices Use the following code snippet to add a payment link below the items on your invoices: The above code snippet\u00a0first checks if an invoice [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[307,305,306],"article\/categories":[211,221],"class_list":["post-467","gd_place","type-gd_place","status-publish","hentry","gd_place_tags-payment-links","gd_place_tags-add-payment-link","gd_place_tags-waveapps","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets"],"_links":{"self":[{"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/article\/467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/comments?post=467"}],"version-history":[{"count":0,"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/article\/467\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/media?parent=467"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=467"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgetpaid.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}