ruby on rails - Chargify API coupon creation -
i working on project , facing problem task. trying randomly generate 6 digit coupon number , post chargify account via there api. if coupon creation successful want same coupon code send customer through email.
as per chargify documentation how should send details chargify application :
{"subscription":{ "product_handle":"[@product.handle]", "customer_attributes":{ "first_name":"joe", "last_name":"blow", "email":"joe@example.com" }, "credit_card_attributes":{ "full_number":"1", "expiration_month":"10", "expiration_year":"2020" }, "coupon_code":"6 digit random code" }} """
https://[@subdomain].chargify.com/subscriptions.json.
i able create 6 digit random numerical code method :
rand(999999).to_s.center(6, rand(9).to_s).
however not seem working me. suggestions highly appreciated.
thanks
i'm not part of our tech or dev staff, i'm 99% sure can specify previously-defined coupon code in api call. must define coupon codes in chargify admin web interface. in api call above, can apply coupon subscription, assumption defined coupon code in admin interface.
we add capability in future, don't have specific date you.
sorry that.
--- lance walley --- chargify
Comments
Post a Comment