#Luis GOIÁS luismendes070
1 messages · Page 1 of 1 (latest)
Hi, can you add more details here? Are you using a specific resource that you can share with me?
using Stripe;
public class StripeCredCardTest{
[Fact]
public void Test(){
// a
CreditCardHelper creditCardHelper = new CreditCardHelper();
// a
creditCardHelper.isValid = creditCardHelper.ExampleFunction(
new PaymentIntentCreateOptions().PaymentMethodData('4111111111111111');
);
// a
Assert.True(creditCardHelper.isValid);
}
}
using Stripe;
using System;
namespace CreditCardHelperNamespace
{
public static class CreditCardHelper
{
public bool isValid { get; set; }
public CreditCardHelper()
{
StripeConfiguration.ApiKey = Environment.GetEnvironmentVariable("SECRET_KEY");
// isValid = ExampleFunction('4111111111111111');
} // end constructor
// using Stripe;
static void ExampleFunction(PaymentIntentCreateOptions options)
{
try
{
var service = new PaymentIntentService();
service.Create(options);
Console.WriteLine("No error.");
}
catch (StripeException e)
{
switch (e.StripeError.Type)
{
case "card_error":
Console.WriteLine($"A payment error occurred: {error.Message}");
break;
case "invalid_request_error":
Console.WriteLine("An invalid request occurred.");
break;
default:
Console.WriteLine("Another problem occurred, maybe unrelated to Stripe.");
break;
}
}
} // end function Stripe ExampleFunction
} // end class
} // end namespace
Thank you, I'm getting help from someone who has more experience with dotnet. Thank you for your patience
Hello! I'm taking over and catching up...
Hello!
I'm not sure I understand what you need. What's blocking you?
\AspNetCore.Docs.Samples\mvc\action-return-types\7.x\WebApiSample\Test\StripeCredCardTest.cs(8,69): error CS1012
Which one of the lines above is line 8?
Oh, wait, you're using single quotes. Try using double quotes.
the test
Like here for example: PaymentIntentCreateOptions().PaymentMethodData('4111111111111111'); Use "4111111111111111" instead. You may need to adjust that in several places.
Thank You
Does that resolve the error?
CS1026 is a syntax error that indicates you're likely missing a ) somewhere.
CS1513 is also a syntax error about a missing }.
It's the Test class namespace.