Open Closed

Questions Regarding Recurring Stripe Payment & Retrieval #3726


User avatar
0
mateworkx@gmail.com created

I have some questions about the payment module. I'm a bit confused by what I've read on support Q&A thus far. I have several customers in Stripe already, is there a way to import them by chance? If not, is there a way to set up payment processing and obtain the status of that payment on a recurring basis? For instance, customer John Doe has a subscription due on the first of the month, when I consolidate within the application am I able to see if the payment went through, failed, or was not paid at all? Also, what is the "External Id?

  • ABP Framework version: v6.0.0-rc.4
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: No exception
  • Steps to reproduce the issue:"

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

    Hi mateworkx

    Subscription logic doesn't support importing in the current version.

    All the flow should start like following document: https://docs.abp.io/en/commercial/latest/modules/payment#subscriptions

    If you enabled webhooks, all the updates will affect to the application and subscription status.

    If you created a tenant-edition subscription, edition of tenant will be automatically updated according to the subscription state. When subscription is canceled, it'll be canceled at the end of the period, or if you change the subscription period in the stripe dashboard, it'll be updated in the application too. https://docs.abp.io/en/commercial/latest/modules/saas#tenant-edition-subscription

    Also, what is the "External Id?

    ExternalId is PriceId or ProductId according your pricing policy in stripe.

    https://docs.abp.io/en/commercial/latest/modules/payment#Configuring-Plans

  • User Avatar
    0
    mateworkx@gmail.com created

    Thank you for your response. I apologize for needing a bit more information. I’m understanding that Id put the webhook key in appsettings.json. So thank you.

    As far as plans go. Let’s say I have a plan named “ATT Blue”, I’d create that plan in Stripe, obtain the product or price Id and add that into Abp payment module gateway.

    How would I assign a customer to that plan? Also, since we hold are enabled for that plan, any changes would show back in Abp correct?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    If you mean a Tenant while saying customer, you can use the following steps.

    I assumed you already created Plan and Gateway Plan but I'll include them in the first steps.

    • Create a plan. (in this case I use name 'Plan for ATT Blue')

    • Click actions menu and go to Manage Gateway Plans and add a gateway plan for your product from stripe.

    • Go to Saas > Editions from the menu and create or edit an edition. You'll see a dropdown for Plan. Choose the newly created 'Plan for ATT Blue'.

      • If the dropdown isn't visible. Make sure you made Saas-Payment Configuration properly.
        Configure<AbpSaasPaymentOptions>(options =>
        {
            options.IsPaymentSupported = true;
        });
        

    After completing these steps, you're ready to prepare a payment for a tenant.

    • Create a page and put a form with submit button. When a user submitted, you need to start a subscription with the following method:

      public class IndexModel : PageModel
      {
              protected ISubscriptionAppService SubscriptionAppService { get; }
      
              protected ICurrentTenant CurrentTenant { get; }
      
              public IndexModel(
                  ISubscriptionAppService subscriptionAppService,
                  ICurrentTenant currentTenant)
              {
                  SubscriptionAppService = subscriptionAppService;
                  CurrentTenant = currentTenant;
              }
      
              public async Task<IActionResult> OnPostAsync(Guid editionId)
              {
                  var paymentRequest = await SubscriptionAppService.CreateSubscriptionAsync(editionId, CurrentTenant.GetId());
      
                  return LocalRedirectPreserveMethod("/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id);
              }
          }
      

    Or you can use a static editionId instead of posting that parameter from a form.

  • User Avatar
    0
    mateworkx@gmail.com created

    Thank you. That information is very helpful. However, what I'm attempting to do here, and maybe this is my fault for not explaining correctly. My customer is wanting to have a custom CRM application that integrates with Stripe. The idea is that they would create a new customer from within the application, process payment if needed, and see regular updates on the status of each subscription. So, something like the following:

    1. Customer is created.
    2. Customer is assigned a subscription.
    3. Administrator would like to see the status of this subscription (Active, Canceled, etc.).
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Thank you. That information is very helpful. However, what I'm attempting to do here, and maybe this is my fault for not explaining correctly. My customer is wanting to have a custom CRM application that integrates with Stripe. The idea is that they would create a new customer from within the application, process payment if needed, and see regular updates on the status of each subscription. So, something like the following:

    1. Customer is created.
    2. Customer is assigned a subscription.
    3. Administrator would like to see the status of this subscription (Active, Canceled, etc.).

    If you want to use ABP Commercial Edition Subscription logic, customers have to be Tenants instead of custom entities. You should implement your own logic for your custom entities if it's not Tenant entity.

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