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": {
                        "number": {
                            "required": false,
                            "description": "The specific gift card number to retrieve.",
                            "type": "string"
                        },
                        "limit": {
                            "required": false,
                            "description": "The number of gift cards to retrieve. Default is 500",
                            "type": "numeric"
                        }
                    }
                },
                {
                    "methods": [
                        "POST"
                    ],
                    "args": {
                        "number": {
                            "required": false,
                            "description": "The gift card number. Must not exist in the database already.",
                            "type": "string"
                        },
                        "quantity": {
                            "required": false,
                            "default": 1,
                            "description": "The number of gift cards to generate. Ignored if the \"number\" parameter has a value.",
                            "type": "numeric"
                        },
                        "amount": {
                            "required": false,
                            "description": "Initial gift card balance.",
                            "type": "numeric"
                        },
                        "expiration_date": {
                            "required": false,
                            "description": "The expiration date for the gift card.",
                            "type": "date"
                        },
                        "send_email": {
                            "required": false,
                            "description": "Set to a true value to email the gift card to the recipient_email specified.",
                            "type": "boolean"
                        },
                        "recipient_email": {
                            "required": false,
                            "description": "The email address that will receive the gift card.",
                            "type": "string"
                        },
                        "from": {
                            "required": false,
                            "description": "The friendly name of the person who sent the gift card to the recipient.",
                            "type": "string"
                        },
                        "note": {
                            "required": false,
                            "description": "Adds a note to the gift card activity record when the gift card is created.",
                            "type": "string"
                        },
                        "design_id": {
                            "required": false,
                            "description": "The database ID of the Email Design to use when sending the gift card.",
                            "type": "numeric"
                        }
                    }
                }
            ],
            "_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"
                        },
                        "number": {
                            "required": false,
                            "description": "The specific gift card number to retrieve.",
                            "type": "string"
                        },
                        "limit": {
                            "required": false,
                            "description": "The number of gift cards to retrieve. Default is 500",
                            "type": "numeric"
                        }
                    }
                },
                {
                    "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"
                        },
                        "balance": {
                            "required": false,
                            "description": "Set the balance to a specific value. This will add a transaction for the appropriate amount to set the balance to this value.",
                            "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 [email protected] if you have any questions.