Webhook

Webhooks enable real-time communication between your application and SmartpayGenie. When specific events occur, such as successful payments or payment failures, SmartpayGenie sends HTTP POST requests to your designated webhook URL.

Setting up a webhook

1.Create a Webhook Endpoint:

  • Set up a server-side endpoint to receive webhook notification
  • Ensure your endpoint can handle HTTP POST requests and parse JSON data.
  • 2. Configure Webhook URL:

  • Log in to your SmartpayGenie developer portal.
  • Navigate to your API keys settings.
  • Enter your webhook URL in the designated field.
  • Webhook events

    SmartpayGenie sends webhook notifications for the following events:

    Event
    Description
    payment.success
    Payment is successful.
    payment.failed
    Payment has failed.
    payment.expired
    Payment has expired.
    payment.refunded
    Payment has been refunded.

    Webhook payload

  • The webhook payload is a JSON object containing information about the event and the associated payment:
  • 
    
       			 "statusCode": "00",
      			  "status": "success",
       			 "message": "Account created successful",
       			 "voucherId": "5828097239"
    
    
        }

    Security consideration

    IP Whitelisting: Consider whitelisting the IP addresses of SmartpayGenie&pos;s servers to enhance security

    Webhook Verification: Implement a verification mechanism to ensure that incoming requests are from SmartpayGenie. You can use a secret token or HMAC signature.

    Error Handling: Handle errors gracefully and log them for debugging purposes.

    By effectively utilizing webhooks, you can automate workflows, update your application&pos;s state, and provide a seamless user experience.