Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional attributes to support item-backed add-ons #474

Merged
merged 2 commits into from
Mar 13, 2020

Conversation

joannasese
Copy link
Contributor

@joannasese joannasese commented Mar 6, 2020

To create item-backed add-on:

$add_on = new Recurly_Addon();
$add_on->plan_code = $plan->plan_code;
$add_on->item_code = $item->item_code;
$add_on->unit_amount_in_cents->addCurrency('USD', 400);
$add_on->create();

To get item-backed add-on:

Recurly_Addon::get($plan->plan_code, $item->item_code);
# or
Recurly_Addon::get($plan->plan_code, $add_on->add_on_code);

To update item-backed add-on:

$add_on->unit_amount_in_cents['USD'] = 200;
$add_on->update();

When add-on has an associated item, only the following attributes are updatable:

unit_amount_in_cents
default_quantity
display_quantity_on_hosted_page
optional

@joannasese joannasese added the V2 V2 Client label Mar 6, 2020
@joannasese joannasese requested a review from bhelx March 10, 2020 20:29
@joannasese joannasese marked this pull request as ready for review March 10, 2020 20:29
Copy link
Contributor

@bhelx bhelx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bhelx bhelx merged commit 073b8a8 into v2 Mar 13, 2020
@bhelx bhelx deleted the dx-1141-item-backed-add-ons branch March 13, 2020 21:00
@joannasese joannasese mentioned this pull request Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants