Coupons


Overview

The coupons API allows you to create, view, update, and delete individual, or a batch, of coupon codes.


Create a coupon

This API helps you to create a new coupon.

createCoupon({})

Parameters

required String code,
required String discountType,
required String amount,
required bool individualUse,
required bool excludeSaleItems,
required String minimumAmount,

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
Coupon coupon = await WooSignal.instance.createCoupon({
      code,
      discountType,
      amount,
      individualUse,
      excludeSaleItems,
      minimumAmount,
      });

Response

Coupon instance

Represents the following object - WooCommerce Coupon


Retrieve a coupon

This API lets you retrieve and view a specific coupon by ID.

retrieveCoupon({int id})

Parameters

int id

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
Coupon coupon = await WooSignal.instance.retrieveCoupon(id: "coupon id");

Response

Coupon instance

Represents the following object - WooCommerce Coupon


List all coupons

This API helps you to list all the coupons that have been created.

getCoupons()

Parameters

String context
int page
int perPage
String search
String after
String before
List<int> exclude
List<int> include
String order
String orderby
String code

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
List<Coupon> coupons = await WooSignal.instance.getCoupons();

Response

List<Coupon> instance

Represents the following object - WooCommerce Coupon List


Update a coupon

This API lets you make changes to a coupon.

updateCoupon(int id, {Map data})

Parameters

int id, 
{Map<String, dynamic> data}

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
Coupon coupon = await WooSignal.instance.updateCoupon(id: "coupon id", data: {});

Response

Coupon instance

Represents the following object - WooCommerce Coupon


Delete a coupon

This API helps you delete a coupon.

deleteCoupon(int id)

Parameters

int id

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
Coupon coupon = await WooSignal.instance.deleteCoupon(id: "coupon id");

Response

Coupon instance

Represents the following object - WooCommerce Coupon


Batch update coupons

This API helps you to batch create, update and delete multiple coupons.

batchCoupon({Map data})

Parameters

Map<String, dynamic> data

API Call

// Initialize WooSignal
await WooSignal.instance.init(appKey: "your app key");

// Call API
CouponBatch couponBatch = await WooSignal.instance.batchCoupon(data: {});

Response

CouponBatch instance

Represents the following object - WooCommerce CouponBatch