コード例 #1
0
        protected override async void OnAppLinkRequestReceived(Uri uri)
        {
            try
            {
                if (uri.Host == "ordercomplete" && uri.Segments[1] != null)
                {
                    var order = uri.Segments[1];
                    try
                    {
                        var transactionId = await GumPayApp2AppHelper.CheckOrderComplete(App.shopKey, order, new CancellationToken());

                        if (transactionId != Guid.Empty)
                        {
                            MessagingCenter.Send(Application.Current, "logmessage", "Order " + order + " paid successfully with GumPay TransactionId " + transactionId);
                        }
                        else
                        {
                            MessagingCenter.Send(Application.Current, "logmessage", "Order " + order + " not paid");
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: gumworks/gumpay
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var order = Guid.NewGuid().ToString().Replace("-", "");

            MessagingCenter.Send(this, "logmessage", "Requesting GumPay link for order " + order);

            var urlLink = await GumPayApp2AppHelper.GetOrderLink(App.shopKey, order, 1, "gumpay2app://ordercomplete/" + order, 60, new System.Threading.CancellationToken());

            MessagingCenter.Send(Application.Current, "logmessage", "Opening external url " + urlLink);
            await Launcher.OpenAsync(urlLink);
        }