Skip to content

Commit

Permalink
Samples for API Quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-nilotpalr committed Sep 29, 2021
1 parent a22cadf commit e6edc6f
Show file tree
Hide file tree
Showing 10 changed files with 2,951 additions and 1,999 deletions.
59 changes: 59 additions & 0 deletions java/src/com/chargebee/samples/ApiQuickstart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

Environment.configure("my-domain-test","test_YkiZnDgc1MWyjlWRNBJgHsKCRSSB8cuDlS");
Result result = Customer.create()
.id("acme-east")
.company("Acme Eastern")
.autoCollection(on)
.cardNumber(4111111111111111)
.cardCvv(100)
.cardExpiryMonth(12)
.cardExpiryYear(2022)
.request();
Customer customer = result.customer();
Card card = result.card();



Result result = ItemFamily.create()
.id("cloud-storage")
.name("Cloud Storage")
.request();
ItemFamily itemFamily = result.itemFamily();



Result result = Item.create()
.id("silver-plan")
.name("Silver Plan")
.type(Type.PLAN)
.itemFamilyId("cloud-storage")
.request();
Item item = result.item();



Result result = ItemPrice.create()
.id("silver-plan-USD-monthly")
.itemId("silver-plan")
.name("Silver USD monthly")
.pricingModel(PricingModel.PER_UNIT)
.price(50000)
.externalName("Silver USD")
.periodUnit(PeriodUnit.MONTH)
.period(1)
.request();
ItemPrice itemPrice = result.itemPrice();



Result result = Subscription.createWithItems("acme-east")
.subscriptionItemItemPriceId(0,"silver-plan-USD-monthly")
.subscriptionItemQuantity(0,4)
.request();
Subscription subscription = result.subscription();
Customer customer = result.customer();
Card card = result.card();
Invoice invoice = result.invoice();
List<UnbilledCharge> unbilledCharges = result.unbilledCharges();


26 changes: 26 additions & 0 deletions java/src/com/chargebee/samples/Quickstart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

<dependency>
<groupId>com.chargebee</groupId>
<artifactId>chargebee-java</artifactId>
<version>LATEST</version>
</dependency>




implementation group: 'com.chargebee', name: 'chargebee-java', version: '{VERSION}'



Environment.configure("acmedoeswell-test","test_TsxhAdSxyvZ2Axio9YEj8rq24URhVkl3");
Result result = Customer.create()
.id("acme-east")
.company("Acme Eastern")
.autoCollection(on)
.cardNumber(4111111111111111)
.cardCvv(100)
.cardExpiryMonth(12)
.cardExpiryYear(2022)
.request();
Customer customer = result.customer();
Card card = result.card();
Loading

0 comments on commit e6edc6f

Please sign in to comment.