razorpay / razorpay/razorpay-node

Standard web checkout callbackURL is not triggered by RP after successful payment

Open
#430 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
243
Forks
129
PR merge metrics
No merged PRs in 30d

Description

After customer have completed their payment and is successful, RP should call the provided callback url but the callback url is not called therefore customers are redirected back to checkout page and have to restart the payment flow, but the payment was debited from their bank account and the payment status is stuck in Authorized.

There are about 10-20 orders out of 80 orders in authorized state therefore this is an intermittent occurrence. This issue was also reported in razorpay/flutrer and it's happening in Web, Android, iOS SDKs. This issue can't be reproduced within Test mode.

Some of the standard web checkout order ids stuck in authorized payment status.

  • order_PrgLr5U5U6xFQl
  • order_PrhCYm3roWkxLm
  • order_PrfbxbDBaTppVZ
  • order_PrfMSFklhqC142
Expected behavior

provided callback URL to be called after payment/bank otp is completed successfully by the user

Actual behavior

provided callback URL is not called after payment/bank otp is completed successfully by the user

Code snippets
export const getCallbackUrl = (params: CallBackUrlOptions) => {
  const postAuthorizePath = `${__PAYMENT_PROVIDERS_API_BASE_URL__}/v1/payment-providers/post-authorization`
  const searchParams = new URLSearchParams(params)
  const callbackUrl = `${postAuthorizePath}?${searchParams.toString()}`

  return callbackUrl
}

export const createRazorpayObject = ({
  apikey,
  orderId,
  totalPrice,
  transactionId,
  orderState,
  storeId,
  customerDetails,
  notes,
  ondismiss,
}) => {
  return {
    key: apikey,
    currency: 'INR',
    name: 'company',
    order_id: orderId,
    amount: `${rupeesToPaisa(totalPrice)}`,
    prefill: {
      name: customerDetails.name,
      email: customerDetails.email,
      contact: customerDetails.phone,
      method: customerDetails.razorPayMethod,
    },
    notes,
    modal: {ondismiss},
    theme: {
      color: '#da291c',
    },
    redirect: true,
    callback_url: getCallbackUrl({
      paymentType: 'razorpay',
      orderState,
      storeId,
      traceId,
      transactionId,
      originServer: window.location.origin,
    }),
  }
}
Node version

NA using standard web checkout

Library version

NA using standard web checkout

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the getCallbackUrl and createRazorpayObject entry points in the report, then trace the callback_url through the standard web checkout and /v1/payment-providers/post-authorization flow. Compare successful production payment redirects with the listed authorized orders, since the issue says the failure is intermittent and cannot be reproduced in Test mode. Done means the callback URL is reliably called after successful payment and orders do not remain Authorized.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.