Add coupon
Last updated: 24-Jun-2019
Rate this article:
Overview
Use the addPromotionCoupon method to add single or multiple coupons to a promotion. Using the addPromotionCoupon for a promotion that is set to apply automatically will change the promotion type to the manual flow, where customers are required to enter the coupon code to receive the discount.
Parameters
Parameter | Type/Description | |
---|---|---|
sessionID |
Required (string) |
|
|
Output of the Login method. |
|
promotionCode |
Required (string) |
|
|
The code corresponding to the promotion that you want to add coupons to. |
|
promotionCoupon |
Required (object) |
|
|
type |
Required (string) |
|
|
Coupon type. Available values:
|
|
Code/Codes |
Required (string / array of strings) |
|
|
Coupon code (for SINGLE) or array of coupon codes (for MULTIPLE). |
Response
Parameter | Type/Description |
---|---|
promotionCoupon | Object |
Request
<?php
require ('PATH_TO_AUTH');
// Promotion code corresponding to the promotion you want to add coupons to
$promotionCode = '';
// Define single coupon object
$promotionCoupon = new stdClass;
$promotionCoupon->Type = 'SINGLE';
$promotionCoupon->Code = 'YOUR_CODE_HERE';
// Define multiple coupon object
$promotionCoupon = new stdClass;
$promotionCoupon->Type = 'MULTIPLE';
$promotionCoupon->Codes = ['YOUR_CODE_1', 'YOUR_CODE_2'];
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'addPromotionCoupon',
'params' => array($sessionID, $promotionCode, $promotionCoupon)
);
var_dump (callRPC($jsonRpcRequest, $host));
Rate this article: