Coupon Code

Promotions enable you to track the source of revenue and to offer discounts in the form of coupons. Each promotion has a promotion code that can be applied to transactions and campaigns.

This record is not a subrecord.

The REST API Browser includes information about the field names and field types of the coupon code record, and about the HTTP methods, request parameters, and operations available to this record. For details, see the REST API Browser’s couponCode reference page.

For information about coupon codes, see Coupon Code.

For information about working with coupon codes in the UI, see Coupon Codes.

For information about using the REST API Browser, see The REST API Browser.

Record ID

The record ID for the coupon code REST record is couponcode.

Prerequisites

You must enable the SuitePromotions feature before you can use this record through REST web services.

Elements with Different Functionality

The following fields have different functionality through REST web services:

  • used

  • useCount

Additional Details

For multi-use coupon code type promotions:

  • The promotion must have at least one coupon code associated to it so that it is usable.

    If you remove all the coupon codes, you will see an empty coupon code field in the UI, and from the REST point of view, the code field will not be returned with the promotioncode record.

    However, you can add the coupon codes through the user interface or through REST by updating the code field in the promotioncode record.

  • You can update the coupon code field using a PATCH request to the promotioncode record.

For single-use coupon code type promotions:

  • The promotion must have at least one coupon code associated to it so that it is usable.

    If you remove all the coupon codes, you will have an empty list of coupon codes.

    However, you can add the coupon codes through the user interface or through REST.

  • You cannot update the coupon code field using a PATCH request to the promotioncode record.

Code Sample

In the following example, 123 represents the promotion ID.

The following code shows how to create a coupon code:

            POST: https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/couponCode
{ "promotion": {"id": 123}, "code": "ABC-ABC-100"
} 

          

In the following example, 206 represents the promotion ID and 15 represents the recipient ID.

The following code shows how to update a coupon code:

            PATCH: https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/couponCode/206
{ "promotion": {"id": 123}, "code": "ABC-CDE-200", "dateSent": "2024-06-18", "recipient": {"id": "15"},
} 

          
Note:

When updating the coupon code records, consider the difference between single-use and multi-use coupon code type promotions.

The following code shows how to obtain a coupon code using a GET Request:

            GET: https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/couponCode/206 

          

The following code shows how to delete a coupon code:

            DELETE: https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/couponCode/206 

          
Note:

If a coupon code is already being used in a transaction, you won't be able to remove the promotions record.

Related Topics

REST Web Services Supported Records
SuiteTalk REST Web Services Overview and Setup
Working with Records
NetSuite Record Structure
The REST API Browser

General Notices