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 Item class #441

Merged
merged 1 commit into from
Nov 21, 2019
Merged

Add Item class #441

merged 1 commit into from
Nov 21, 2019

Conversation

joannasese
Copy link
Contributor

@joannasese joannasese commented Nov 18, 2019

Add Item class to PHP Client Library

To create an item:

  $item = new Recurly_Item();
  $item->item_code = 'little_llama';
  $item->name = 'Little Llama';
  $item->create();

To list all items:

$items = Recurly_ItemList::get();
foreach ($items as $item) {
  print "Item: $item->name\n";
}

To look up an item (item_code required):

$item = Recurly_Item::get('little_llama');

To update an item (item_code required):

$item = Recurly_Item::get('little_llama');
$item->description = 'An item description';
$item->update();

To delete an item (item_code required):

$item = Recurly_Item::get('little_llama');
$item->delete();

To restore an item (item_code required):

$item = Recurly_Item::get('little_llama');
$item->reactivate();

To create an adjustment including an item_code:

$charge = new Recurly_Adjustment();
$charge->account_code = $accountCode;
$charge->unit_amount_in_cents = 2000; 
$charge->currency = 'USD';
$charge->quantity = 1;
$charge->item_code = 'yellow_et';
$charge->end_date = '2045-08-02T16:48:34Z';
$charge->create();

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 46bcf1a into v2 Nov 21, 2019
@bhelx bhelx deleted the 727-item-catalog branch November 21, 2019 18:49
@joannasese joannasese added the V2 V2 Client label Nov 21, 2019
@joannasese joannasese mentioned this pull request Nov 21, 2019
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