public void Verify(String cardNumber, String cardExpMonth, String cardExpYear, String cardCVC)
        {
            global::Stripe.Android.Model.Card card = null;

            card = new global::Stripe.Android.Model.Card
                   (
                cardNumber,
                Java.Lang.Integer.GetInteger(cardExpMonth),
                Java.Lang.Integer.GetInteger(cardExpYear),
                cardCVC
                   );

            bool valid_card           = card.ValidateCard();
            bool valid_number         = card.ValidateNumber();
            bool validate_expiry_date = card.ValidateExpiryDate();
            bool valid_cvc            = card.ValidateCVC();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"Validity checks");
            sb.AppendLine($"Number       : {card.Number}");
            sb.AppendLine($"Brand        : {card.Brand}");
            sb.AppendLine($"MM/YYYY      : {card.ExpMonth}/{card.ExpYear}");
            sb.AppendLine($"CVC          : {card.CVC}");
            sb.AppendLine($"Number last 4: {card.Last4}");
            sb.AppendLine($"Number  valid: {valid_number}");
            sb.AppendLine($"Date    valid: {validate_expiry_date}");
            sb.AppendLine($"CVC     valid: {valid_cvc}");
            sb.AppendLine($"CARD    valid: {valid_card}");

            Toast.MakeText(this, sb.ToString(), ToastLength.Long).Show();

            return;
        }
Exemplo n.º 2
0
        void ButtonVerify_Click(object sender, EventArgs e)
        {
            global::Stripe.Android.Model.Card card = mCardInputWidget.Card;
            if (card == null)
            {
                // Do not continue token creation.
            }
            else
            {
                global::Stripe.Android.Stripe stripe = null;
                stripe = new global::Stripe.Android.Stripe(this, "pk_test_6pRNASCoBOKtIshFeQd4XMUh");
                stripe.CreateToken
                (
                    card,
                    new TokenCallbackImplementation(this)
                );
            }

            return;
        }