{"id":14,"date":"2026-09-02T13:19:19","date_gmt":"2026-09-02T13:19:19","guid":{"rendered":"http:\/\/nextwaypay.com\/blog\/2026\/09\/02\/api-webhooks-crypto-invoices\/"},"modified":"2026-09-02T13:19:19","modified_gmt":"2026-09-02T13:19:19","slug":"api-webhooks-crypto-invoices","status":"publish","type":"post","link":"https:\/\/nextwaypay.com\/blog\/api-webhooks-crypto-invoices\/","title":{"rendered":"Automating Order Fulfillment with Payment Webhooks"},"content":{"rendered":"<p>Checking invoice status by hand \u2014 refreshing a dashboard, comparing order lists \u2014 works for a handful of daily orders and breaks down almost immediately after that. Webhooks (callback URLs) solve this by having the payment gateway notify your system the instant a payment&#8217;s status changes, instead of your system having to ask.<\/p>\n<h2>How the callback flow works<\/h2>\n<ol>\n<li>When creating an invoice via the API, you include a <code>callback_url<\/code> parameter pointing to an endpoint on your own server.<\/li>\n<li>As soon as a payment is detected, confirmed, or fails, the gateway sends a POST request to that URL with the invoice ID, status code, and amount received.<\/li>\n<li>Your endpoint reads that payload and updates the order \u2014 marking it paid, triggering fulfillment, sending a confirmation email \u2014 without any polling.<\/li>\n<\/ol>\n<h2>A typical payload<\/h2>\n<pre>{\n  \"status_id\": 1,\n  \"amount_get\": \"0.00194\",\n  \"order_id\": \"ORDER-1042\"\n}<\/pre>\n<h2>Status codes worth handling explicitly<\/h2>\n<table>\n<tr>\n<th>Code<\/th>\n<th>Meaning<\/th>\n<th>Recommended action<\/th>\n<\/tr>\n<tr>\n<td>-1<\/td>\n<td>Not confirmed<\/td>\n<td>No action yet \u2014 payment detected but awaiting network confirmations<\/td>\n<\/tr>\n<tr>\n<td>0<\/td>\n<td>Pending<\/td>\n<td>Show &#8220;processing&#8221; state to the customer<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>Complete<\/td>\n<td>Fulfill the order, send receipt<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Declined<\/td>\n<td>Notify customer, offer to retry<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>Cancelled<\/td>\n<td>Release any reserved inventory<\/td>\n<\/tr>\n<\/table>\n<h2>Security basics that are easy to skip<\/h2>\n<ul>\n<li><strong>Validate the invoice ID server-side<\/strong> against your own records before trusting any webhook payload \u2014 don&#8217;t act purely on the amount reported in the request.<\/li>\n<li><strong>Use HTTPS endpoints only.<\/strong> Callback data should never travel over an unencrypted connection.<\/li>\n<li><strong>Make your endpoint idempotent.<\/strong> Networks can occasionally retry a webhook delivery \u2014 your handler should safely ignore a duplicate notification for an already-processed order.<\/li>\n<\/ul>\n<div class=\"post-cta-inline\">\n<strong>Full API reference<\/strong><br \/>\nNextWay Pay&#8217;s API documentation covers invoice creation, manual confirmation, forwarding, and the complete webhook payload spec.<\/p>\n<p><a href=\"https:\/\/nextwaypay.com\/api_doc\/\">Read the API docs \u2192<\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Checking invoice status by hand \u2014 refreshing a dashboard, comparing order lists \u2014 works for a handful of daily orders and breaks down almost immediately after that. Webhooks (callback URLs) solve this by having the payment gateway notify your system the instant a payment&#8217;s status changes, instead of your system having to ask.<\/p>\n","protected":false},"author":1,"featured_media":26,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-14","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developers"],"_links":{"self":[{"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":0,"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/media\/26"}],"wp:attachment":[{"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nextwaypay.com\/blog\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}