WemX Modules
  • Overview
  • general
    • Overview
    • Cloudflare Firewall Configuration
  • Giftcard module
    • General
    • API Reference
  • Guides
    • Modules
Powered by GitBook
On this page
  1. Giftcard module

API Reference

API Docs of the Giftcard Module API

PreviousGeneralNextModules

Last updated 1 year ago

Authentication

In order to use the Giftcard API users must authenticate using a bearer to access the endpoints. Bearer tokens can be obtained within the Admin Area -> API Keys -> Create (on your application).

Bearer tokens can only be created and used by root administrators (users that have the admin.root permission).

Bearer tokens can be specified inside the Authorization header in your request.

Header
Value

Authorization

Bearer <your_access_token>

curl -H "Authorization: Bearer <your_access_token>" https://wemx.app/giftcard/api/v1/test

Replace <your_access_token> with your Bearer token.

API Keys should not be shared with anyone or stored in places that are easily compromisable such as chats, emails and/or hardcoding them into your code.

https://wemx.app/giftcards/api/v1/test Try if the Giftcard API workes Returns if the giftcard API is working

{
	"success": true,
	"message": "Gift card API is working"
}

https://wemx.app/giftcards/api/v1/create Create a Giftcard

Create a Giftcard with given Values

giftcard_value* Numeric Value of the Giftcard giftcard_status active/inactive Status of the Giftcard buyer_id Numeric Buyer UserID for gift card management

{
	"success": true,
	"data": {
		"giftcard_code": "4GOSL-OL933-X6BH8-LODV",
		"giftcard_value": "10",
		"giftcard_status": "active",
		"buyer_id": "1",
		"updated_at": "2024-02-27T16:58:25.000000Z",
		"created_at": "2024-02-27T16:58:25.000000Z",
		"id": 16
	}
}
https://wemx.app/giftcards/api/v1/gencode Create a nice looking code

Creates a nice looking code if you want to use a extenal thing to gen codes

{
	"success": true,
	"code": "TXO18-KS6VH-IKFH4-2580"
}

That is everything that comes with API version 1 if you want that new stuff is added to the API and a new Version of the API will be developed then create a Feature request at our Github to get it added.

https://wemx.app/giftcards/api/v1/validate Validates a Giftcard code

Returns a if the Giftcard is valid or invalid

{
	"success": true,
	"message": "Gift card is valid",
	"valid": true
}

giftcard_code* String Giftcardcode