/** * Creates an Simplify_Subscription object * @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;"> * <dt><tt>amount</tt></dt> <dd>Amount of the payment (minor units). Example: 1000 = 10.00 </dd> * <dt><tt>coupon</tt></dt> <dd>Coupon ID associated with the subscription </dd> * <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. <strong>default:USD</strong></dd> * <dt><tt>customer</tt></dt> <dd>Customer that is enrolling in the subscription. </dd> * <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Example: Monthly </dd> * <dt><tt>name</tt></dt> <dd>Name describing subscription </dd> * <dt><tt>plan</tt></dt> <dd>The ID of the plan that should be used for the subscription. </dd> * <dt><tt>quantity</tt></dt> <dd>Quantity of the plan for the subscription. </dd></dl> * @param string publicKey Public key. If null, the value of static Simplify::$publicKey will be used * @param string privateKey Private key. If null, the value of static Simplify::$privateKey will be used * @return Subscription a Subscription object. */ public static function createSubscription($hash, $publicKey = null, $privateKey = null) { $instance = new Simplify_Subscription(); $instance->setAll($hash); $object = Simplify_PaymentsApi::createObject($instance, $publicKey, $privateKey); return $object; }
/** * Creates an Simplify_Subscription object * @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;"> * <dt><tt>amount</tt></dt> <dd>Amount of the payment (minor units). Example: 1000 = 10.00 [min value: 50, max value: 9999900] </dd> * <dt><tt>coupon</tt></dt> <dd>Coupon ID associated with the subscription </dd> * <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [default: USD] </dd> * <dt><tt>customer</tt></dt> <dd>Customer that is enrolling in the subscription. </dd> * <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Example: Monthly </dd> * <dt><tt>name</tt></dt> <dd>Name describing subscription </dd> * <dt><tt>plan</tt></dt> <dd>The ID of the plan that should be used for the subscription. </dd> * <dt><tt>quantity</tt></dt> <dd>Quantity of the plan for the subscription. [min value: 1] </dd></dl> * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/> * @return Subscription a Subscription object. */ public static function createSubscription($hash, $authentication = null) { $args = func_get_args(); $authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2); $instance = new Simplify_Subscription(); $instance->setAll($hash); $object = Simplify_PaymentsApi::createObject($instance, $authentication); return $object; }