{"id":342,"date":"2026-10-15T21:33:20","date_gmt":"2026-10-15T21:33:20","guid":{"rendered":"https:\/\/blog.skndan.com\/jsontoimg\/coupons\/"},"modified":"2026-11-17T13:33:52","modified_gmt":"2026-11-17T13:33:52","slug":"coupons","status":"publish","type":"page","link":"https:\/\/blog.skndan.com\/jsontoimg\/coupons\/","title":{"rendered":"Coupon Generator API: Unique Codes from a Customer List"},"content":{"rendered":"<p>A coupon generator turns a list of customers and codes into one image each. jsontoimg fills the discount, expiry date, and a unique code on named layers, draws that code as a QR or barcode, and returns a PNG for email or a PDF for print. It suits shops, restaurants, and apps running win-back or referral campaigns.<\/p>\n<h2>Layers that change per coupon<\/h2>\n<ul>\n<li><code>offer<\/code>: the discount text, such as &quot;20% off your next order&quot;<\/li>\n<li><code>expires<\/code>: a date you format before sending; the API does not localize dates<\/li>\n<li><code>code_text<\/code>: the code printed in readable characters<\/li>\n<li><code>code<\/code>: a Code layer with format <code>qrcode<\/code> or <code>code128<\/code>, carrying the same code<\/li>\n<\/ul>\n<p>Brand, terms text, and layout stay in the template.<\/p>\n<h2>Render one coupon<\/h2>\n<pre><code>{\n  &quot;template&quot;: &quot;&lt;design-id&gt;&quot;,\n  &quot;format&quot;: &quot;png&quot;,\n  &quot;layers&quot;: {\n    &quot;offer&quot;: { &quot;text&quot;: &quot;20% off your next order&quot; },\n    &quot;expires&quot;: { &quot;text&quot;: &quot;Valid until 31 Dec 2026&quot; },\n    &quot;code_text&quot;: { &quot;text&quot;: &quot;WELCOME-7K2Q9&quot; },\n    &quot;code&quot;: { &quot;text&quot;: &quot;WELCOME-7K2Q9&quot; }\n  }\n}\n<\/code><\/pre>\n<p>For a list of 1,000 customers, send twenty batches of 50 and key each job by customer id.<\/p>\n<h2>You issue and redeem the code<\/h2>\n<p>jsontoimg does not generate, store, or validate coupon codes. Create the codes in your own system, make them unguessable, and check them at redemption. A sequential code like SAVE1, SAVE2 lets anyone invent a valid one. Mark each code single-use and tied to the customer on your side.<\/p>\n<h2>Check what the scanner reads<\/h2>\n<p>If the coupon is scanned at a till, find out which code formats the point-of-sale hardware reads before you choose <code>qrcode<\/code> or <code>code128<\/code>. Print a test coupon and scan it. For emailed coupons, put the readable code next to the QR so a customer can type it in.<\/p>\n<h2>Delivery<\/h2>\n<p>Send the signed <code>assetUrl<\/code> in the email, or embed it in an <code>&lt;img&gt;<\/code> tag. The <a href=\"https:\/\/jsontoimg.com\/use-cases\/email-hero-images\">email hero images page<\/a> covers sizing and alt text for images in email clients. Add alt text that states the offer and code, since some clients block images by default.<\/p>\n<h2>Related<\/h2>\n<ul>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/QR_code\">QR code (Wikipedia)<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Code_128\">Code 128 barcode (Wikipedia)<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/use-cases\">All image generation use cases<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/docs\/guides\/batch\">Coupon codes rendered in batches<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/tools\/free-product-banner-generator\">Free product banner generator<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/use-cases\/product-banners\">Product banner generator API<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/blog\/json-to-image-converter\">How JSON-to-image conversion works<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/blog\/certificate-generator-api-guide\">bulk certificate generation from a CSV<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/use-cases\/email-hero-images\">Email hero images<\/a><\/li>\n<li><a href=\"https:\/\/jsontoimg.com\/use-cases\/event-tickets\">Event tickets<\/a><\/li>\n<\/ul>\n<h2>FAQ<\/h2>\n<h3>What is a coupon generator?<\/h3>\n<p>A tool that renders a coupon image or PDF per customer from a template and a list of codes. jsontoimg fills the offer, expiry, and a Code layer.<\/p>\n<h3>Does jsontoimg create the coupon codes?<\/h3>\n<p>No. Generate unguessable single-use codes in your own system and pass them in. jsontoimg only draws them as text and a QR or barcode.<\/p>\n<h3>Which format should the coupon code use?<\/h3>\n<p>QR works for phone scans. For a till scanner, check which formats the hardware reads, then choose qrcode or code128 and test one printed coupon.<\/p>\n<h3>How many coupons can I render in one request?<\/h3>\n<p>A batch holds 50 jobs. A list of 1,000 customers is twenty batches, keyed by customer id.<\/p>\n<p><a href=\"https:\/\/app.jsontoimg.com\/login\">Get 25 free images \u2192<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A coupon generator that renders one image or PDF per customer with a unique code, discount, and expiry. Your system issues and redeems the code.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-342","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/pages\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/comments?post=342"}],"version-history":[{"count":1,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/pages\/342\/revisions"}],"predecessor-version":[{"id":399,"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/pages\/342\/revisions\/399"}],"wp:attachment":[{"href":"https:\/\/blog.skndan.com\/jsontoimg\/wp-json\/wp\/v2\/media?parent=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}