I have programmatically generated coupon code, But it does not display on Admin->Promotions->Shopping Cart Price Rules. Why ?
$coupon = Mage::getModel('salesrule/rule');
$coupon->setName('testing_name')
->setDescription('testing_name')
->setFromDate(date('2017-01-01'))
->setCouponType(2)
->setCouponCode('ASASASASAS')
->setUsesPerCoupon(1000)
->setUsesPerCustomer(100)
->setCustomerGroupIds(array(1)) //an array of customer groupids
->setIsActive(1)
//serialized conditions. the following examples are empty
->setConditionsSerialized('')
->setActionsSerialized('')
->setStopRulesProcessing(0)
->setIsAdvanced(1)
->setProductIds('')
->setSortOrder(0)
->setSimpleAction('by_percent')
->setDiscountAmount(100)
->setDiscountQty(null)
->setDiscountStep('0')
->setSimpleFreeShipping('0')
->setApplyToShipping('0')
->setIsRss(0)
->setWebsiteIds(array(1));
$coupon->save();
At last print_r($coupon); Will give coupon detail But it not displays admin side.
try catch
when you save coupon to get errors if any.