Coupon Redemption API
Lookup a coupon on an account
Lookup information about a coupon redeemed by an account
Attributes
| Parameter | Description |
|---|---|
single_use |
True if the coupon is valid for one use only |
total_discounted_in_cents |
Total amount saved by the coupon |
currency |
Currency of the redemption |
created_at |
Date the coupon was redeemed |
Example
Response
Status: 200 OK Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<redemption href="https://api.recurly.com/v2/accounts/1/redemption">
<coupon href="https://api.recurly.com/v2/coupons/special"/>
<account href="https://api.recurly.com/v2/accounts/1"/>
<single_use type="boolean">false</single_use>
<total_discounted_in_cents type="integer">0</total_discounted_in_cents>
<currency>USD</currency>
<created_at type="datetime">2011-06-27T12:34:56Z</created_at>
</redemption>
$redemption = Recurly_CouponRedemption::get('1');
account = Recurly::Account.find('1')
redemption = account.redemption
account = Account.get('1')
redemption = account.redemption()
RecurlyAccountCoupon redemption = account.GetActiveCoupon();
Redeem a coupon before or after a subscription
Most coupons are redeemed during a new subscription. This endpoint allows you to redeem a coupon for a customer after their initial subscription, or in anticipation of a future subscription. When you redeem a coupon on an account, the coupon will be applied to the next subscription creation (new subscription), modification (e.g. upgrade or downgrade), or renewal.
Redemption Attributes
| Parameter | Description |
|---|---|
account_code |
Account code to apply redemption Required |
currency |
Currency for the redemption Required |
Example
Request
Accept-Type: application/xml Content-Type: application/xml; charset=utf-8
<redemption>
<account_code>1</account_code>
<currency>USD</currency>
</redemption>
Response
Status: 201 Created Content-Type: application/xml; charset=utf-8 Location: https://api.recurly.com/v2/accounts/1/redemption
<?xml version="1.0" encoding="UTF-8"?>
<redemption href="https://api.recurly.com/v2/accounts/1/redemption">
<coupon href="https://api.recurly.com/v2/coupons/special"/>
<account href="https://api.recurly.com/v2/accounts/1"/>
<single_use type="boolean">false</single_use>
<total_discounted_in_cents type="integer">0</total_discounted_in_cents>
<currency>USD</currency>
<created_at type="datetime">2011-06-27T12:34:56Z</created_at>
</redemption>
$coupon = Recurly_Coupon::get('special');
$redemption = $coupon->redeemCoupon('1', 'USD');
account = Recurly::Account.find('1')
coupon = Recurly::Coupon.find('special')
redemption = coupon.redeem(account)
coupon = Coupon.get('special')
redemption = Redemption(account_code='1', currency='USD')
redemption = coupon.redeem(redemption)
RecurlyAccountCoupon redemption = account.RedeemCoupon("special");
Remove a coupon from an account
Occasionally, you may want to remove a coupon from an account. Recurly will automatically remove coupons after they expire or are otherwise no longer valid for an account. If you want to remove a coupon from an account before it expires, you may use the examples below. Please note: the coupon will still count towards the "maximum redemption total" of a coupon.
Example
$redemption = Recurly_CouponRedemption::get('account_code');
$redemption->delete();
account = Recurly::Account.find('1')
redemption = account.redemption
redemption.delete()
account = Account.get('1')
redemption = account.redemption()
redemption.delete()
// TODO
