public CreditCard CreateCreditCard()
 {
     CreditCard CrdtCard = null;
     CreditCard credCard = new CreditCard();
     credCard.number = TextBoxCreditCardNumber.Text.Trim();
     credCard.cvv2 = TextBoxCreditCardCVV2.Text.Trim();
     credCard.type = DropDownListCreditCardType.SelectedValue.ToString().Trim();
     credCard.expire_month = DropDownListCreditCardExpireMonth.SelectedValue.ToString().Trim();
     credCard.expire_year = DropDownListCreditCardExpireYear.SelectedValue.ToString().Trim();
     CrdtCard = credCard.Create(accessToken);
     return CrdtCard;
 }
 public CreditCard CreateCreditCard(string creditCardType, string creditCardNumber, string creditCardCVV2, string creditCardExpireMonth, string creditCardExpireYear)
 {
     CreditCard card = null;
     CreditCard credCard = new CreditCard();
     credCard.type = creditCardType;
     credCard.number = creditCardNumber;
     credCard.cvv2 = creditCardCVV2;
     credCard.expire_month = System.Convert.ToInt32(creditCardExpireMonth);
     credCard.expire_year = System.Convert.ToInt32(creditCardExpireYear);
     card = credCard.Create(Api);
     return card;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpContext CurrContext = HttpContext.Current;

            // ###CreditCard
            // A resource representing a credit card that can be
            // used to fund a payment.
            CreditCard credtCard = new CreditCard();
            credtCard.expire_month = "11";
            credtCard.expire_year = "2018";
            credtCard.number = "4417119669820331";
            credtCard.type = "visa";

            try
            {
                // ###AccessToken
                // Retrieve the access token from
                // OAuthTokenCredential by passing in
                // ClientID and ClientSecret
                // It is not mandatory to generate Access Token on a per call basis.
                // Typically the access token can be generated once and
                // reused within the expiry window
                string accessToken = new OAuthTokenCredential(ConfigManager.Instance.GetProperty("ClientID"), ConfigManager.Instance.GetProperty("ClientSecret")).GetAccessToken();

                // ### Api Context
                // Pass in a `ApiContext` object to authenticate
                // the call and to send a unique request id
                // (that ensures idempotency). The SDK generates
                // a request id if you do not pass one explicitly.
                APIContext apiContext = new APIContext(accessToken);
                // Use this variant if you want to pass in a request id
                // that is meaningful in your application, ideally
                // a order id.
                // String requestId = Long.toString(System.nanoTime();
                // APIContext apiContext = new APIContext(accessToken, requestId ));

                // ###Save
                // Creates the credit card as a resource
                // in the PayPal vault. The response contains
                // an 'id' that you can use to refer to it
                // in the future payments.
                CreditCard createdCreditCard = credtCard.Create(apiContext);
                CurrContext.Items.Add("ResponseJson", JObject.Parse(createdCreditCard.ConvertToJson()).ToString(Formatting.Indented));
            }
            catch (PayPal.Exception.PayPalException ex)
            {
                CurrContext.Items.Add("Error", ex.Message);
            }

            CurrContext.Items.Add("RequestJson", JObject.Parse(credtCard.ConvertToJson()).ToString(Formatting.Indented));

            Server.Transfer("~/Response.aspx");
        }
 private CreditCard CreateCreditCard()
 {
     CreditCard card = new CreditCard();
     card.cvv2 = "962";
     card.expire_month = 01;
     card.expire_year = 2015;
     card.first_name = "John";
     card.last_name = "Doe";
     card.number = "4825854086744369";
     card.type = "visa";
     card.payer_id = "008";
     return card.Create(UnitTestUtil.GetApiContext());
 }         
 private CreditCard CreateCreditCard()
 {
     CreditCard card = new CreditCard();
     card.cvv2 = "962";
     card.expire_month = 01;
     card.expire_year = 2015;
     card.first_name = "John";
     card.last_name = "Doe";
     card.number = "4825854086744369";
     card.type = "visa";
     card.state = "New York";
     card.payer_id = "008";
     card.id = "002";
     return card.Create(AccessToken);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpContext CurrContext = HttpContext.Current;

            // ###CreditCard
            // A resource representing a credit card that can be
            // used to fund a payment.
            CreditCard credtCard = new CreditCard();
            credtCard.expire_month = 11;
            credtCard.expire_year = 2018;
            credtCard.number = "4417119669820331";
            credtCard.type = "visa";

            try
            {
                 // ### Api Context
                 // Pass in a `APIContext` object to authenticate 
                 // the call and to send a unique request id 
                 // (that ensures idempotency). The SDK generates
                 // a request id if you do not pass one explicitly. 
                  // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext..
                APIContext apiContext = Configuration.GetAPIContext();

                // ###Save
                // Creates the credit card as a resource
                // in the PayPal vault. The response contains
                // an 'id' that you can use to refer to it
                // in the future payments.
                CreditCard createdCreditCard = credtCard.Create(apiContext);
                CurrContext.Items.Add("ResponseJson", JObject.Parse(createdCreditCard.ConvertToJson()).ToString(Formatting.Indented));
            }
            catch (PayPal.Exception.PayPalException ex)
            {
                CurrContext.Items.Add("Error", ex.Message);
            }

            if (credtCard != null)
            {
                CurrContext.Items.Add("RequestJson", JObject.Parse(credtCard.ConvertToJson()).ToString(Formatting.Indented));
            }

            Server.Transfer("~/Response.aspx");
        }
        public CreditCard CreateCreditCard()
        {
            CreditCard credCard = new CreditCard();
            credCard.cvv2 = "962";
            credCard.expire_month = "01";
            credCard.expire_year = "2015";
            credCard.first_name = "John";
            credCard.last_name = "Doe";
            credCard.number = "4825854086744369";
            credCard.type = "visa";
            credCard.state = "New York";
            credCard.payer_id = "008";
            credCard.id = "002";

            CreditCard CrdtCard = credCard.Create(AccessToken);
            return CrdtCard;
        }
 public CreditCard CreateCreditCard(ProfileModel model)
 {
     CreditCard card = null;
     CreditCard cardCredit = new CreditCard();
     cardCredit.number = model.NewCreditCardNumber.Trim();
     cardCredit.type = model.NewCreditCardType.Trim();
     cardCredit.cvv2 = model.NewCreditCardCVV2.Trim();
     cardCredit.expire_month = Convert.ToInt32(model.NewCreditCardExpireMonth.Trim());
     cardCredit.expire_year = Convert.ToInt32(model.NewCreditCardExpireYear.Trim());
     card = cardCredit.Create(Api);
     return card;
 }
        public static CreditCard SaveCreditCard(APIContext apiContext)
        {
            // ###CreditCard
            // A resource representing a credit card that can be
            // used to fund a payment.
            CreditCard credtCard = new CreditCard();
            credtCard.expire_month = 11;
            credtCard.expire_year = 2018;
            credtCard.number = "4417119669820331";
            credtCard.type = "visa";

            // ###Save
            // Creates the credit card as a resource
            // in the PayPal vault. The response contains
            // an 'id' that you can use to refer to it
            // in the future payments.
            CreditCard createdCreditCard = credtCard.Create(apiContext);
            return createdCreditCard;
        }