Shopify SDK for Unity
Public Member Functions | Properties | List of all members
Shopify.Unity.Cart Class Reference

Manages line items for an order. Can also be used to generate a web checkout link to check out in browser. More...

Public Member Functions

 Cart (ShopifyClient client)
 Constructs a new cart using a ShopifyClient . Typically, carts won't be instantiated directly, but will rather be instatiated using ShopifyBuy.Client().Cart() . More...
 
void Reset ()
 Resets the cart by removing all line items and resets all internal state. More...
 
decimal Subtotal ()
 Returns the current sub total for the cart More...
 
void GetWebCheckoutLink (GetWebCheckoutLinkSuccessCallback success, GetWebCheckoutLinkFailureCallback failure)
 Returns the web URL for checking out the contents of this Cart. For presenting the user with a web view that loads this URL see CheckoutWithWebView. More...
 
void CheckoutWithWebView (CheckoutSuccessCallback success, CheckoutCancelCallback cancelled, CheckoutFailureCallback failure)
 Launches a platform-specific web view screen with the Cart's web checkout link loaded. This can be used to perform a cart checkout from within your application instead of being directed to an external web application. Typically this can be used as a fallback measure in cases where the user's device doesn't support native pay methods. More...
 
void CheckoutWithNativePay (string key, CheckoutSuccessCallback success, CheckoutCancelCallback cancelled, CheckoutFailureCallback failure)
 Launches a platform-specific native pay UI for checking out the Cart's contents. Currently supported native pay options include: More...
 
void CanShowNativePaySetup (CanShowNativePaySetupCallback callback)
 Determine whether the user can be shown to setup their native payment solution More...
 
void ShowNativePaySetup ()
 Launch a native payment app to prompt the user to setup their payment card More...
 
void CanCheckoutWithNativePay (CanCheckoutWithNativePayCallback callback)
 Determine whether the user can checkout by paying with their native payment solution More...
 

Properties

CartLineItems LineItems [get]
 Current line items for this Cart . More...
 
List< CheckoutUserErrorUserErrors [get]
 A list of all the user errors with the current checkout. For example, when a user enters invalid information in a field during checkout, the API will return a list of user errors which gets stored here. In general, a failure callback is invoked and the developer can reference this field to handle these issues. More...
 
Checkout CurrentCheckout [get]
 

Detailed Description

Manages line items for an order. Can also be used to generate a web checkout link to check out in browser.

Constructor & Destructor Documentation

◆ Cart()

Shopify.Unity.Cart.Cart ( ShopifyClient  client)
inline

Constructs a new cart using a ShopifyClient . Typically, carts won't be instantiated directly, but will rather be instatiated using ShopifyBuy.Client().Cart() .

Parameters
clientclient associated with this cart
// Example that creates a cart using a ShopifyClient and checks how many line items it has
// (spoiler: it has 0 line items since the cart was just created).
ShopifyClient client = new ShopifyClient(accessToken, shopDomain);
Cart cart = new Cart(client);
Debug.Log(cart.LineItems.All().Count);
Cart(ShopifyClient client)
Constructs a new cart using a ShopifyClient . Typically, carts won't be instantiated directly,...
Definition: Cart.cs:117

Member Function Documentation

◆ CanCheckoutWithNativePay()

void Shopify.Unity.Cart.CanCheckoutWithNativePay ( CanCheckoutWithNativePayCallback  callback)
inline

Determine whether the user can checkout by paying with their native payment solution

Parameters
callbackClosure that is invoked with the result. True is returned if the user is able to pay with their native payment solution

◆ CanShowNativePaySetup()

void Shopify.Unity.Cart.CanShowNativePaySetup ( CanShowNativePaySetupCallback  callback)
inline

Determine whether the user can be shown to setup their native payment solution

Parameters
callbackClosure that is invoked with the result. True is returned if the user can be shown a native payment app to setup their payment card

◆ CheckoutWithNativePay()

void Shopify.Unity.Cart.CheckoutWithNativePay ( string  key,
CheckoutSuccessCallback  success,
CheckoutCancelCallback  cancelled,
CheckoutFailureCallback  failure 
)
inline

Launches a platform-specific native pay UI for checking out the Cart's contents. Currently supported native pay options include:

  • iOS: Launches Apple Pay.
Exceptions
System.PlatformNotSupportedExceptionThrown when invoking this method on an unsupported platform.
Parameters
keyVendor-specific key for identifying the merchant. For iOS devices this is the merchant ID.
successcalled whenever the checkout process has completed successfully.
cancelledcalled whenever the user cancels out of the native pay flow.
failurecalled whenever an error or failure is encountered during native pay.

◆ CheckoutWithWebView()

void Shopify.Unity.Cart.CheckoutWithWebView ( CheckoutSuccessCallback  success,
CheckoutCancelCallback  cancelled,
CheckoutFailureCallback  failure 
)
inline

Launches a platform-specific web view screen with the Cart's web checkout link loaded. This can be used to perform a cart checkout from within your application instead of being directed to an external web application. Typically this can be used as a fallback measure in cases where the user's device doesn't support native pay methods.

Parameters
successcalled when the web checkout screen has been dismissed and the checkout was successful.
cancelledcalled when the web checkout screen was dismissed before completing a checkout.
failurecalled when an error was encountered after the web checkout screen has been dismissed.

◆ GetWebCheckoutLink()

void Shopify.Unity.Cart.GetWebCheckoutLink ( GetWebCheckoutLinkSuccessCallback  success,
GetWebCheckoutLinkFailureCallback  failure 
)
inline

Returns the web URL for checking out the contents of this Cart. For presenting the user with a web view that loads this URL see CheckoutWithWebView.

Parameters
successcalled when the checkout url was successfully generated.
failurecalled when generating the checkout url failed.

◆ Reset()

void Shopify.Unity.Cart.Reset ( )
inline

Resets the cart by removing all line items and resets all internal state.

◆ ShowNativePaySetup()

void Shopify.Unity.Cart.ShowNativePaySetup ( )
inline

Launch a native payment app to prompt the user to setup their payment card

Exceptions
PlatformNotSupportedExceptionThrown when the device does not support this feature

◆ Subtotal()

decimal Shopify.Unity.Cart.Subtotal ( )
inline

Returns the current sub total for the cart

Property Documentation

◆ LineItems

CartLineItems Shopify.Unity.Cart.LineItems
get

Current line items for this Cart .

◆ UserErrors

List<CheckoutUserError> Shopify.Unity.Cart.UserErrors
get

A list of all the user errors with the current checkout. For example, when a user enters invalid information in a field during checkout, the API will return a list of user errors which gets stored here. In general, a failure callback is invoked and the developer can reference this field to handle these issues.

Returns
A list of user errors

for this Cart


The documentation for this class was generated from the following file: