SlideShare a Scribd company logo
What is the Android Buy SDK?
What's new with the Android Buy
SDK?
GraphQL?
In the olden days of REST
! GET h&ps://joshubrown.myshopify.com/collec:ons.json
! GET h&ps://joshubrown.myshopify.com/products.json
! GET h&ps://joshubrown.myshopify.com/meta.json
Before you build
Crea%ng the mobile buy channel in
Shopify
Free ! stores: developers.shopify.com
Grade build dependencies
compile 'com.shopify.mobilebuysdk:buy3:3.0.0'
compile 'com.shopify.mobilebuysdk:buy3-pay-support:1.0.0'
Se#ng up GraphClient
GraphClient graphClient = GraphClient.builder(this)
.shopDomain(BuildConfig.SHOP_DOMAIN)
.accessToken(BuildConfig.API_KEY)
.build();
Defining a query
Storefront.QueryRootQuery query = Storefront.query(new Storefront.QueryRootQueryDefinition() {
@Override
public void define(final Storefront.QueryRootQuery rootQueryBuilder) {
rootQueryBuilder.shop(new Storefront.ShopQueryDefinition() {
@Override
public void define(final Storefront.ShopQuery shopQueryBuilder) {
shopQueryBuilder.privacyPolicy(new Storefront.ShopPolicyQueryDefinition() {
@Override
public void define(final Storefront.ShopPolicyQuery policyQueryBuilder) {
policyQueryBuilder.body();
policyQueryBuilder.url();
}
});
}
});
}
});
Defining a query with Lambda expressions
Storefront.QueryRootQuery query = Storefront.query(rootQuery -> rootQuery
.shop(shopQuery -> shopQuery
.privacyPolicy(policyQuery -> policyQuery
.body()
.url()
)
)
);
Log.v(TAG, query.toString());
{
shop {
privacyPolicy {
id
body
url
}
}
}
QueryGraphCall call = graphClient.queryGraph(query);
call.enqueue(new GraphCall.Callback<Storefront.QueryRoot>() {
@Override
public void onResponse(@NonNull GraphResponse<Storefront.QueryRoot> response) {
String body = response.data().getShop().getPrivacyPolicy().getBody();
String url = response.data().getShop().getPrivacyPolicy().getUrl();
}
@Override
public void onFailure(@NonNull GraphError error) {
Log.e("db", "Failed to execute query" + error.toString());
}
});
Retrieving product and collec1ons
data
Storefront.QueryRootQuery query = Storefront.query(rootQuery -> rootQuery
.shop(shopQuery -> shopQuery
.collections(10, collectionConnectionQuery -> collectionConnectionQuery
.edges(collectionEdgeQuery -> collectionEdgeQuery
.node(collectionQuery -> collectionQuery
.title()
.products(10, productConnectionQuery -> productConnectionQuery
.edges(productEdgeQuery -> productEdgeQuery
.node(productQuery -> productQuery
.title()
.productType()
.description()
)
)
)
)
)
)
)
);
Search !
Storefront.QueryRootQuery query = Storefront.query(root -> root
.shop(shop -> shop
.products(10, arg -> arg.query("lime"), connection -> connection
.edges(edges -> edges
.node(node -> node
.title()
)
)
)
)
);
!
• Fuzzy match on all fields of the resource: burger
• On a specific field: title:"Bacon burger"
• Nega;ve matches: -title:"Plate of tomatoes"
• Combina;ons: (product_type:"drink" AND
title:Tea)
Adding customer signup
Storefront.CustomerCreateInput customer = new Storefront.CustomerCreateInput("test", "test")
.setEmail("josh.brown@shopify.com")
.setFirstName("Josh")
.setLastName("Brown")
.setPassword("verysecret")
.setAcceptsMarketing(true);
Storefront.MutationQuery query = Storefront.mutation(rootQuery -> rootQuery
.customerCreate(customer, createCustomer -> createCustomer
.customer(customerQuery -> customerQuery
.firstName()
.id()
)
.userErrors(userErrorQuery -> userErrorQuery
.field()
.message()
)
)
);
graphClient.mutateGraph(query).enqueue(new GraphCall.Callback<Storefront.Mutation>() {
@Override
public void onResponse(@NonNull GraphResponse<Storefront.Mutation> response) {
if (!response.data().getCustomerCreate().getUserErrors().isEmpty()) {
for (Storefront.UserError error: response.data().getCustomerCreate().getUserErrors()
) {
Log.v(TAG, error.getMessage());
}
}
Storefront.Customer customer = response.data().getCustomerCreate().getCustomer();
Log.v(TAG, customer.getId().toString());
}
@Override
public void onFailure(GraphError error) {
// ...
}
});
Checkout op+ons
Web checkout !
Android Pay !
Web checkout
Storefront.CheckoutCreateInput input = new Storefront.CheckoutCreateInput()
.setLineItems(Arrays.asList(
new Storefront.CheckoutLineItemInput(new ID("AjsFwRr=="), 5),
new Storefront.CheckoutLineItemInput(new ID("JfEiTnD=="), 3)
));
Storefront.MutationQuery query = Storefront.mutation(mutationQuery -> mutationQuery
.checkoutCreate(input, createPayloadQuery -> createPayloadQuery
.checkout(checkoutQuery -> checkoutQuery
.webUrl()
)
.userErrors(userErrorQuery -> userErrorQuery
.field()
.message()
)
)
);
graphClient.mutateGraph(query).enqueue(new GraphCall.Callback<Storefront.Mutation>() {
@Override
public void onResponse(@NonNull GraphResponse<Storefront.Mutation> response) {
if (!response.data().getCheckoutCreate().getUserErrors().isEmpty()) {
for (Storefront.UserError error :
response.data().getCheckoutCreate().getUserErrors()) {
Log.v(TAG, error.getMessage());
}
} else {
Storefront.Checkout checkout = response.data().getCheckoutCreate().getCheckout();
Log.v(TAG, checkout.getWebUrl());
}
}
@Override
public void onFailure(@NonNull GraphError error) {
}
});
Android Pay
compile 'com.shopify.mobilebuysdk:buy3-pay-
support:1.0.0'
PayCart - building the Android Pay cart
PayCart payCart = PayCart.builder()
.merchantName(MERCHANT_NAME)
.currencyCode(shop.currency)
.shippingAddressRequired(checkout.requiresShipping)
.phoneNumberRequired(true)
.shipsToCountries(Arrays.asList("US", "CA"))
.addLineItem("Product1", 1, BigDecimal.valueOf(1.99))
.addLineItem("Product2", 10, BigDecimal.valueOf(3.99))
.subtotal(checkout.subtotalPrice)
.totalPrice(checkout.totalPrice)
.taxPrice(checkout.taxPrice)
.build();
PayHelper - interac/ons with Android Pay API
Resources
Building Commerce into Mobile Apps with Shopify's Android Buy SDK
Building Commerce into Mobile Apps with Shopify's Android Buy SDK
Building Commerce into Mobile Apps with Shopify's Android Buy SDK

More Related Content

Similar to Building Commerce into Mobile Apps with Shopify's Android Buy SDK

Repensando o Desenvolvimento Web com Ruby on Rails
Repensando o Desenvolvimento Web com Ruby on RailsRepensando o Desenvolvimento Web com Ruby on Rails
Repensando o Desenvolvimento Web com Ruby on Rails
Dante Regis
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface
 
A Novel Approach to Scraping Websites - Rob Ousbey, MozCon 2020
A Novel Approach to Scraping Websites - Rob Ousbey, MozCon 2020A Novel Approach to Scraping Websites - Rob Ousbey, MozCon 2020
A Novel Approach to Scraping Websites - Rob Ousbey, MozCon 2020
Rob Ousbey
 
Functional Web Development using Elm
Functional Web Development using ElmFunctional Web Development using Elm
Functional Web Development using Elm
💻 Spencer Schneidenbach
 
How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019
Paul Shapiro
 
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js Fundamentals
Mark
 
MongoDB World 2018: Keynote
MongoDB World 2018: KeynoteMongoDB World 2018: Keynote
MongoDB World 2018: Keynote
MongoDB
 
Decoupled Days 2019: Delivering Headless Commerce
Decoupled Days 2019: Delivering Headless CommerceDecoupled Days 2019: Delivering Headless Commerce
Decoupled Days 2019: Delivering Headless Commerce
Matt Glaman
 
The Principle of Hybrid App.
The Principle of Hybrid App.The Principle of Hybrid App.
The Principle of Hybrid App.
musart Park
 
CodeStock :: Introduction To MacRuby and HotCocoa
CodeStock :: Introduction To MacRuby and HotCocoaCodeStock :: Introduction To MacRuby and HotCocoa
CodeStock :: Introduction To MacRuby and HotCocoa
Doc Norton
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
Mark
 
Paytm integration in swift
Paytm integration in swiftPaytm integration in swift
Paytm integration in swift
InnovationM
 
CodingSerbia2014-JavaVSPig
CodingSerbia2014-JavaVSPigCodingSerbia2014-JavaVSPig
CodingSerbia2014-JavaVSPig
Dusan Zamurovic
 
WooCommerce CRUD and Data Store by Akeda Bagus
WooCommerce CRUD and Data Store by Akeda BagusWooCommerce CRUD and Data Store by Akeda Bagus
WooCommerce CRUD and Data Store by Akeda Bagus
WordCamp Indonesia
 
Infinum Android Talks #16 - App Links by Ana Baotic
Infinum Android Talks #16 - App Links by Ana BaoticInfinum Android Talks #16 - App Links by Ana Baotic
Infinum Android Talks #16 - App Links by Ana Baotic
Infinum
 
Rapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebaseRapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and Firebase
Peter Friese
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_libraries
NCCOMMS
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
Chris Alfano
 
Elixir, GraphQL and Vue.js
Elixir, GraphQL and Vue.jsElixir, GraphQL and Vue.js
Elixir, GraphQL and Vue.js
Jeroen Visser
 
Rapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebaseRapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and Firebase
Peter Friese
 

Similar to Building Commerce into Mobile Apps with Shopify's Android Buy SDK (20)

Repensando o Desenvolvimento Web com Ruby on Rails
Repensando o Desenvolvimento Web com Ruby on RailsRepensando o Desenvolvimento Web com Ruby on Rails
Repensando o Desenvolvimento Web com Ruby on Rails
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
 
A Novel Approach to Scraping Websites - Rob Ousbey, MozCon 2020
A Novel Approach to Scraping Websites - Rob Ousbey, MozCon 2020A Novel Approach to Scraping Websites - Rob Ousbey, MozCon 2020
A Novel Approach to Scraping Websites - Rob Ousbey, MozCon 2020
 
Functional Web Development using Elm
Functional Web Development using ElmFunctional Web Development using Elm
Functional Web Development using Elm
 
How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019
 
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js Fundamentals
 
MongoDB World 2018: Keynote
MongoDB World 2018: KeynoteMongoDB World 2018: Keynote
MongoDB World 2018: Keynote
 
Decoupled Days 2019: Delivering Headless Commerce
Decoupled Days 2019: Delivering Headless CommerceDecoupled Days 2019: Delivering Headless Commerce
Decoupled Days 2019: Delivering Headless Commerce
 
The Principle of Hybrid App.
The Principle of Hybrid App.The Principle of Hybrid App.
The Principle of Hybrid App.
 
CodeStock :: Introduction To MacRuby and HotCocoa
CodeStock :: Introduction To MacRuby and HotCocoaCodeStock :: Introduction To MacRuby and HotCocoa
CodeStock :: Introduction To MacRuby and HotCocoa
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
 
Paytm integration in swift
Paytm integration in swiftPaytm integration in swift
Paytm integration in swift
 
CodingSerbia2014-JavaVSPig
CodingSerbia2014-JavaVSPigCodingSerbia2014-JavaVSPig
CodingSerbia2014-JavaVSPig
 
WooCommerce CRUD and Data Store by Akeda Bagus
WooCommerce CRUD and Data Store by Akeda BagusWooCommerce CRUD and Data Store by Akeda Bagus
WooCommerce CRUD and Data Store by Akeda Bagus
 
Infinum Android Talks #16 - App Links by Ana Baotic
Infinum Android Talks #16 - App Links by Ana BaoticInfinum Android Talks #16 - App Links by Ana Baotic
Infinum Android Talks #16 - App Links by Ana Baotic
 
Rapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebaseRapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and Firebase
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_libraries
 
Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011Jarv.us Showcase — SenchaCon 2011
Jarv.us Showcase — SenchaCon 2011
 
Elixir, GraphQL and Vue.js
Elixir, GraphQL and Vue.jsElixir, GraphQL and Vue.js
Elixir, GraphQL and Vue.js
 
Rapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and FirebaseRapid Application Development with SwiftUI and Firebase
Rapid Application Development with SwiftUI and Firebase
 

Recently uploaded

How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 

Recently uploaded (20)

How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 

Building Commerce into Mobile Apps with Shopify's Android Buy SDK

  • 1.
  • 2. What is the Android Buy SDK?
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. What's new with the Android Buy SDK?
  • 9.
  • 10. In the olden days of REST ! GET h&ps://joshubrown.myshopify.com/collec:ons.json ! GET h&ps://joshubrown.myshopify.com/products.json ! GET h&ps://joshubrown.myshopify.com/meta.json
  • 12. Crea%ng the mobile buy channel in Shopify Free ! stores: developers.shopify.com
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Grade build dependencies compile 'com.shopify.mobilebuysdk:buy3:3.0.0' compile 'com.shopify.mobilebuysdk:buy3-pay-support:1.0.0'
  • 18. Se#ng up GraphClient GraphClient graphClient = GraphClient.builder(this) .shopDomain(BuildConfig.SHOP_DOMAIN) .accessToken(BuildConfig.API_KEY) .build();
  • 19. Defining a query Storefront.QueryRootQuery query = Storefront.query(new Storefront.QueryRootQueryDefinition() { @Override public void define(final Storefront.QueryRootQuery rootQueryBuilder) { rootQueryBuilder.shop(new Storefront.ShopQueryDefinition() { @Override public void define(final Storefront.ShopQuery shopQueryBuilder) { shopQueryBuilder.privacyPolicy(new Storefront.ShopPolicyQueryDefinition() { @Override public void define(final Storefront.ShopPolicyQuery policyQueryBuilder) { policyQueryBuilder.body(); policyQueryBuilder.url(); } }); } }); } });
  • 20. Defining a query with Lambda expressions Storefront.QueryRootQuery query = Storefront.query(rootQuery -> rootQuery .shop(shopQuery -> shopQuery .privacyPolicy(policyQuery -> policyQuery .body() .url() ) ) );
  • 22. QueryGraphCall call = graphClient.queryGraph(query); call.enqueue(new GraphCall.Callback<Storefront.QueryRoot>() { @Override public void onResponse(@NonNull GraphResponse<Storefront.QueryRoot> response) { String body = response.data().getShop().getPrivacyPolicy().getBody(); String url = response.data().getShop().getPrivacyPolicy().getUrl(); } @Override public void onFailure(@NonNull GraphError error) { Log.e("db", "Failed to execute query" + error.toString()); } });
  • 23. Retrieving product and collec1ons data
  • 24.
  • 25. Storefront.QueryRootQuery query = Storefront.query(rootQuery -> rootQuery .shop(shopQuery -> shopQuery .collections(10, collectionConnectionQuery -> collectionConnectionQuery .edges(collectionEdgeQuery -> collectionEdgeQuery .node(collectionQuery -> collectionQuery .title() .products(10, productConnectionQuery -> productConnectionQuery .edges(productEdgeQuery -> productEdgeQuery .node(productQuery -> productQuery .title() .productType() .description() ) ) ) ) ) ) ) );
  • 26. Search ! Storefront.QueryRootQuery query = Storefront.query(root -> root .shop(shop -> shop .products(10, arg -> arg.query("lime"), connection -> connection .edges(edges -> edges .node(node -> node .title() ) ) ) ) );
  • 27. ! • Fuzzy match on all fields of the resource: burger • On a specific field: title:"Bacon burger" • Nega;ve matches: -title:"Plate of tomatoes" • Combina;ons: (product_type:"drink" AND title:Tea)
  • 28. Adding customer signup Storefront.CustomerCreateInput customer = new Storefront.CustomerCreateInput("test", "test") .setEmail("josh.brown@shopify.com") .setFirstName("Josh") .setLastName("Brown") .setPassword("verysecret") .setAcceptsMarketing(true); Storefront.MutationQuery query = Storefront.mutation(rootQuery -> rootQuery .customerCreate(customer, createCustomer -> createCustomer .customer(customerQuery -> customerQuery .firstName() .id() ) .userErrors(userErrorQuery -> userErrorQuery .field() .message() ) ) );
  • 29. graphClient.mutateGraph(query).enqueue(new GraphCall.Callback<Storefront.Mutation>() { @Override public void onResponse(@NonNull GraphResponse<Storefront.Mutation> response) { if (!response.data().getCustomerCreate().getUserErrors().isEmpty()) { for (Storefront.UserError error: response.data().getCustomerCreate().getUserErrors() ) { Log.v(TAG, error.getMessage()); } } Storefront.Customer customer = response.data().getCustomerCreate().getCustomer(); Log.v(TAG, customer.getId().toString()); } @Override public void onFailure(GraphError error) { // ... } });
  • 30. Checkout op+ons Web checkout ! Android Pay !
  • 32. Storefront.CheckoutCreateInput input = new Storefront.CheckoutCreateInput() .setLineItems(Arrays.asList( new Storefront.CheckoutLineItemInput(new ID("AjsFwRr=="), 5), new Storefront.CheckoutLineItemInput(new ID("JfEiTnD=="), 3) )); Storefront.MutationQuery query = Storefront.mutation(mutationQuery -> mutationQuery .checkoutCreate(input, createPayloadQuery -> createPayloadQuery .checkout(checkoutQuery -> checkoutQuery .webUrl() ) .userErrors(userErrorQuery -> userErrorQuery .field() .message() ) ) );
  • 33. graphClient.mutateGraph(query).enqueue(new GraphCall.Callback<Storefront.Mutation>() { @Override public void onResponse(@NonNull GraphResponse<Storefront.Mutation> response) { if (!response.data().getCheckoutCreate().getUserErrors().isEmpty()) { for (Storefront.UserError error : response.data().getCheckoutCreate().getUserErrors()) { Log.v(TAG, error.getMessage()); } } else { Storefront.Checkout checkout = response.data().getCheckoutCreate().getCheckout(); Log.v(TAG, checkout.getWebUrl()); } } @Override public void onFailure(@NonNull GraphError error) { } });
  • 35. PayCart - building the Android Pay cart PayCart payCart = PayCart.builder() .merchantName(MERCHANT_NAME) .currencyCode(shop.currency) .shippingAddressRequired(checkout.requiresShipping) .phoneNumberRequired(true) .shipsToCountries(Arrays.asList("US", "CA")) .addLineItem("Product1", 1, BigDecimal.valueOf(1.99)) .addLineItem("Product2", 10, BigDecimal.valueOf(3.99)) .subtotal(checkout.subtotalPrice) .totalPrice(checkout.totalPrice) .taxPrice(checkout.taxPrice) .build(); PayHelper - interac/ons with Android Pay API