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": {
                            "default": "wc-pimwick/v1",
                            "required": false
                        },
                        "context": {
                            "default": "view",
                            "required": false
                        }
                    }
                }
            ],
            "_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": {
                            "type": "string",
                            "description": "The specific gift card number to retrieve.",
                            "required": false
                        },
                        "limit": {
                            "type": "numeric",
                            "description": "The number of gift cards to retrieve. Default is 500",
                            "required": false
                        },
                        "order": {
                            "type": "string",
                            "description": "Sort the results ASC or DESC. Default is DESC",
                            "required": false
                        },
                        "orderby": {
                            "type": "string",
                            "description": "Options are CREATED (to sort by the gift card create date) or ACTIVITY (to sort by the last gift card activity). Default is CREATED",
                            "required": false
                        }
                    }
                },
                {
                    "methods": [
                        "POST"
                    ],
                    "args": {
                        "number": {
                            "type": "string",
                            "description": "The gift card number. Must not exist in the database already.",
                            "required": false
                        },
                        "quantity": {
                            "default": 1,
                            "type": "numeric",
                            "description": "The number of gift cards to generate. Ignored if the \"number\" parameter has a value.",
                            "required": false
                        },
                        "amount": {
                            "type": "numeric",
                            "description": "Initial gift card balance.",
                            "required": false
                        },
                        "expiration_date": {
                            "type": "date",
                            "description": "The expiration date for the gift card.",
                            "required": false
                        },
                        "send_email": {
                            "type": "boolean",
                            "description": "Set to a true value to email the gift card to the recipient_email specified.",
                            "required": false
                        },
                        "recipient_email": {
                            "type": "string",
                            "description": "The email address that will receive the gift card.",
                            "required": false
                        },
                        "recipient_name": {
                            "type": "string",
                            "description": "The friendly name of the recipient of the gift card. Shown on the gift card email.",
                            "required": false
                        },
                        "from": {
                            "type": "string",
                            "description": "The friendly name of the person who sent the gift card to the recipient.",
                            "required": false
                        },
                        "message": {
                            "type": "string",
                            "description": "The body of the message added to the email.",
                            "required": false
                        },
                        "note": {
                            "type": "string",
                            "description": "Adds a note to the gift card activity record when the gift card is created.",
                            "required": false
                        },
                        "design_id": {
                            "type": "numeric",
                            "description": "The database ID of the Email Design to use when sending the gift card.",
                            "required": false
                        },
                        "product_id": {
                            "type": "numeric",
                            "description": "The originating product_id to use for this gift card. Used for redemption validation.",
                            "required": false
                        },
                        "variation_id": {
                            "type": "numeric",
                            "description": "The originating variation_id to use for this gift card. Used for redemption validation.",
                            "required": false
                        },
                        "order_item_id": {
                            "type": "numeric",
                            "description": "The originating order_item_id to use for this gift card. Used for record keeping purposes.",
                            "required": false
                        }
                    }
                }
            ],
            "_links": {
                "self": [
                    {
                        "href": "http://localhost:8888/wp-json/wc-pimwick/v1/pw-gift-cards"
                    }
                ]
            }
        },
        "/wc-pimwick/v1/pw-gift-cards/(?P[\\d]+|[A-Za-z0-9\\-]+)": {
            "namespace": "wc-pimwick/v1",
            "methods": [
                "GET",
                "POST",
                "PUT",
                "PATCH",
                "DELETE"
            ],
            "endpoints": [
                {
                    "methods": [
                        "GET"
                    ],
                    "args": {
                        "id": {
                            "description": "Unique identifier for the gift card. Can be the database ID or the Gift Card Number.",
                            "type": "string",
                            "required": false
                        },
                        "number": {
                            "type": "string",
                            "description": "The specific gift card number to retrieve.",
                            "required": false
                        },
                        "limit": {
                            "type": "numeric",
                            "description": "The number of gift cards to retrieve. Default is 500",
                            "required": false
                        },
                        "order": {
                            "type": "string",
                            "description": "Sort the results ASC or DESC. Default is DESC",
                            "required": false
                        },
                        "orderby": {
                            "type": "string",
                            "description": "Options are CREATED (to sort by the gift card create date) or ACTIVITY (to sort by the last gift card activity). Default is CREATED",
                            "required": false
                        }
                    }
                },
                {
                    "methods": [
                        "POST",
                        "PUT",
                        "PATCH"
                    ],
                    "args": {
                        "id": {
                            "description": "Unique identifier for the gift card. Can be the database ID or the Gift Card Number.",
                            "type": "string",
                            "required": false
                        },
                        "number": {
                            "type": "string",
                            "description": "Changes the gift card number to this value. Must not exist in the database already.",
                            "required": false
                        },
                        "amount": {
                            "type": "numeric",
                            "description": "Balance adjustment amount. Can be positive or negative.",
                            "required": false
                        },
                        "balance": {
                            "type": "numeric",
                            "description": "Set the balance to a specific value. This will add a transaction for the appropriate amount to set the balance to this value.",
                            "required": false
                        },
                        "expiration_date": {
                            "type": "date",
                            "description": "The expiration date for the gift card. Send an empty value to clear the expiration date.",
                            "required": false
                        },
                        "send_email": {
                            "type": "boolean",
                            "description": "Set to a true value to email the gift card to the recipient_email specified.",
                            "required": false
                        },
                        "recipient_email": {
                            "type": "string",
                            "description": "The email address that will receive the gift card.",
                            "required": false
                        },
                        "recipient_name": {
                            "type": "string",
                            "description": "The friendly name of the recipient of the gift card. Shown on the gift card email.",
                            "required": false
                        },
                        "from": {
                            "type": "string",
                            "description": "The friendly name of the person who sent the gift card to the recipient.",
                            "required": false
                        },
                        "message": {
                            "type": "string",
                            "description": "The body of the message added to the email.",
                            "required": false
                        },
                        "note": {
                            "type": "string",
                            "description": "Adds a note to the gift card activity record.",
                            "required": false
                        },
                        "design_id": {
                            "type": "numeric",
                            "description": "The database ID of the Email Design to use when sending the gift card.",
                            "required": false
                        },
                        "product_id": {
                            "type": "numeric",
                            "description": "The originating product_id to use for this gift card. Used for redemption validation.",
                            "required": false
                        },
                        "variation_id": {
                            "type": "numeric",
                            "description": "The originating variation_id to use for this gift card. Used for redemption validation.",
                            "required": false
                        },
                        "order_item_id": {
                            "type": "numeric",
                            "description": "The originating order_item_id to use for this gift card. Used for record keeping purposes.",
                            "required": false
                        },
                        "active": {
                            "type": "boolean",
                            "description": "Send a true value to deactivate the gift card. Send a false value to reactivate a previously deactivated gift card.",
                            "required": false
                        }
                    }
                },
                {
                    "methods": [
                        "DELETE"
                    ],
                    "args": {
                        "id": {
                            "description": "Unique identifier for the gift card. Can be the database ID or the Gift Card Number.",
                            "type": "string",
                            "required": false
                        },
                        "force": {
                            "default": false,
                            "type": "boolean",
                            "description": "Whether to bypass trash and force deletion.",
                            "required": false
                        }
                    }
                }
            ]
        }
    },
    "_links": {
        "up": [
            {
                "href": "http://localhost:8888/wp-json/"
            }
        ]
    }
}

It is assumed that you are familiar with the WooCommerce REST API already. We can only offer limited assistance with using the REST API. Please Contact Us if you have any questions.

Skip to content