ZarinPal Trigger

Handle ZarinPal payment callbacks

Overview

This node acts as a webhook trigger for ZarinPal payment callbacks. It listens for payment events sent by the ZarinPal payment gateway and triggers workflows based on the payment status. The node can handle successful payments, failed payments, or all callback events.

Typical use cases include:

  • Automating order fulfillment after a successful payment.
  • Sending notifications or alerts when a payment fails.
  • Logging payment attempts for auditing purposes.

For example, an e-commerce site can use this node to automatically update order status once a payment is confirmed by ZarinPal, or redirect users to custom success/failure pages after payment completion.

Properties

Name Meaning
Events Select which payment events to listen for: "Payment Success", "Payment Failed", or "All Events".
Return HTML Page Boolean option to decide whether to return a built-in HTML page to the user after payment.
Success Page URL URL to redirect the user to upon successful payment (used only if "Return HTML Page" is false).
Failed Page URL URL to redirect the user to upon failed payment (used only if "Return HTML Page" is false).

Output

The node outputs JSON data containing details about the payment callback event:

  • authority: The unique payment authority code from ZarinPal.
  • status: The raw status string received from the callback query parameters.
  • isSuccess: Boolean indicating if the payment was successful (true if status is "OK").
  • eventType: Either "paymentSuccess" or "paymentFailed" depending on the payment result.
  • receivedAt: ISO timestamp of when the callback was processed.
  • queryParameters: The full set of query parameters received in the webhook request.

If configured to return HTML, the node responds with a styled Persian-language success or failure page. Otherwise, it redirects the user to the specified success or failure URLs or simply returns the JSON data.

No binary data output is produced by this node.

Dependencies

  • Requires a publicly accessible webhook endpoint to receive ZarinPal payment callbacks.
  • No external API keys or credentials are needed within this node itself.
  • The node depends on n8n's webhook infrastructure to function properly.

Troubleshooting

  • No workflow trigger: Ensure that the webhook URL is correctly registered with ZarinPal and that the payment gateway is sending callbacks to the correct path.
  • Event filtering: If no workflow runs occur, verify that the selected "Events" property includes the event type being sent by ZarinPal.
  • Redirects not working: When "Return HTML Page" is disabled, ensure valid URLs are provided for success and failure redirects.
  • Unexpected status values: The node expects the Status query parameter to be "OK" (case-insensitive) for success; other values are treated as failure.

Links and References

Discussion