PW WooCommerce Gift Cards

REST API Documentation

This API is only for the PW WooCommerce Gift Cards Pro plugin.

We built the gift cards REST API based on the WooCommerce REST API v3. Once you have the WooCommerce REST API set up you can access the following endpoint on your server:

https://yourstore.com/wp-json/wc-pimwick/v1

Here is the current schema:

{
    "namespace": "wc-pimwick/v1",
    "routes": {
        "/wc-pimwick/v1": {
            "namespace": "wc-pimwick/v1",
            "methods": [
                "GET"
            ],
            "endpoints": [
                {
                    "methods": [
                        "GET"
                    ],
                    "args": {
                        "namespace": {
                            "required": false,
                            "default": "wc-pimwick/v1"
                        },
                        "context": {
                            "required": false,
                            "default": "view"
                        }
                    }
                }
            ],
            "_links": {
                "self": [
                    {
                        "href": "http://localhost:8888/wp-json/wc-pimwick/v1"
                    }
                ]
            }
        },
        "/wc-pimwick/v1/pw-gift-cards/schema": {
            "namespace": "wc-pimwick/v1",
            "methods": [
                "GET"
            ],
            "endpoints": [
                {
                    "methods": [
                        "GET"
                    ],
                    "args": []
                }
            ],
            "_links": {
                "self": [
                    {
                        "href": "http://localhost:8888/wp-json/wc-pimwick/v1/pw-gift-cards/schema"
                    }
                ]
            }
        },
        "/wc-pimwick/v1/pw-gift-cards": {
            "namespace": "wc-pimwick/v1",
            "methods": [
                "GET",
                "POST"
            ],
            "endpoints": [
                {
                    "methods": [
                        "GET"
                    ],
                    "args": []
                },
                {
                    "methods": [
                        "POST"
                    ],
                    "args": {
                        "number": {
                            "required": false,
                            "description": "The specific gift card number to retrieve.",
                            "type": "string"
                        }
                    }
                }
            ],
            "_links": {
                "self": [
                    {
                        "href": "http://localhost:8888/wp-json/wc-pimwick/v1/pw-gift-cards"
                    }
                ]
            }
        },
        "/wc-pimwick/v1/pw-gift-cards/(?P[\\d]+)": {
            "namespace": "wc-pimwick/v1",
            "methods": [
                "GET",
                "POST",
                "PUT",
                "PATCH",
                "DELETE"
            ],
            "endpoints": [
                {
                    "methods": [
                        "GET"
                    ],
                    "args": {
                        "id": {
                            "required": false,
                            "description": "Unique identifier for the gift card.",
                            "type": "integer"
                        }
                    }
                },
                {
                    "methods": [
                        "POST",
                        "PUT",
                        "PATCH"
                    ],
                    "args": {
                        "id": {
                            "required": false,
                            "description": "Unique identifier for the gift card.",
                            "type": "integer"
                        },
                        "number": {
                            "required": false,
                            "description": "Changes the gift card number to this value. Must not exist in the database already.",
                            "type": "string"
                        },
                        "amount": {
                            "required": false,
                            "description": "Balance adjustment amount. Can be positive or negative.",
                            "type": "numeric"
                        },
                        "note": {
                            "required": false,
                            "description": "Adds a note to the gift card activity record.",
                            "type": "string"
                        },
                        "expiration_date": {
                            "required": false,
                            "description": "The expiration date for the gift card. Send an empty value to clear the expiration date.",
                            "type": "date"
                        },
                        "active": {
                            "required": false,
                            "description": "Send a true value to deactivate the gift card. Send a false value to reactivate a previously deactivated gift card.",
                            "type": "boolean"
                        }
                    }
                },
                {
                    "methods": [
                        "DELETE"
                    ],
                    "args": {
                        "id": {
                            "required": false,
                            "description": "Unique identifier for the gift card.",
                            "type": "integer"
                        },
                        "force": {
                            "required": false,
                            "default": false,
                            "description": "Whether to bypass trash and force deletion.",
                            "type": "boolean"
                        }
                    }
                }
            ]
        }
    },
    "_links": {
        "up": [
            {
                "href": "http://localhost:8888/wp-json/"
            }
        ]
    }
}

It is assumed that you are familiar with the WooCommerce REST API already. We will continue to expand this documentation. In the meantime, feel free to email us@pimwick.com if you have any questions.