[{"data":1,"prerenderedAt":668},["ShallowReactive",2],{"navigation_docs":3,"-guides-coupons-add-ons-credit-notes":132,"-guides-coupons-add-ons-credit-notes-surround":663},[4,30,47,128],{"title":5,"path":6,"stem":7,"children":8,"page":29},"Getting Started","\u002Fgetting-started","1.getting-started",[9,13,17,21,25],{"title":10,"path":11,"stem":12},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":14,"path":15,"stem":16},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F2.quickstart",{"title":18,"path":19,"stem":20},"Authentication","\u002Fgetting-started\u002Fauthentication","1.getting-started\u002F3.authentication",{"title":22,"path":23,"stem":24},"Self-Hosting","\u002Fgetting-started\u002Fself-hosting","1.getting-started\u002F4.self-hosting",{"title":26,"path":27,"stem":28},"Build an Integration","\u002Fgetting-started\u002Fbuild-an-integration","1.getting-started\u002F5.build-an-integration",false,{"title":31,"path":32,"stem":33,"children":34,"page":29},"Sdks","\u002Fsdks","2.sdks",[35,39,43],{"title":36,"path":37,"stem":38},"TypeScript SDK","\u002Fsdks\u002Ftypescript","2.sdks\u002F1.typescript",{"title":40,"path":41,"stem":42},"Python SDK","\u002Fsdks\u002Fpython","2.sdks\u002F2.python",{"title":44,"path":45,"stem":46},"PHP SDK","\u002Fsdks\u002Fphp","2.sdks\u002F3.php",{"title":48,"path":49,"stem":50,"children":51,"page":29},"Guides","\u002Fguides","3.guides",[52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124],{"title":53,"path":54,"stem":55},"Customers","\u002Fguides\u002Fcustomers","3.guides\u002F1.customers",{"title":57,"path":58,"stem":59},"Usage-Based Billing","\u002Fguides\u002Fusage-billing","3.guides\u002F10.usage-billing",{"title":61,"path":62,"stem":63},"Wallets","\u002Fguides\u002Fwallets","3.guides\u002F11.wallets",{"title":65,"path":66,"stem":67},"Coupons, Add-ons and Credit Notes","\u002Fguides\u002Fcoupons-add-ons-credit-notes","3.guides\u002F12.coupons-add-ons-credit-notes",{"title":69,"path":70,"stem":71},"Taxes","\u002Fguides\u002Ftaxes","3.guides\u002F13.taxes",{"title":73,"path":74,"stem":75},"Customer Portal","\u002Fguides\u002Fcustomer-portal","3.guides\u002F14.customer-portal",{"title":77,"path":78,"stem":79},"Ledger","\u002Fguides\u002Fledger","3.guides\u002F15.ledger",{"title":81,"path":82,"stem":83},"Plan Limits and Access","\u002Fguides\u002Fplan-limits-and-access","3.guides\u002F16.plan-limits-and-access",{"title":85,"path":86,"stem":87},"Currencies and Exchange Rates","\u002Fguides\u002Fcurrencies","3.guides\u002F17.currencies",{"title":89,"path":90,"stem":91},"Charge a Customer","\u002Fguides\u002Fcharge-a-customer","3.guides\u002F18.charge-a-customer",{"title":93,"path":94,"stem":95},"One-time Products & Partial Payments","\u002Fguides\u002Fone-time-products-and-partial-payments","3.guides\u002F19.one-time-products-and-partial-payments",{"title":97,"path":98,"stem":99},"Plans & Pricing","\u002Fguides\u002Fplans-and-pricing","3.guides\u002F2.plans-and-pricing",{"title":101,"path":102,"stem":103},"Subscriptions","\u002Fguides\u002Fsubscriptions","3.guides\u002F3.subscriptions",{"title":105,"path":106,"stem":107},"Invoices & Payments","\u002Fguides\u002Finvoices-and-payments","3.guides\u002F4.invoices-and-payments",{"title":109,"path":110,"stem":111},"Payment Providers","\u002Fguides\u002Fpayment-providers","3.guides\u002F5.payment-providers",{"title":113,"path":114,"stem":115},"Analytics","\u002Fguides\u002Fanalytics","3.guides\u002F6.analytics",{"title":117,"path":118,"stem":119},"Webhooks","\u002Fguides\u002Fwebhooks","3.guides\u002F7.webhooks",{"title":121,"path":122,"stem":123},"Sandbox","\u002Fguides\u002Fsandbox","3.guides\u002F8.sandbox",{"title":125,"path":126,"stem":127},"Money Movement","\u002Fguides\u002Fmoney-movement","3.guides\u002F9.money-movement",{"title":129,"path":130,"stem":131},"API Reference","\u002Fapi-reference","4.api-reference",{"id":133,"title":65,"body":134,"description":656,"extension":657,"links":658,"meta":659,"navigation":660,"path":66,"seo":661,"stem":67,"__hash__":662},"docs\u002F3.guides\u002F12.coupons-add-ons-credit-notes.md",{"type":135,"value":136,"toc":651},"minimark",[137,142,146,268,287,290,343,354,358,361,432,435,488,502,514,518,521,602,621,647],[138,139,141],"h2",{"id":140},"coupons","Coupons",[143,144,145],"p",{},"A coupon is a discount you can apply to customers: a percentage or a fixed amount, for some or all plans.",[147,148,153],"pre",{"className":149,"code":150,"language":151,"meta":152,"style":152},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","curl -X POST https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fcoupons \\\n  -H \"Authorization: Bearer sk_live_a1b2c3d4...\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"code\": \"WELCOME20\",\n    \"name\": \"20% welcome discount\",\n    \"discountType\": \"PERCENTAGE\",\n    \"discountValue\": 20,\n    \"maxRedemptions\": 100,\n    \"expiresAt\": \"2026-12-31T23:59:59Z\"\n  }'\n","bash","",[154,155,156,179,197,211,223,229,235,241,247,253,259],"code",{"__ignoreMap":152},[157,158,161,165,169,172,175],"span",{"class":159,"line":160},"line",1,[157,162,164],{"class":163},"sBMFI","curl",[157,166,168],{"class":167},"sfazB"," -X",[157,170,171],{"class":167}," POST",[157,173,174],{"class":167}," https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fcoupons",[157,176,178],{"class":177},"sTEyZ"," \\\n",[157,180,182,185,189,192,195],{"class":159,"line":181},2,[157,183,184],{"class":167},"  -H",[157,186,188],{"class":187},"sMK4o"," \"",[157,190,191],{"class":167},"Authorization: Bearer sk_live_a1b2c3d4...",[157,193,194],{"class":187},"\"",[157,196,178],{"class":177},[157,198,200,202,204,207,209],{"class":159,"line":199},3,[157,201,184],{"class":167},[157,203,188],{"class":187},[157,205,206],{"class":167},"Content-Type: application\u002Fjson",[157,208,194],{"class":187},[157,210,178],{"class":177},[157,212,214,217,220],{"class":159,"line":213},4,[157,215,216],{"class":167},"  -d",[157,218,219],{"class":187}," '",[157,221,222],{"class":167},"{\n",[157,224,226],{"class":159,"line":225},5,[157,227,228],{"class":167},"    \"code\": \"WELCOME20\",\n",[157,230,232],{"class":159,"line":231},6,[157,233,234],{"class":167},"    \"name\": \"20% welcome discount\",\n",[157,236,238],{"class":159,"line":237},7,[157,239,240],{"class":167},"    \"discountType\": \"PERCENTAGE\",\n",[157,242,244],{"class":159,"line":243},8,[157,245,246],{"class":167},"    \"discountValue\": 20,\n",[157,248,250],{"class":159,"line":249},9,[157,251,252],{"class":167},"    \"maxRedemptions\": 100,\n",[157,254,256],{"class":159,"line":255},10,[157,257,258],{"class":167},"    \"expiresAt\": \"2026-12-31T23:59:59Z\"\n",[157,260,262,265],{"class":159,"line":261},11,[157,263,264],{"class":167},"  }",[157,266,267],{"class":187},"'\n",[143,269,270,271,274,275,278,279,282,283,286],{},"For ",[154,272,273],{},"FIXED_AMOUNT",", ",[154,276,277],{},"discountValue"," is an amount and ",[154,280,281],{},"currency"," is required. ",[154,284,285],{},"appliesToPlanIds"," limits the coupon to some plans (empty means all).",[143,288,289],{},"Apply it to a customer, optionally for one subscription and a number of billing cycles:",[147,291,293],{"className":149,"code":292,"language":151,"meta":152,"style":152},"curl -X POST https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fcoupons\u002Fapply \\\n  -H \"Authorization: Bearer sk_live_a1b2c3d4...\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"couponId\": \"cpn_123\", \"customerId\": \"cust_abc123\", \"usesRemaining\": 3 }'\n",[154,294,295,308,320,332],{"__ignoreMap":152},[157,296,297,299,301,303,306],{"class":159,"line":160},[157,298,164],{"class":163},[157,300,168],{"class":167},[157,302,171],{"class":167},[157,304,305],{"class":167}," https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fcoupons\u002Fapply",[157,307,178],{"class":177},[157,309,310,312,314,316,318],{"class":159,"line":181},[157,311,184],{"class":167},[157,313,188],{"class":187},[157,315,191],{"class":167},[157,317,194],{"class":187},[157,319,178],{"class":177},[157,321,322,324,326,328,330],{"class":159,"line":199},[157,323,184],{"class":167},[157,325,188],{"class":187},[157,327,206],{"class":167},[157,329,194],{"class":187},[157,331,178],{"class":177},[157,333,334,336,338,341],{"class":159,"line":213},[157,335,216],{"class":167},[157,337,219],{"class":187},[157,339,340],{"class":167},"{ \"couponId\": \"cpn_123\", \"customerId\": \"cust_abc123\", \"usesRemaining\": 3 }",[157,342,267],{"class":187},[143,344,345,346,349,350,353],{},"Leave out ",[154,347,348],{},"usesRemaining"," to apply it forever. ",[154,351,352],{},"DELETE \u002Fapi\u002Fcoupons\u002Fapplied\u002F{id}"," removes it.",[138,355,357],{"id":356},"add-ons","Add-ons",[143,359,360],{},"An add-on is a one-time charge you can add to a customer's next invoice, such as a setup fee or premium support, with a price per currency.",[147,362,364],{"className":149,"code":363,"language":151,"meta":152,"style":152},"curl -X POST https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fadd-ons \\\n  -H \"Authorization: Bearer sk_live_a1b2c3d4...\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"name\": \"Premium support\",\n    \"code\": \"premium_support\",\n    \"prices\": [{ \"currency\": \"UGX\", \"amount\": 50000 }, { \"currency\": \"USD\", \"amount\": 15 }]\n  }'\n",[154,365,366,379,391,403,411,416,421,426],{"__ignoreMap":152},[157,367,368,370,372,374,377],{"class":159,"line":160},[157,369,164],{"class":163},[157,371,168],{"class":167},[157,373,171],{"class":167},[157,375,376],{"class":167}," https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fadd-ons",[157,378,178],{"class":177},[157,380,381,383,385,387,389],{"class":159,"line":181},[157,382,184],{"class":167},[157,384,188],{"class":187},[157,386,191],{"class":167},[157,388,194],{"class":187},[157,390,178],{"class":177},[157,392,393,395,397,399,401],{"class":159,"line":199},[157,394,184],{"class":167},[157,396,188],{"class":187},[157,398,206],{"class":167},[157,400,194],{"class":187},[157,402,178],{"class":177},[157,404,405,407,409],{"class":159,"line":213},[157,406,216],{"class":167},[157,408,219],{"class":187},[157,410,222],{"class":167},[157,412,413],{"class":159,"line":225},[157,414,415],{"class":167},"    \"name\": \"Premium support\",\n",[157,417,418],{"class":159,"line":231},[157,419,420],{"class":167},"    \"code\": \"premium_support\",\n",[157,422,423],{"class":159,"line":237},[157,424,425],{"class":167},"    \"prices\": [{ \"currency\": \"UGX\", \"amount\": 50000 }, { \"currency\": \"USD\", \"amount\": 15 }]\n",[157,427,428,430],{"class":159,"line":243},[157,429,264],{"class":167},[157,431,267],{"class":187},[143,433,434],{},"Charge it to a customer; it is included in their next invoice:",[147,436,438],{"className":149,"code":437,"language":151,"meta":152,"style":152},"curl -X POST https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fadd-ons\u002Fapply \\\n  -H \"Authorization: Bearer sk_live_a1b2c3d4...\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"addOnId\": \"ao_123\", \"customerId\": \"cust_abc123\", \"amount\": 50000, \"currency\": \"UGX\" }'\n",[154,439,440,453,465,477],{"__ignoreMap":152},[157,441,442,444,446,448,451],{"class":159,"line":160},[157,443,164],{"class":163},[157,445,168],{"class":167},[157,447,171],{"class":167},[157,449,450],{"class":167}," https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fadd-ons\u002Fapply",[157,452,178],{"class":177},[157,454,455,457,459,461,463],{"class":159,"line":181},[157,456,184],{"class":167},[157,458,188],{"class":187},[157,460,191],{"class":167},[157,462,194],{"class":187},[157,464,178],{"class":177},[157,466,467,469,471,473,475],{"class":159,"line":199},[157,468,184],{"class":167},[157,470,188],{"class":187},[157,472,206],{"class":167},[157,474,194],{"class":187},[157,476,178],{"class":177},[157,478,479,481,483,486],{"class":159,"line":213},[157,480,216],{"class":167},[157,482,219],{"class":187},[157,484,485],{"class":167},"{ \"addOnId\": \"ao_123\", \"customerId\": \"cust_abc123\", \"amount\": 50000, \"currency\": \"UGX\" }",[157,487,267],{"class":187},[143,489,490,493,494,497,498,501],{},[154,491,492],{},"GET \u002Fapi\u002Fadd-ons?code=premium_support"," finds an add-on by its code. ",[154,495,496],{},"GET \u002Fapi\u002Fadd-ons\u002Fapplied\u002Flist"," shows pending one-time charges, and ",[154,499,500],{},"DELETE \u002Fapi\u002Fadd-ons\u002Fapplied\u002F{id}"," removes one that has not been invoiced yet.",[143,503,504,505,508,509,513],{},"To sell an add-on on its own, such as a course or a bundle paid once, put it on an invoice by ",[154,506,507],{},"addOnCode",". See ",[510,511,512],"a",{"href":94},"One-time products & partial payments",".",[138,515,517],{"id":516},"credit-notes","Credit notes",[143,519,520],{},"A credit note records money owed back to a customer against an invoice: a duplicate charge, an unhappy customer, or a changed order.",[147,522,524],{"className":149,"code":523,"language":151,"meta":152,"style":152},"curl -X POST https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fcredit-notes \\\n  -H \"Authorization: Bearer sk_live_a1b2c3d4...\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"invoiceId\": \"inv_123\",\n    \"customerId\": \"cust_abc123\",\n    \"amount\": 25000,\n    \"currency\": \"UGX\",\n    \"reason\": \"PRODUCT_UNSATISFACTORY\"\n  }'\n",[154,525,526,539,551,563,571,576,581,586,591,596],{"__ignoreMap":152},[157,527,528,530,532,534,537],{"class":159,"line":160},[157,529,164],{"class":163},[157,531,168],{"class":167},[157,533,171],{"class":167},[157,535,536],{"class":167}," https:\u002F\u002Fapi.pimabill.com\u002Fapi\u002Fcredit-notes",[157,538,178],{"class":177},[157,540,541,543,545,547,549],{"class":159,"line":181},[157,542,184],{"class":167},[157,544,188],{"class":187},[157,546,191],{"class":167},[157,548,194],{"class":187},[157,550,178],{"class":177},[157,552,553,555,557,559,561],{"class":159,"line":199},[157,554,184],{"class":167},[157,556,188],{"class":187},[157,558,206],{"class":167},[157,560,194],{"class":187},[157,562,178],{"class":177},[157,564,565,567,569],{"class":159,"line":213},[157,566,216],{"class":167},[157,568,219],{"class":187},[157,570,222],{"class":167},[157,572,573],{"class":159,"line":225},[157,574,575],{"class":167},"    \"invoiceId\": \"inv_123\",\n",[157,577,578],{"class":159,"line":231},[157,579,580],{"class":167},"    \"customerId\": \"cust_abc123\",\n",[157,582,583],{"class":159,"line":237},[157,584,585],{"class":167},"    \"amount\": 25000,\n",[157,587,588],{"class":159,"line":243},[157,589,590],{"class":167},"    \"currency\": \"UGX\",\n",[157,592,593],{"class":159,"line":249},[157,594,595],{"class":167},"    \"reason\": \"PRODUCT_UNSATISFACTORY\"\n",[157,597,598,600],{"class":159,"line":255},[157,599,264],{"class":167},[157,601,267],{"class":187},[143,603,604,607,608,274,611,274,614,617,618,513],{},[154,605,606],{},"reason"," is one of ",[154,609,610],{},"DUPLICATE",[154,612,613],{},"PRODUCT_UNSATISFACTORY",[154,615,616],{},"ORDER_CHANGE"," or ",[154,619,620],{},"OTHER",[143,622,623,624,627,628,631,632,635,636,639,640,617,644,513],{},"A credit note starts as ",[154,625,626],{},"DRAFT"," and can be edited. ",[154,629,630],{},"POST \u002Fapi\u002Fcredit-notes\u002F{id}\u002Ffinalize"," makes it final and sends a ",[154,633,634],{},"credit_note.finalized"," webhook; ",[154,637,638],{},"POST \u002Fapi\u002Fcredit-notes\u002F{id}\u002Fvoid"," cancels it. Finalizing records the credit; to return money, ",[510,641,643],{"href":642},"\u002Fguides\u002Finvoices-and-payments#refund-a-payment","refund the payment",[510,645,646],{"href":62},"top up the customer's wallet",[648,649,650],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":152,"searchDepth":181,"depth":181,"links":652},[653,654,655],{"id":140,"depth":181,"text":141},{"id":356,"depth":181,"text":357},{"id":516,"depth":181,"text":517},"Discounts, one-time charges, and credits against invoices.","md",null,{},true,{"title":65,"description":656},"lwA9xWiyXvr9PeWzjlSjfvMrzI3ifB4y8ApAt21Byn0",[664,666],{"title":61,"path":62,"stem":63,"description":665,"children":-1},"Prepaid credit that customers buy or you grant, used automatically on their invoices.",{"title":69,"path":70,"stem":71,"description":667,"children":-1},"Tax rates applied to invoices, by default or per customer, plan or charge.",1793401245141]