diff --git a/package.json b/package.json index 338ab17..94c7fd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "medusa-payment-razorpay", - "version": "7.2.0", + "version": "7.2.1-next-2", "description": "Razorpay Payment provider for Medusa Commerce", "main": "dist/index.js", "repository": { diff --git a/src/core/razorpay-base.ts b/src/core/razorpay-base.ts index cd49f55..30cc4f4 100644 --- a/src/core/razorpay-base.ts +++ b/src/core/razorpay-base.ts @@ -688,14 +688,18 @@ abstract class RazorpayBase extends AbstractPaymentProcessor { try { const id = paymentSessionData.id as string; - const sessionOrderData = (await this.razorpay_.orders.fetch( - id - )) as Partial; - delete sessionOrderData.id; - delete sessionOrderData.created_at; - + let sessionOrderData: Partial = { + currency: "INR", + }; + if (id) { + sessionOrderData = (await this.razorpay_.orders.fetch( + id + )) as Partial; + delete sessionOrderData.id; + delete sessionOrderData.created_at; + } context.currency_code = - currency_code?.toUpperCase() ?? sessionOrderData.currency!; + currency_code?.toUpperCase() ?? sessionOrderData?.currency ?? "INR"; const newPaymentSessionOrder = (await this.initiatePayment( context )) as PaymentProcessorSessionResponse;