Skip to content

IOS: Payment cancelled while doing payment from UPI #1570

@helians11

Description

@helians11

Describe the bug
On IOS, while making a payment through UPI in India, the purchase is getting cancelled in background when i go to the payment app for accepting the payment.
Error Code is PURCHASE_CANCELLED in the above case as soon as i go to payment app, Payment is successful but error code is incorrect in this case.

  1. Environment
    1. Platform: IOS
    2. SDK version: 9.6.15
    3. OS version:
    4. Xcode/Android Studio version:
    5. React Native version: 0.73.11
    6. SDK installation (CocoaPods + version or manual):
    7. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue
  3. Steps to reproduce, with a description of expected vs. actual behavior
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context
Here is the code snippet

const purchasePackage = async (
  parentAuthId: string,
  parentServiceId: string,
  pkg: PurchasesPackage,
) => {
  return withInAppPurchase(parentAuthId, parentServiceId, async () => {
    try {
      const result = await Purchases.purchasePackage(pkg);

      return result;
    } catch (error) {
      logError(InAppPurchaseAnalyticsEvents.PURCHASE_PACKAGE_FAILED, {
        error,
        parentAuthId,
        parentServiceId,
      });
      throw error;
    }
  });
};


const purchase = useCallback(
    (pkg: PurchasesPackage) => {
      return purchasePackage(parentAuthId, parentServiceId, pkg);
    },
    [parentAuthId, parentServiceId],
  );


const handlePurchase = useCallback(async () => {
    if (!selectedPlan) {
      return;
    }

    setStatus('inprogress');
    trackEvent(getAnalyticsEvent('purchase', 'inprogress'), { plan_type: planType });

    try {
      await purchase(selectedPlan);

      validateCustomerInfo();
    } catch {
      setStatus('failed');
    }
  }, [selectedPlan, planType, purchase, validateCustomerInfo]);

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions