Пример #1
0
        public void create_customer_checkout()
        {
            var api = new CoinbaseApi(ApiKey, ApiSecretKey, useSandbox: true, proxy: proxy, useTimeApi: true);

            var purchaseId = Guid.NewGuid().ToString("n");

            var request = new CheckoutRequest
            {
                Amount   = 10.00m,
                Currency = "USD",
                Name     = "Test Order",
                Metadata =
                {
                    { "purchaseId", purchaseId }
                },
                NotificationsUrl = ""
            };

            request.Dump();

            var checkout = api.CreateCheckout(request);

            checkout.Dump();
            if (checkout.Errors?.Length == 0)
            {
                var redirectUrl = api.GetCheckoutUrl(checkout);
                //do redirect with redirectUrl
            }
            else
            {
                //Error making checkout page.
            }

            var checkoutUrl = api.GetCheckoutUrl(checkout);

            checkoutUrl.Should().StartWith("https://sandbox.coinbase.com/checkouts");
        }
Пример #2
0
        public void create_customer_checkout()
        {
            var api = new CoinbaseApi(ApiKey, ApiSecretKey, useSandbox: true, proxy: proxy, useTimeApi: true);

            var purchaseId = Guid.NewGuid().ToString("n");

            var request = new CheckoutRequest
                {
                    Amount = 10.00m,
                    Currency = "USD",
                    Name = "Test Order",
                    Metadata =
                        {
                            {"purchaseId", purchaseId}
                        },
                    NotificationsUrl = ""
                };

            request.Dump();

            var checkout = api.CreateCheckout(request);
            
            checkout.Dump();
            if( checkout.Errors.Length == 0 )
            {
                var redirectUrl = api.GetCheckoutUrl(checkout);
                //do redirect with redirectUrl
            }
            else
            {
                //Error making checkout page.
            }

            var checkoutUrl = api.GetCheckoutUrl(checkout);
            checkoutUrl.Should().StartWith("https://sandbox.coinbase.com/checkouts");
        }