I used stripe.net before to charge a credit card in a simple app I made. It was working okay, but I recently updated Stripe via NuGet. I then was warned to update my .net framework from 4.0 to 4.5.
When I did that I cannot seem to adapt new code to run a charge.
I am reading the API documentation here: https://stripe.com/docs/api/dotnet#create_charge
It says in order to charge a card, I have to have a 'source' for charge.Source in my code. I can attach the information I need to charge a card using a Dictionary, as it says. I've never done a 'Dictionary' before, but I think I am getting somewhere. My first issue is:
If my Dictionary is correct, how do I attach it to the source?
charge.Source = dict is just not correct. I just don't know what I need to do there.Code:Dim charge = New StripeCharge Dim dict = New Dictionary(Of String, String) dict.Add("exp_month", lblExpiresMonth.Text) dict.Add("exp_year", lblExpiresYear.Text) dict.Add("number", lblCardNumber.Text) dict.Add("object", "card") dict.Add("cvc", lblCVC.Text) charge.Source = dict charge.Amount = lblPrice.Text * 100 'put into cents for Stripe charge.Currency = "usd" charge.Description = "test run" Dim chargeService = New StripeChargeService chargeService.Create(charge)
Also chargeService.Create(charge) is not correct. The charge shows this error message on hover: value of type Stripe.StripeCharge cannot be converted to Stripe.StripeChargeCreateOptions
Thank you.




Reply With Quote
