Adding voucher rewards

Each voucher code should have at least one reward assigned to it. The reward is the effect of the voucher code and it determines the changes that should be applied to the customer's transaction, as well as its conditions (under what circumstances should the reward be applied). The reward can be a nominal value or a percentage discount on the whole order or a single product. The reward can also be a particular amount of points - rewarding triggers. We will add more rewards in the future.

In this example, let's create a reward that applies a discount of 15% on the whole order value:

curl --request POST \
     --user "username:password" \
     --url "https://preview.vouchery.io/api/v2.0/campaigns/2/rewards" \
     --header "Content-Type: application/json" \
     --data \ 
'
{
	"type": "SetDiscount",
	"discount_type": "percentage",
	"discount_value": 15
}
'
{
    "id": 1,
    "reward_type": "set_discount",
    "data": {
        "discount_type": "percentage",
        "discount_value": "15.0"
    },
    "created_at": "2019-06-10T08:35:47.290Z",
    "updated_at": "2019-06-10T08:35:47.290Z"
}