Advanced Coupons API
  • REST API
  • coupons/v1
    • Virtual Coupons (Premium)
      • Query a list of virtual coupons
      • Fetch virtual coupon stats
      • Create a virtual coupon
      • Retrieve a virtual coupon
      • Update a virtual coupon
      • Delete a virtual coupon
      • Bulk create virtual coupons
      • Bulk delete virtual coupons
    • Search Customers (Premium)
    • Settings
  • loyalty-program/v1
    • Dashboard
    • Customers
    • Settings
    • My Points
  • wc-loyalty-program/v1
    • Dashboard
    • Customers
    • Settings
  • wc-store-credits/v1
    • Entries
      • Query a list of store credit entries
      • Create a store credit entry
      • Fetch a single store credit entry
      • Update store credit entry
      • Delete store credit entry
    • Customers
      • Get dashboard statistics data
      • Query list of customers with store credits balance
      • Get single customer statistics and sources
Powered by GitBook
On this page

Was this helpful?

  1. coupons/v1
  2. Virtual Coupons (Premium)

Query a list of virtual coupons

GET: /wp-json/coupons/v1/virtualcoupons

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

GET

/wp-json/coupons/v1/virtualcoupons

Query Parameters

Required

Type

Default

Description

search

no

string

Search for virtual codes by name

status

no

string

Valid virtual coupon status (used|pending)

coupon_id

​no

​integer | integer[]

0

​Coupon ID(s)

user_id

no

​integer | integer[]

0

Customer ID(s)

date_created

no

string

A valid date text in mysql format. Y-m-d H:i:s

page

no

integer

1

Current page to load in query.

per_page

no

integer

10

Number of virtual coupons to list in a single page.

sort_by

no

string

date_created

Value to be based for sorting. (code|date_created|id|user_id|status|date_expire)

sort_order

no

string

desc

Order of sorting: desc or asc

codes_only

no

boolean

false

Return list of codes only when set to true.

date_format

no

string

F j, Y g:i a

Date format of virtual coupon date values. See here: https://www.php.net/manual/en/datetime.format.php

Get virtual coupons for coupon with id of 207

GET: http://example.com/wp-json/coupons1/v1/virtualcoupons?coupon_id=207

Get all virtual coupon, but coupon code's only for the main coupon with id of 207

GET: http://example.com/wp-json/coupons1/v1/virtualcoupons?coupon_id=207&codes_only=1&page=-1

Status: 200 OK

Get virtual coupons

Headers:
{
...
X-TOTAL: 100
}

[
    ...
    {
        "key": "116",
        "id": 116,
        "code": "67FQRYUYCT",
        "main_code": "bogo1",
        "coupon_code": "bogo1-67fqryuyct",
        "status": "pending",
        "coupon_id": 207,
        "user_id": 0,
        "user_fullname": "",
        "user_email": "",
        "date_created": "June 25, 2021 8:45 am",
        "date_expire": ""
    },
    ...
]

Get virtual coupon codes only

[
  "bogo1-67fqryuyct",
  "bogo1-wuujfbsk44",
  "bogo1-cje5svg862",
  "bogo1-pmd8ukcuep",
  "bogo1-m7w4zwbanp",
  "bogo1-n8ywtbjywy",
  "bogo1-2xagjdntw3",
  "bogo1-75hp7usjc5",
  ...
]

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

PreviousVirtual Coupons (Premium)NextFetch virtual coupon stats

Last updated 3 years ago

Was this helpful?