public GetProfileResponse GetProfile(GetProfileRequest getProfileRequest) { SetupIntent setupIntent = _adaptee.GetProfile(getProfileRequest.Token); return(new GetProfileResponse() { PaymentMethod = setupIntent.PaymentMethodId }); }
public CreateNewCardResponse CreateNewCard(CreateNewCardRequest createNewCardRequest) { SetupIntent setupIntent = _adaptee.CreateNewCard(createNewCardRequest.CustomerId, createNewCardRequest.UserId); return(new CreateNewCardResponse() { SetupIntentId = setupIntent.Id, ClientSecret = setupIntent.ClientSecret }); }
public async Task <string> CreateClientSecretAsync() { var options = new SetupIntentCreateOptions { PaymentMethodTypes = new List <string> { "card" } }; var service = new SetupIntentService(); SetupIntent intent = await service.CreateAsync(options); return(intent.ClientSecret); }
public static SetupIntentDao ToSetupIntentDao(this SetupIntent setupIntent) { if (setupIntent == null) { return(null); } return(new SetupIntentDao { Id = setupIntent.Id, CustomerId = setupIntent.CustomerId, ClientSecret = setupIntent.ClientSecret, }); }
public ActionResult AddCardToCustomer(SetupIntent intent) { User user = SessionManager.GetUserSession(); if (string.IsNullOrEmpty(user.StripeCustomerID)) { _stripeService.stripe_CreateCustomer(user); } else { _stripeService.AddCardToExistingCustomer(intent, user.StripeCustomerID); } return(View()); }
public bool AddCardToExistingCustomer(SetupIntent intent, string StripeCustomerID) { bool result = true; try { var options = new PaymentMethodAttachOptions { Customer = StripeCustomerID, }; var service = new PaymentMethodService(); var paymentMethod = service.Attach(intent.PaymentMethodId, options); } catch (Exception ex) { logger.Error(ex.ToString()); result = false; } return(result); }