public void purchaseScreenActionButtonClick() { if (currentPurchaseStatus == PurchaseStatus.CHECKOUT_READY) { //Open Checkout page in browser string checkoutUrl = StoreProperties.INSTANCE.GetComponent <CreatePaymentAPI_Call>().API_SuccessResponse.links[1].href; if (Application.platform.Equals(RuntimePlatform.WebGLPlayer)) { openWindow(checkoutUrl); } else { Application.OpenURL(checkoutUrl); } PaymentListener newPaymentListener = StoreProperties.INSTANCE.gameObject.AddComponent <PaymentListener>(); CreatePaymentAPI_Call createPaymentAPI_Call = StoreProperties.INSTANCE.GetComponent <CreatePaymentAPI_Call>(); PayPalCreatePaymentJsonResponse createPaymentResponse = createPaymentAPI_Call.API_SuccessResponse; newPaymentListener.accessToken = createPaymentAPI_Call.accessToken; newPaymentListener.listeningInterval = 10f; newPaymentListener.payID = createPaymentResponse.id; InvokeRepeating("checkForPurchaseStatusChange", 1f, 1f); changePurchaseStatus(PurchaseStatus.WAITING); } else if (currentPurchaseStatus == PurchaseStatus.WAITING) { DialogScreenActions.INSTANCE.setContextConfirmAbortPayment(); DialogScreenActions.INSTANCE.ShowDialogScreen(); } }
private void handleSuccessResponse(string responseText) { //attempt to parse reponse text API_SuccessResponse = JsonUtility.FromJson <PayPalCreatePaymentJsonResponse>(responseText); }