/// <summary> /// Overriding the payment request for opening the Steam overlay. Nothing to do here, since PlayFab handles this. /// </summary> public override void OnPurchaseResult(PayForPurchaseResult result) { /* * Debug.LogError("Steam Purchase Status: " + result.Status + ", Currency: " + result.PurchaseCurrency + * ", Price: " + result.PurchasePrice + ", ProviderData: " + result.ProviderData + * ", PageURL: " + result.PurchaseConfirmationPageURL); */ }
private static void PayForPurchaseCallback(PayForPurchaseResult result) { foreach (var vcBalancePair in result.VirtualCurrency) { PfSharedModelEx.globalClientUser.userVC[vcBalancePair.Key] = vcBalancePair.Value; } var request = new ConfirmPurchaseRequest { OrderId = result.OrderId }; PlayFabClientAPI.ConfirmPurchase(request, ConfirmPurchaseCallback, null); }
/// <summary> /// Callback retrieved when the payment result is received from PlayFab's servers. /// The purchase still needs to be acknowledged in this method. /// </summary> public virtual void OnPurchaseResult(PayForPurchaseResult result) { /* * Debug.LogError("Status: " + result.Status + ", Currency: " + result.PurchaseCurrency + * ", Price: " + result.PurchasePrice + ", ProviderData: " + result.ProviderData + * ", PageURL: " + result.PurchaseConfirmationPageURL); */ ConfirmPurchaseRequest request = new ConfirmPurchaseRequest() { OrderId = orderId }; PlayFabClientAPI.ConfirmPurchase(request, OnPurchaseSucceeded, OnPurchaseFailed); }
public void PayForPurchase(Action <PayForPurchaseResult> onResult, Action <PlayFabError> onError) { if (!CanPayForPurchase()) { Debug.LogWarning("Tried paying for purchase when state was " + state); return; } PaymentOption paypalPaymentOption = null; for (int i = 0, len = startPurchaseResult.PaymentOptions.Count; i < len; ++i) { if (startPurchaseResult.PaymentOptions[i].ProviderName == PAYPAL_PROVIDER) { paypalPaymentOption = startPurchaseResult.PaymentOptions[i]; break; } } if (paypalPaymentOption == null) { state = PlayfabPurchaserState.MissingPaymentOptionError; return; } PlayFabClientAPI.PayForPurchase(new PayForPurchaseRequest() { OrderId = startPurchaseResult.OrderId, ProviderName = paypalPaymentOption.ProviderName, Currency = paypalPaymentOption.Currency }, result => { payForPurchaseResult = result; state = PlayfabPurchaserState.ConfirmPurchase; orderId = result.OrderId; Debug.Log("Pay for purchase success, order Id" + result.OrderId); onResult(result); }, error => { this.error = error; state = PlayfabPurchaserState.PayForPurchaseError; Debug.Log("Start purchase error\n" + error.GenerateErrorReport()); onError(error); }); }
private void onPurchaseResult(PayForPurchaseResult result) { debugPurchaseText.text = "onPayForPurchaseResult" + "\n\n" + result.PurchaseConfirmationPageURL; Application.OpenURL(result.PurchaseConfirmationPageURL); }
/// <summary> /// Overriding the payment request for opening the PayPal website in the browser. /// </summary> public override void OnPurchaseResult(PayForPurchaseResult result) { ShopManager.ShowConfirmation(); Application.OpenURL(result.PurchaseConfirmationPageURL); }