Starts in:
2 DAYS
4 HRS
42 MIN
56 SEC
Starts in:
2 D
4 H
42 M
56 S
Open Closed

Question regarding payments module reusage for tenant business scope transactions #4149


User avatar
0
kirotech created

Hello,

Our tenant will have some functionality where he needs payments to be done.

For example tenant will have customers paying invoices in the tenant system.

You suggest to reuse your pro payments module or is it not designed to use for tenants functionality payments?

Because now i see that payments module is pretty much only for host SaaS module and plans payments?


19 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi kirotech

    You can implement custom logic by using the Payment Module. You can create one time payments or create recurring payments. Payment module is just an abstraction over multiple payment providers.

    Saas Module has an implementation for tenant-edition registration, that's all. Payment module is only an abstraction and you can crate custom payment links by using it.

  • User Avatar
    0
    kirotech created

    Ok so invoice payment should create payment requests? How it supposed to work for tenants?

    Where is integration point here?

  • User Avatar
    0
    kirotech created

    ?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Ok so invoice payment should create payment requests? How it supposed to work for tenants?

    Where is integration point here?

    There is no invoice implementation in Payment Module. It provides only payment interface in your application. You can create a payment request and redirect users to the payment page and track that payment status with that PaymentRequest entity that you created at the beginning. If you want to create tenant-based custom payments & invoices, you should implement your own logic by using Payment Module or without payment module

  • User Avatar
    0
    kirotech created

    I'm not asking for invoices or anything what's related to this functionality I'm working on it, I'm asking where is integration point for your payments abstraction?

    All integration should go through payment request?

    For example in tenant i have invoice screen they click pay and we have to create payment request and have reference to it?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Oh sorry, I misunderstood the question.

    All integration should go through payment request?

    Yes, all the integration is on PaymentReques. After creating a payment request, you should redirect to a gateway selection page and users can pick one of configured payment ways and continue payment. Mostly payment completion is done synchronized with callback from payment provider.

    • You can see the available implemented providers packages from here

    • You can even add your own custom provider to show gateway selection page

    Configure<PaymentOptions>(options =>
    {
    	options.Gateways.Add(
    		new PaymentGatewayConfiguration(
    			"MyPaymentGatewayName",
    			new FixedLocalizableString("MyPaymentGatewayName"),
    			typeof(MyPaymentGateway)
    		)
    	);
    });
    
    • Gateway selection page is on /Payment/GatewaySelection route and you can redirect to that route with paymentRequestId querystring parameter after creating a payment request. On that page, if you configured more than one provider, users will see a payment gateway selection page otherwise, they'll be redirected to the payment page (paypal, stripe etc...)
    public virtual async Task<IActionResult> OnPost()
        {
            var paymentRequest = await _paymentRequestAppService.CreateAsync(new PaymentRequestCreateDto()
            {
                Currency= "USD",
                Products = new List<PaymentRequestProductCreateDto>()
                {
                    new PaymentRequestProductCreateDto
                    {
                        Code = "Product_01",
                        Name = "LEGO Super Mario",
                        Count = 2,
                        UnitPrice = 60,
                        TotalPrice = 200
                    }
                }
            });
            
            return LocalRedirectPreserveMethod("/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id);
        }
    
  • User Avatar
    0
    kirotech created

    We work on angular solution not mvc. What about per tenant payment gateway settings? Each tenant will have their own payment gateway settings? Do you have a sample for that how to change host payment settings for each individual tenant when they do payments?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    We work on angular solution not mvc. What about per tenant payment gateway settings? Each tenant will have their own payment gateway settings? Do you have a sample for that how to change host payment settings for each individual tenant when they do payments?

    Ok, You mean that tenants will receive payments instead of system owner receives payment from tenants. In that case, unfortunetely Payment module doesn't have tenant based configuration, you can configure it per application at the moment.

  • User Avatar
    0
    kirotech created

    Maybe i can override those settings per tenant and create my own interface no?

  • User Avatar
    0
    kirotech created

    ?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    You can provide different values per tenant while resolving service according to your requirement.

    You can use the following way to use your services for making the configuration depending on tenants

    https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-7.0#use-di-services-to-configure-options

  • User Avatar
    0
    kirotech created

    Can you provide abp related sample? How it supposed to work with abp commercial payments?

  • User Avatar
    0
    kirotech created

    ?

  • User Avatar
    0
    kirotech created

    ?

  • User Avatar
    0
    kirotech created

    ?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Can you provide abp related sample? How it supposed to work with abp commercial payments?

    Hello again,

    A complete example might have some conjecture but you can try the following configuration in your Domain layer:

    context.Services.AddOptions<StripeOptions>()
    .Configure<ICurrentTenant>(
        (options, currentTenant) =>
        {
            if (currentTenant.Name == "Tenant A")
            {
                options.SecretKey = "SECRET_KEY_FOR_TENANT_A";
                options.PublishableKey = "PUBLISHABLE_KEY_FOR_TENANT_A";
            }
            else if (currentTenant.Name == "Tenant B")
            {
                options.SecretKey = "SECRET_KEY_FOR_TENANT_B";
                options.PublishableKey = "PUBLISHABLE_KEY_FOR_TENANT_B";
    
            }
            else
            {
                options.SecretKey = "SECRET_KEY_FOR_REST_OF";
                options.PublishableKey = "PUBLISHABLE_KEY_FOR_REST_OF";
            }
        });
    
    
  • User Avatar
    0
    kirotech created

    This way you will not know which account to look at?

    You will see payment request was done, but you check your stripe account and there are no funds. How do i know which payment gateway this payment was used to make? Where is this data stored?

  • User Avatar
    0
    kirotech created

    ?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    This way you will not know which account to look at?

    You will see payment request was done, but you check your stripe account and there are no funds. How do i know which payment gateway this payment was used to make? Where is this data stored?

    This is a custom logic. ABP Payment Module doesn't provide a tenant-based payment option as I said before. Since this is a custom approach, you have to keep that data by your own

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06