PhonePe icon

PhonePe

Consume PhonePe Payment API

Overview

This node integrates with the PhonePe Payment API to perform payment-related operations such as creating payment links, checking payment status, initiating refunds, and verifying webhook callbacks. It is useful for businesses that want to automate payment processing and status tracking through PhonePe, including generating payment links for customers, monitoring transaction statuses, handling refunds, and ensuring webhook authenticity.

Use Case Examples

  1. Create a payment link for a customer to complete a transaction of a specified amount in INR, with redirect and callback URLs.
  2. Check the status of a payment using the merchant transaction ID.
  3. Initiate a refund for a completed payment by specifying the original transaction ID and refund amount.
  4. Verify the authenticity of a webhook callback from PhonePe by validating the signature.

Properties

Name Meaning
Merchant Transaction ID Unique alphanumeric ID (max 35 characters) for the transaction, required for creating payment links and checking status.
Amount (INR) Amount to charge in Indian Rupees, required for creating payment links. Must be greater than 0.
Redirect URL URL to redirect the customer after payment completion, used when creating payment links.
Callback URL URL to receive payment status callbacks from PhonePe, used when creating payment links.
Test Mode (Sandbox) Boolean flag to use PhonePe's sandbox environment for testing instead of the production environment.

Output

JSON

  • json
    • isValid - Boolean indicating if the webhook signature is valid (only for webhook verification operation).
    • status - Verification status string, either 'VERIFIED' or 'INVALID' for webhook verification.
    • message - Descriptive message about webhook signature validity.
    • webhookData - Parsed webhook payload data if verification is successful, or error information if decoding fails.

Dependencies

  • PhonePe API credentials including merchant ID, salt key, and salt index for generating request signatures.

Troubleshooting

  • Ensure the Merchant Transaction ID is alphanumeric and does not exceed 35 characters to avoid validation errors.
  • Amount must be greater than zero when creating payment links or refunds; otherwise, the node throws an error.
  • Verify that the correct environment (sandbox or production) is selected to avoid connection issues.
  • Webhook verification may fail if the X-VERIFY header or payload is incorrect or tampered with; ensure the webhook payload is base64-encoded and headers are correctly passed.
  • Common error messages include invalid transaction ID format, amount less than or equal to zero, and signature verification failures. Resolving these involves correcting input values and ensuring proper API credentials.

Links

Discussion