Official Content

You can be notified when an event happens in your account. It is done using webhooks. 

To do so, you must create a new procedure in GeneXus: Main program, and HTTP call protocol.

Then you can get the data sent by Stripe using HTTPRequest variable and load it to a StripeEvent SDT. 

Once loaded, you can get the event type, and use a case command to process the notification. In this example, invoice payment success and failure are captured and processed.
You can add a String Response using HTTPResponse.

&NotificationsLog.DateTime = now()
&JSON = &HTTPRequest.ToString()

&parameters = &StripeEvent.type.SplitRegEx(!"\.")

do case
    case &parameters.Item(1) = "invoice"
        do case
            case &parameters.Item(2) = "payment_succeeded"
                &NotificationsLog.Data = "Success: " + &StripeInvoice.ToJson()    
            case &parameters.Item(2) = "payment_failed"
                &NotificationsLog.Data = "Failure: " + &StripeInvoice.ToJson()    

&Response = "OK"

Important Note: You need to deploy to Cloud so that Stripe is able to reach your URL. Else, an error code will be returned to Stripe and no notification will be processed. 

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant