razorpay / razorpay-node

Razorpay node.js bindings
MIT License
182 stars 111 forks source link

Property 'validatePaymentVerification' does not exist on type 'typeof Razorpay' #371

Closed charanjit-singh closed 10 months ago

charanjit-singh commented 1 year ago

Steps to reproduce the behavior

import Razorpay from "razorpay";

....

 const isSignatureValid = await Razorpay.validatePaymentVerification(
        {
            "order_id": razorpay_order_id,
            "payment_id": razorpay_payment_id,  
        },
        razorpay_signature,
        process.env.RAZORPAY_KEY_SECRET
    )

Expected behavior

It should work

Actual behavior

It's not working

Code snippets

No response

Node version

v18.17.0

Library version

2.9.1

Additional Information

No response

charanjit-singh commented 1 year ago

For now I'm using this workaround


    const signatureVerificationPayload = `${razorpay_order_id}|${razorpay_payment_id}`;
    const isSignatureValid = Razorpay.validateWebhookSignature(
        signatureVerificationPayload,
        razorpay_signature,
        process.env.RAZORPAY_KEY_SECRET as string
    )
kakdeykaushik commented 1 year ago

validatePaymentVerification comes from razorpay-utils use, import { validatePaymentVerification } from 'razorpay/dist/utils/razorpay-utils'; Refer to this doc

@1995navinkumar (I am tagging you since I found you approving recent PRs.) It looks like there is an import miss in this documentation NodeJS similar miss is in the code snippet of Go as well (missing utils import). I didn't find any repo related to documentation; if it is open source, please share it with me. I'd like to contribute.

ankitdas13 commented 10 months ago

The doc is already updated.

Closing this issue.