From e6edc6fb6cbba3a7c341ea26f232553d696e2db2 Mon Sep 17 00:00:00 2001 From: Nilotpal Roychowdhury Date: Wed, 29 Sep 2021 14:03:31 +0530 Subject: [PATCH] Samples for API Quickstart --- .../com/chargebee/samples/ApiQuickstart.java | 59 + .../src/com/chargebee/samples/Quickstart.java | 26 + java/webapp/adyen_wc_3ds/index.html | 483 ++++---- java/webapp/index.html | 1097 +++++++++------- php/adyen_wc_3ds/index.html | 483 ++++---- php/index.html | 1098 ++++++++++------- php/php_src/quickstart.php | 61 + .../controllers/api_quickstart_controller.rb | 63 + .../public/adyen_wc_3ds/index.html | 483 ++++---- ruby/cb_sample_apps/public/index.html | 1097 +++++++++------- 10 files changed, 2951 insertions(+), 1999 deletions(-) create mode 100644 java/src/com/chargebee/samples/ApiQuickstart.java create mode 100644 java/src/com/chargebee/samples/Quickstart.java create mode 100644 php/php_src/quickstart.php create mode 100644 ruby/cb_sample_apps/app/controllers/api_quickstart_controller.rb diff --git a/java/src/com/chargebee/samples/ApiQuickstart.java b/java/src/com/chargebee/samples/ApiQuickstart.java new file mode 100644 index 0000000..7e1dc1d --- /dev/null +++ b/java/src/com/chargebee/samples/ApiQuickstart.java @@ -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 unbilledCharges = result.unbilledCharges(); + + diff --git a/java/src/com/chargebee/samples/Quickstart.java b/java/src/com/chargebee/samples/Quickstart.java new file mode 100644 index 0000000..5a532b4 --- /dev/null +++ b/java/src/com/chargebee/samples/Quickstart.java @@ -0,0 +1,26 @@ + + + com.chargebee + chargebee-java + LATEST + + + + + +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(); diff --git a/java/webapp/adyen_wc_3ds/index.html b/java/webapp/adyen_wc_3ds/index.html index 0bdd165..c073625 100644 --- a/java/webapp/adyen_wc_3ds/index.html +++ b/java/webapp/adyen_wc_3ds/index.html @@ -1,257 +1,248 @@ - - + Adyen Web Components with Chargebee - - + + -
- +
- - - - -
- - + - const paymentMethodsResponse = { - "paymentMethods": [ - { - "brands": [ - "amex", - "bcmc", - "cup", - "diners", - "discover", - "jcb", - "maestro", - "mc", - "visa" - ], - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "type": "text" - }, - { - "key": "expiryYear", - "type": "text" - }, - { - "key": "cvc", - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], - "name": "Credit Card", - "type": "scheme" - }, - { - "configuration": { - "merchantId": "1000", - "merchantName": "Merchant Name" - }, - "details": [ - { - "key": "applepay.token", - "type": "applePayToken" - } - ], - "name": "Apple Pay", - "type": "applepay" - }, - { - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "type": "text" - }, - { - "key": "expiryYear", - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], - "name": "Bancontact card", - "type": "bcmc" - }, - { - "name": "Payconiq by Bancontact", - "type": "bcmc_mobile" - } - ] - }; + - const checkout = new AdyenCheckout(configuration); - const card = checkout.create("card"); - card.mount("#component-container"); +
- - function handleChargebeeFlow(state, dropin) { - - let chargebeeInstance = Chargebee.init({ - site: "acme-test", - publishableKey: "test__" - }); - // You can access the above created instance anywhere using the following code - let chargebeeInstance = Chargebee.getInstance(); - - - // You can access the above created instance anywhere using the following code - - - chargebeeInstance.load3DSHandler() - - - .then((threeDSHandler) => { - genPaymentIntent() - .then((response) => response.text()) - .then((data) => JSON.parse(data).payment_intent) - .then((response) => { - console.log("Generated Payment Intent"); - console.log(response); - - - threeDSHandler.setPaymentIntent(response, { - adyen: checkout - }); - - - console.log("Debug Set Payment Intent"); - console.log(threeDSHandler.getPaymentIntent()); - - - let payment_info = {}; - payment_info.element = card; - let additionalData = {}; - additionalData.billingAddress = - firstName: "John", - lastName: "Doe", - phone: "+234567890", - addressLine1: "PO Box 9999", - addressLine2: "", - addressLine3: "", - city: "Walnut", - state: "California", - stateCode: "CA", - countryCode: "US", - zip: "91789", - - }; - payment_info.additionalData = additionalData; - let callbacks = { - change: function(intent) { - // Triggers on each step transition - console.log("Data Changed"); - }, - success: function(intent) { - // Triggers when card is 3DS authorized - create_subscription(intent); - }, - error: function(intent, error) { - // Triggers when 3DS authorization fails - console.log("3DS Authorization failed"); - console.log(error); - }, - }; - threeDSHandler.handleCardPayment(payment_info, callbacks); - - }); - - }); - - - - \ No newline at end of file + + + diff --git a/java/webapp/index.html b/java/webapp/index.html index 6be8cad..84951d6 100644 --- a/java/webapp/index.html +++ b/java/webapp/index.html @@ -1,425 +1,682 @@ - - - - - Tutorials for integrating with Chargebee - - - - - - - - - - - -
- -
-
-
-
- -
- -
-
-

Hosted Payment Pages

-
-
-
- -
-
- Implement a simple checkout using a hosted payment page
- You’ll learn how to setup a secure, PCI compliant checkout that ensures customers are seamlessly redirected back to your site, post checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Implement an in-app checkout using an iframe based hosted payment page
- Learn how to implement an in-app checkout using iframe based PCI compliant hosted pages. The checkout form could be displayed as a pop-up or embed within your site. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Hosted Payment Pages - additional use cases

-
-
-
- -
-
- Convert an existing trial user to a paid subscriber
- Learn how to implement a checkout flow to get payment information and convert an existing trial/free user into a paid subscriber. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Update payment method using hosted pages
- This tutorial explains how you can let your customers add/update their payment method in the event of an expired card, a trial subscription e.t.c -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Two-step checkout with pass-through parameter
- A 2-step checkout process to store additional information in pass-through parameters before a customer pays, and retrieve the same after checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Advanced checkout options

-
-
-
- -
-
- 3DS supported Stripe.js Integration with Chargebee APIs
- In this tutorial, we will address the flow specifics of processing your payment through 3DS using Stripe Elements, integrated through Stripe.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- -
-
- 3DS supported Braintree.js Integration with Chargebee APIs
- In this tutorial, we will address the flow specifics of processing your payment through 3DS using three-d-secure.js, integrated through hosted-fields.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
-
- -
-
- Build your custom checkout form with dynamically changing order summary
- Learn how to implement an in-app checkout flow that allows your customers to select addons and apply coupons. The Estimate API is used to dynamically change the order summary that’s shown to the customer. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Build an in-app popup checkout form using Stripe.js
- Learn how to create a popup checkout using Stripe.js with Chargebee. Stripe.js ensures that sensitive credit card information is not passed to your server and Chargebee manages your customer subscriptions -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - -
-
- Build an in-app checkout form by embedding Stripe.js
- In this tutorial, you’ll learn how to create an in-app checkout using Stripe.js. Stripe.js makes any form page a checkout page and reduces the PCI DSS scope by taking care of all the sensitive card information. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Build an in-app checkout form using Braintree.js
- This tutorial covers how you can deploy an in-app checkout page using Braintree.js to create subscriptions in Chargebee and directly send card information to Braintree. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Other api samples

-
-
-
- -
-
- Create a portal for your customers
- Create a custom portal with Chargebee APIs, that allows your customers to edit their payment method, billing & shipping information, to access their invoices and subscriptions. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Get additional customer information with custom fields
- This tutorial explains how to pass values for the custom fields when creating a trial subscription. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Metered billing using Webhooks with the Invoice API
- In this tutorial, you’ll learn how to charge customers based on their usage, using Webhooks. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - - -
-
+ + + + + Tutorials for integrating with Chargebee + + + + + + + + + + +
+ +
+
+
+
+ +
+ +
+
+

Quickstart

+
+
+
+ +
+
+ API Quickstart
+ Learn how to quickly create a test subscription using Chargebee API v2. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + +

+
+ +
+ +
+
+

3DS checkout options

+
+
+
+ +
+
+ 3DS supported Adyen.js Integration with Chargebee APIs
+ In this tutorial, we will address the specifics of implementing card payments with 3D Secure flow and creating a subscription in Chargebee, using Adyen’s Web Components, integrated through Chargebee.js and Chargebee APIs. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + +

+
+ +
+ +
+ +
+
+ 3DS supported Stripe.js Integration with Chargebee APIs
+ We will address the 3DS flow specifics of creating a subscription in Chargebee using Stripe’s Elements, integrated through Stripe.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ 3DS supported Braintree.js Integration with Chargebee APIs
+ In this tutorial, we will address the flow specifics of processing your payment through 3DS using three-d-secure.js, integrated through hosted-fields.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ 3DS supported Checkout.com Integration with Chargebee APIs
+ We will address the 3DS flow specifics of creating a subscription in Chargebee using Checkout.com Frames, integrated through Frames JS and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+
+

Advanced checkout options

+
+
+
+ +
+
+ Build your custom checkout form with dynamically changing order summary
+ Learn how to implement an in-app checkout flow that allows your customers to select addons and apply coupons. The Estimate API is used to dynamically change the order summary that’s shown to the customer. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Build a custom in-app checkout form using Stripe.js Tokenization
+ In this tutorial, you’ll learn how to create an in-app checkout leveraging Stripe.js tokenization feature. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Build a custom in-app checkout form using Braintree.js
+ This tutorial covers how you can deploy an in-app checkout page using Braintree.js to create subscriptions in Chargebee and directly send card information to Braintree. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+
+

Other api samples

+
+
+
+ +
+
+ Create a portal for your customers
+ Create a custom portal with Chargebee APIs, that allows your customers to edit their payment method, billing & shipping information, to access their invoices and subscriptions. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Get additional customer information with custom fields
+ This tutorial explains how to pass values for the custom fields when creating a trial subscription. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+
-
- -
-
- +
+
+
+ +
+
+ + + + + + + + + \ No newline at end of file diff --git a/php/adyen_wc_3ds/index.html b/php/adyen_wc_3ds/index.html index 0bdd165..c073625 100644 --- a/php/adyen_wc_3ds/index.html +++ b/php/adyen_wc_3ds/index.html @@ -1,257 +1,248 @@ - - + Adyen Web Components with Chargebee - - + + -
- +
- - - - -
- - + - const paymentMethodsResponse = { - "paymentMethods": [ - { - "brands": [ - "amex", - "bcmc", - "cup", - "diners", - "discover", - "jcb", - "maestro", - "mc", - "visa" - ], - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "type": "text" - }, - { - "key": "expiryYear", - "type": "text" - }, - { - "key": "cvc", - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], - "name": "Credit Card", - "type": "scheme" - }, - { - "configuration": { - "merchantId": "1000", - "merchantName": "Merchant Name" - }, - "details": [ - { - "key": "applepay.token", - "type": "applePayToken" - } - ], - "name": "Apple Pay", - "type": "applepay" - }, - { - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "type": "text" - }, - { - "key": "expiryYear", - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], - "name": "Bancontact card", - "type": "bcmc" - }, - { - "name": "Payconiq by Bancontact", - "type": "bcmc_mobile" - } - ] - }; + - const checkout = new AdyenCheckout(configuration); - const card = checkout.create("card"); - card.mount("#component-container"); +
- - function handleChargebeeFlow(state, dropin) { - - let chargebeeInstance = Chargebee.init({ - site: "acme-test", - publishableKey: "test__" - }); - // You can access the above created instance anywhere using the following code - let chargebeeInstance = Chargebee.getInstance(); - - - // You can access the above created instance anywhere using the following code - - - chargebeeInstance.load3DSHandler() - - - .then((threeDSHandler) => { - genPaymentIntent() - .then((response) => response.text()) - .then((data) => JSON.parse(data).payment_intent) - .then((response) => { - console.log("Generated Payment Intent"); - console.log(response); - - - threeDSHandler.setPaymentIntent(response, { - adyen: checkout - }); - - - console.log("Debug Set Payment Intent"); - console.log(threeDSHandler.getPaymentIntent()); - - - let payment_info = {}; - payment_info.element = card; - let additionalData = {}; - additionalData.billingAddress = - firstName: "John", - lastName: "Doe", - phone: "+234567890", - addressLine1: "PO Box 9999", - addressLine2: "", - addressLine3: "", - city: "Walnut", - state: "California", - stateCode: "CA", - countryCode: "US", - zip: "91789", - - }; - payment_info.additionalData = additionalData; - let callbacks = { - change: function(intent) { - // Triggers on each step transition - console.log("Data Changed"); - }, - success: function(intent) { - // Triggers when card is 3DS authorized - create_subscription(intent); - }, - error: function(intent, error) { - // Triggers when 3DS authorization fails - console.log("3DS Authorization failed"); - console.log(error); - }, - }; - threeDSHandler.handleCardPayment(payment_info, callbacks); - - }); - - }); - - - - \ No newline at end of file + + + diff --git a/php/index.html b/php/index.html index c822cc5..84951d6 100644 --- a/php/index.html +++ b/php/index.html @@ -1,426 +1,682 @@ - - - - - Tutorials for integrating with Chargebee - - - - - - - - - - - -
- -
-
-
-
- -
- -
-
-

Hosted Payment Pages

-
-
-
- -
-
- Implement a simple checkout using a hosted payment page
- You’ll learn how to setup a secure, PCI compliant checkout that ensures customers are seamlessly redirected back to your site, post checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Implement an in-app checkout using an iframe based hosted payment page
- Learn how to implement an in-app checkout using iframe based PCI compliant hosted pages. The checkout form could be displayed as a pop-up or embed within your site. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Hosted Payment Pages - additional use cases

-
-
-
- -
-
- Convert an existing trial user to a paid subscriber
- Learn how to implement a checkout flow to get payment information and convert an existing trial/free user into a paid subscriber. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Update payment method using hosted pages
- This tutorial explains how you can let your customers add/update their payment method in the event of an expired card, a trial subscription e.t.c -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Two-step checkout with pass-through parameter
- A 2-step checkout process to store additional information in pass-through parameters before a customer pays, and retrieve the same after checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Advanced checkout options

-
-
-
- -
-
- 3DS supported Stripe.js Integration with Chargebee APIs
- In this tutorial, we will address the flow specifics of processing your payment through 3DS using Stripe Elements, integrated through Stripe.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- -
-
- 3DS supported Braintree.js Integration with Chargebee APIs
- In this tutorial, we will address the flow specifics of processing your payment through 3DS using three-d-secure.js, integrated through hosted-fields.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- -
-
- Build your custom checkout form with dynamically changing order summary
- Learn how to implement an in-app checkout flow that allows your customers to select addons and apply coupons. The Estimate API is used to dynamically change the order summary that’s shown to the customer. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - -
-
- Build an in-app popup checkout form using Stripe.js
- Learn how to create a popup checkout using Stripe.js with Chargebee. Stripe.js ensures that sensitive credit card information is not passed to your server and Chargebee manages your customer subscriptions -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Build an in-app checkout form by embedding Stripe.js
- In this tutorial, you’ll learn how to create an in-app checkout using Stripe.js. Stripe.js makes any form page a checkout page and reduces the PCI DSS scope by taking care of all the sensitive card information. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Build an in-app checkout form using Braintree.js
- This tutorial covers how you can deploy an in-app checkout page using Braintree.js to create subscriptions in Chargebee and directly send card information to Braintree. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Other api samples

-
-
-
- -
-
- Create a portal for your customers
- Create a custom portal with Chargebee APIs, that allows your customers to edit their payment method, billing & shipping information, to access their invoices and subscriptions. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Get additional customer information with custom fields
- This tutorial explains how to pass values for the custom fields when creating a trial subscription. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Metered billing using Webhooks with the Invoice API
- In this tutorial, you’ll learn how to charge customers based on their usage, using Webhooks. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - - -
-
+ + + + + Tutorials for integrating with Chargebee + + + + + + + + + + +
+ +
+
+
+
+ +
+ +
+
+

Quickstart

+
+
+
+ +
+
+ API Quickstart
+ Learn how to quickly create a test subscription using Chargebee API v2. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + +

+
+ +
+ +
+
+

3DS checkout options

+
+
+
+ +
+
+ 3DS supported Adyen.js Integration with Chargebee APIs
+ In this tutorial, we will address the specifics of implementing card payments with 3D Secure flow and creating a subscription in Chargebee, using Adyen’s Web Components, integrated through Chargebee.js and Chargebee APIs. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + +

+
+ +
+ +
+ +
+
+ 3DS supported Stripe.js Integration with Chargebee APIs
+ We will address the 3DS flow specifics of creating a subscription in Chargebee using Stripe’s Elements, integrated through Stripe.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ 3DS supported Braintree.js Integration with Chargebee APIs
+ In this tutorial, we will address the flow specifics of processing your payment through 3DS using three-d-secure.js, integrated through hosted-fields.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ 3DS supported Checkout.com Integration with Chargebee APIs
+ We will address the 3DS flow specifics of creating a subscription in Chargebee using Checkout.com Frames, integrated through Frames JS and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+
+

Advanced checkout options

+
+
+
+ +
+
+ Build your custom checkout form with dynamically changing order summary
+ Learn how to implement an in-app checkout flow that allows your customers to select addons and apply coupons. The Estimate API is used to dynamically change the order summary that’s shown to the customer. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Build a custom in-app checkout form using Stripe.js Tokenization
+ In this tutorial, you’ll learn how to create an in-app checkout leveraging Stripe.js tokenization feature. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Build a custom in-app checkout form using Braintree.js
+ This tutorial covers how you can deploy an in-app checkout page using Braintree.js to create subscriptions in Chargebee and directly send card information to Braintree. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+
+

Other api samples

+
+
+
+ +
+
+ Create a portal for your customers
+ Create a custom portal with Chargebee APIs, that allows your customers to edit their payment method, billing & shipping information, to access their invoices and subscriptions. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Get additional customer information with custom fields
+ This tutorial explains how to pass values for the custom fields when creating a trial subscription. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+
-
- -
-
- +
+
+
+ +
+
+ + + + + + + + + \ No newline at end of file diff --git a/php/php_src/quickstart.php b/php/php_src/quickstart.php new file mode 100644 index 0000000..362e4dd --- /dev/null +++ b/php/php_src/quickstart.php @@ -0,0 +1,61 @@ + +require 'ChargeBee.php'; +ChargeBee_Environment::configure("my-domain-test","test_YkiZnDgc1MWyjlWRNBJgHsKCRSSB8cuDlS"); +$result = ChargeBee_Customer::create(array( + "id" => "acme-east", + "company" => "Acme Eastern", + "autoCollection" => "on", + "card" => array( + "number" => "4111111111111111", + "cvv" => "100", + "expiryMonth" => 12, + "expiryYear" => 2022 + ) + )); +$customer = $result->customer(); +$card = $result->card(); + + + +$result = ChargeBee_ItemFamily::create(array( + "id" => "cloud-storage", + "name" => "Cloud Storage" + )); +$itemFamily = $result->itemFamily(); + + + +$result = ChargeBee_Item::create(array( + "id" => "silver-plan", + "name" => "Silver Plan", + "type" => "plan", + "item_family_id" => "cloud-storage" + )); +$item = $result->item(); + + + +$result = ChargeBee_ItemPrice::create(array( + "id" => "silver-plan-USD-monthly", + "itemId" => "silver-plan", + "name" => "Silver USD monthly", + "pricingModel" => "per_unit", + "price" => 50000, + "externalName" => "Silver USD", + "periodUnit" => "month", + "period" => 1 + )); +$itemPrice = $result->itemPrice(); + + + +$result = ChargeBee_Subscription::createWithItems("acme-east",array( + "subscriptionItems" => array(array( + "itemPriceId" => "silver-plan-USD-monthly", + "quantity" => 4)) + )); +$subscription = $result->subscription(); +$customer = $result->customer(); +$card = $result->card(); +$invoice = $result->invoice(); +$unbilledCharges = $result->unbilledCharges(); diff --git a/ruby/cb_sample_apps/app/controllers/api_quickstart_controller.rb b/ruby/cb_sample_apps/app/controllers/api_quickstart_controller.rb new file mode 100644 index 0000000..fde3826 --- /dev/null +++ b/ruby/cb_sample_apps/app/controllers/api_quickstart_controller.rb @@ -0,0 +1,63 @@ + +require 'chargebee' +ChargeBee.configure(:site => "my-domain-test", + :api_key => "test_YkiZnDgc1MWyjlWRNBJgHsKCRSSB8cuDlS") +result = ChargeBee::Customer.create({ + :id => "acme-east", + :company => "Acme Eastern", + :autoCollection => "on", + :card => { + :number => "4111111111111111", + :expiry_month => 12, + :expiry_year => 2022, + :cvv => "100" + } + }) +customer = result.customer +card = result.card + + + +result = ChargeBee::ItemFamily.create({ + :id => "cloud-storage", + :name => "Cloud Storage" + }) +item_family = result.item_family + + + +result = ChargeBee::Item.create({ + :id => "silver-plan", + :name => "Silver Plan", + :type => "plan", + :item_family_id => "cloud-storage" + }) +item = result.item + + + +result = ChargeBee::ItemPrice.create({ + :id => "silver-plan-USD-monthly", + :item_id => "silver-plan", + :name => "Silver USD monthly", + :pricing_model => "per_unit", + :price => 50000, + :external_name => "Silver USD", + :period_unit => "month", + :period => 1 + }) +item_price = result.item_price + + + +result = ChargeBee::Subscription.create_with_items("acme-east",{ + :subscription_items => [{ + :item_price_id => "silver-plan-USD-monthly", + :quantity => 4 + }] + }) +subscription = result.subscription +customer = result.customer +card = result.card +invoice = result.invoice +unbilled_charges = result.unbilled_charges diff --git a/ruby/cb_sample_apps/public/adyen_wc_3ds/index.html b/ruby/cb_sample_apps/public/adyen_wc_3ds/index.html index 0bdd165..c073625 100644 --- a/ruby/cb_sample_apps/public/adyen_wc_3ds/index.html +++ b/ruby/cb_sample_apps/public/adyen_wc_3ds/index.html @@ -1,257 +1,248 @@ - - + Adyen Web Components with Chargebee - - + + -
- +
- - - - -
- - + - const paymentMethodsResponse = { - "paymentMethods": [ - { - "brands": [ - "amex", - "bcmc", - "cup", - "diners", - "discover", - "jcb", - "maestro", - "mc", - "visa" - ], - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "type": "text" - }, - { - "key": "expiryYear", - "type": "text" - }, - { - "key": "cvc", - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], - "name": "Credit Card", - "type": "scheme" - }, - { - "configuration": { - "merchantId": "1000", - "merchantName": "Merchant Name" - }, - "details": [ - { - "key": "applepay.token", - "type": "applePayToken" - } - ], - "name": "Apple Pay", - "type": "applepay" - }, - { - "details": [ - { - "key": "number", - "type": "text" - }, - { - "key": "expiryMonth", - "type": "text" - }, - { - "key": "expiryYear", - "type": "text" - }, - { - "key": "holderName", - "optional": true, - "type": "text" - } - ], - "name": "Bancontact card", - "type": "bcmc" - }, - { - "name": "Payconiq by Bancontact", - "type": "bcmc_mobile" - } - ] - }; + - const checkout = new AdyenCheckout(configuration); - const card = checkout.create("card"); - card.mount("#component-container"); +
- - function handleChargebeeFlow(state, dropin) { - - let chargebeeInstance = Chargebee.init({ - site: "acme-test", - publishableKey: "test__" - }); - // You can access the above created instance anywhere using the following code - let chargebeeInstance = Chargebee.getInstance(); - - - // You can access the above created instance anywhere using the following code - - - chargebeeInstance.load3DSHandler() - - - .then((threeDSHandler) => { - genPaymentIntent() - .then((response) => response.text()) - .then((data) => JSON.parse(data).payment_intent) - .then((response) => { - console.log("Generated Payment Intent"); - console.log(response); - - - threeDSHandler.setPaymentIntent(response, { - adyen: checkout - }); - - - console.log("Debug Set Payment Intent"); - console.log(threeDSHandler.getPaymentIntent()); - - - let payment_info = {}; - payment_info.element = card; - let additionalData = {}; - additionalData.billingAddress = - firstName: "John", - lastName: "Doe", - phone: "+234567890", - addressLine1: "PO Box 9999", - addressLine2: "", - addressLine3: "", - city: "Walnut", - state: "California", - stateCode: "CA", - countryCode: "US", - zip: "91789", - - }; - payment_info.additionalData = additionalData; - let callbacks = { - change: function(intent) { - // Triggers on each step transition - console.log("Data Changed"); - }, - success: function(intent) { - // Triggers when card is 3DS authorized - create_subscription(intent); - }, - error: function(intent, error) { - // Triggers when 3DS authorization fails - console.log("3DS Authorization failed"); - console.log(error); - }, - }; - threeDSHandler.handleCardPayment(payment_info, callbacks); - - }); - - }); - - - - \ No newline at end of file + + + diff --git a/ruby/cb_sample_apps/public/index.html b/ruby/cb_sample_apps/public/index.html index 57e2765..84951d6 100644 --- a/ruby/cb_sample_apps/public/index.html +++ b/ruby/cb_sample_apps/public/index.html @@ -1,425 +1,682 @@ - - - - - Tutorials for integrating with Chargebee - - - - - - - - - - - -
- -
-
-
-
- -
- -
-
-

Hosted Payment Pages

-
-
-
- -
-
- Implement a simple checkout using a hosted payment page
- You’ll learn how to setup a secure, PCI compliant checkout that ensures customers are seamlessly redirected back to your site, post checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Implement an in-app checkout using an iframe based hosted payment page
- Learn how to implement an in-app checkout using iframe based PCI compliant hosted pages. The checkout form could be displayed as a pop-up or embed within your site. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Hosted Payment Pages - additional use cases

-
-
-
- -
-
- Convert an existing trial user to a paid subscriber
- Learn how to implement a checkout flow to get payment information and convert an existing trial/free user into a paid subscriber. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Update payment method using hosted pages
- This tutorial explains how you can let your customers add/update their payment method in the event of an expired card, a trial subscription e.t.c -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Two-step checkout with pass-through parameter
- A 2-step checkout process to store additional information in pass-through parameters before a customer pays, and retrieve the same after checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Advanced checkout options

-
-
-
- -
-
- 3DS supported Stripe.js Integration with Chargebee APIs
- In this tutorial, we will address the flow specifics of processing your payment through 3DS using Stripe Elements, integrated through Stripe.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- -
-
- 3DS supported Braintree.js Integration with Chargebee APIs
- In this tutorial, we will address the flow specifics of processing your payment through 3DS using three-d-secure.js, integrated through hosted-fields.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- -
-
- Build your custom checkout form with dynamically changing order summary
- Learn how to implement an in-app checkout flow that allows your customers to select addons and apply coupons. The Estimate API is used to dynamically change the order summary that’s shown to the customer. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- -
-
- Build an in-app popup checkout form using Stripe.js
- Learn how to create a popup checkout using Stripe.js with Chargebee. Stripe.js ensures that sensitive credit card information is not passed to your server and Chargebee manages your customer subscriptions -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Build an in-app checkout form by embedding Stripe.js
- In this tutorial, you’ll learn how to create an in-app checkout using Stripe.js. Stripe.js makes any form page a checkout page and reduces the PCI DSS scope by taking care of all the sensitive card information. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Build an in-app checkout form using Braintree.js
- This tutorial covers how you can deploy an in-app checkout page using Braintree.js to create subscriptions in Chargebee and directly send card information to Braintree. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - -
-
-

Other api samples

-
-
-
- -
-
- Create a portal for your customers
- Create a custom portal with Chargebee APIs, that allows your customers to edit their payment method, billing & shipping information, to access their invoices and subscriptions. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Get additional customer information with custom fields
- This tutorial explains how to pass values for the custom fields when creating a trial subscription. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- -
- - - -
-
- Metered billing using Webhooks with the Invoice API
- In this tutorial, you’ll learn how to charge customers based on their usage, using Webhooks. -

- Setup configuration       - View live demo       - Read more       - View source in Github       - View video demo -

-
- -
- - - - - -
-
+ + + + + Tutorials for integrating with Chargebee + + + + + + + + + + +
+ +
+
+
+
+ +
+ +
+
+

Quickstart

+
+
+
+ +
+
+ API Quickstart
+ Learn how to quickly create a test subscription using Chargebee API v2. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + +

+
+ +
+ +
+
+

3DS checkout options

+
+
+
+ +
+
+ 3DS supported Adyen.js Integration with Chargebee APIs
+ In this tutorial, we will address the specifics of implementing card payments with 3D Secure flow and creating a subscription in Chargebee, using Adyen’s Web Components, integrated through Chargebee.js and Chargebee APIs. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + +

+
+ +
+ +
+ +
+
+ 3DS supported Stripe.js Integration with Chargebee APIs
+ We will address the 3DS flow specifics of creating a subscription in Chargebee using Stripe’s Elements, integrated through Stripe.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ 3DS supported Braintree.js Integration with Chargebee APIs
+ In this tutorial, we will address the flow specifics of processing your payment through 3DS using three-d-secure.js, integrated through hosted-fields.js and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ 3DS supported Checkout.com Integration with Chargebee APIs
+ We will address the 3DS flow specifics of creating a subscription in Chargebee using Checkout.com Frames, integrated through Frames JS and Chargebee APIs. We have also included the example code and Github links to it. This way, you can try out the tutorial with our mock checkout. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+
+

Advanced checkout options

+
+
+
+ +
+
+ Build your custom checkout form with dynamically changing order summary
+ Learn how to implement an in-app checkout flow that allows your customers to select addons and apply coupons. The Estimate API is used to dynamically change the order summary that’s shown to the customer. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Build a custom in-app checkout form using Stripe.js Tokenization
+ In this tutorial, you’ll learn how to create an in-app checkout leveraging Stripe.js tokenization feature. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Build a custom in-app checkout form using Braintree.js
+ This tutorial covers how you can deploy an in-app checkout page using Braintree.js to create subscriptions in Chargebee and directly send card information to Braintree. This ensures that sensitive credit card information does not pass through your server, thereby reducing your PCI compliance requirements. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+
+

Other api samples

+
+
+
+ +
+
+ Create a portal for your customers
+ Create a custom portal with Chargebee APIs, that allows your customers to edit their payment method, billing & shipping information, to access their invoices and subscriptions. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+ +
+ +
+ +
+
+ Get additional customer information with custom fields
+ This tutorial explains how to pass values for the custom fields when creating a trial subscription. +

+ Setup + configuration +       + View + live demo +       + Read more +       + View source in Github +       + + View video demo +

+
+
-
- -
-
- +
+
+
+ +
+
+ + + + + + + + + \ No newline at end of file