Implementing a custom payment provider
What you will need
The Background Service
// Gets the definition type from the database
var definitionType = await dbContext.Set<DefinitionTypeEntity>()
.FirstOrDefaultAsync(x => x.Name == "PaymentMethod Definitions", token);// Creates a list of definition field names and data types matching the
// payment provider's needs
var fields = new List<KeyValuePair<string, string>>
{
new("PublicKey", "ShortText"),
new("SecretKey", "ShortText"),
new("SuccessUrl", "ShortText"),
new("CancelUrl", "ShortText"),
new("WebhookSecret", "ShortText")
}.ToImmutableDictionary();
var definitionFields = new List<DefinitionFieldEntity>();
fields.ForEach(field => definitionFields.Add(new DefinitionFieldEntity
{
BuiltIn = false,
DataType = field.Value,
Definition = definition,
Multilingual = false,
Name = field.Key,
DisplayOnSite = true,
RenderInEditor = true
}));
The Request Model
The Payment Provider
The Middleware
Registration
Last updated