English 中文(简体)
SDKModule.confredpayment, painmenter payment, paramenter paying intentClientseret 等离子安全
原标题:method com.reactnativestripesdk. Stripe SDKModule.confirmPayment, paramenter paymentIntentClientSecret

我不知道该怎么解决这个问题 谁来帮帮我!

< a href=>"https://i.static.net/BfUSIJzu.png" rel="没有跟随 nofollow norereferrer">这里的图像描述



router.post("/create-payment-intent", async (req, res) => {
  const { items, user_id } = req.body;
  const customer = await stripe.customers.create();
  const ephemeralKey = await stripe.ephemeralKeys.create(
    { customer: customer.id },
    { apiVersion:  2024-04-10  }
  );
  try {
    const paymentIntent = await stripe.paymentIntents.create({
      amount: 1099,
      currency:  usd ,
      confirm: true,
      payment_method:  pm_card_visa ,
      payment_method_types: [ card ],
    });

    const response = {
      paymentIntent: paymentIntent.client_secret,
      ephemeralKey: ephemeralKey.secret,
      customer: customer.id,
      publishableKey:  pk_test_51PA9vlRsfm3Ucs22ixDUZ8mt2Ki9E7WR4tSil67ONZD4dptsAwjVZ0J2IFNEEf0iHQhDNEaTT87f6mTD9dnY1lAW00TQcuO9MO 
    };

    return res.json(response);
  } catch (error) {
    console.error(error);
    return res.status(500).json({ error:  An error occurred while creating Payment Intent  });
  }
});

My coding very very bad, i don t know how to fix that.
I know my code is wrong somewhere in here or missing a lot of things. I can identify what error I am facing but I can t fix it because I am not good at coding and this is my graduation project. I hope someone will help me and code for me to be able to fix the error! Please!

[enter image description here][1]
[enter image description here][2]
[enter image description here][3]
i don t know what happened for my code, i can t fix that


  [1]: https://i.sstatic.net/AJlyFGp8.png
  [2]: https://i.sstatic.net/itUY8uDj.png
  [3]: https://i.sstatic.net/ok7OlRA4.png



[enter code here][1]


  [1]: https://i.sstatic.net/3GS7DiJl.png
The server reports that there is a secret_client but the application logs out like that
问题回答

The error indicates that you are passing a null parameter where a non null one is expected. Specifically, the paymentIntent.client_secret.

"https://docs.stripe.com/api/paid_intents/create" rel="notfollow noreferrer" > 当你创建您的付款对象时 ,你应该收到客户端_secret 作为回复的一部分。

{
  "id": "pi_3MtwBwLkdIwHu7ix28a3tqPa",
  "object": "payment_intent",
  "amount": 2000,
  "amount_capturable": 0,
  "amount_details": {
    "tip": {}
  },
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "automatic_payment_methods": {
    "enabled": true
  },
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "client_secret": "pi_3MtwBwLkdIwHu7ix28a3tqPa_secret_YrKJUKribcBjcG8HVhfZluoGH",  /// <----- HERE
  "confirmation_method": "automatic",
  "created": 1680800504,
  "currency": "usd",
  "customer": null,
  "description": null,
  "invoice": null,
  "last_payment_error": null,
  "latest_charge": null,
  "livemode": false,
  "metadata": {},
  "next_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "mandate_options": null,
      "network": null,
      "request_three_d_secure": "automatic"
    },
    "link": {
      "persistent_token": null
    }
  },
  "payment_method_types": [
    "card",
    "link"
  ],
  "processing": null,
  "receipt_email": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "status": "requires_payment_method",
  "transfer_data": null,
  "transfer_group": null
}

我将遵循文件概述的步骤,以确保你所做的一切是正确的,因为你似乎没有得到正确的回应或得到部分回应。





相关问题
HandleClick not being recognized as a prop

I m trying to get my menu to show when I click the sidebar, but I m getting an error "react-dom.development.js:86 Warning: React does not recognize the handleClick prop on a DOM " import { ...

Is there an equivalent to localStorage in React Native?

I d like to implement the equivalent to the javascript localStorage in my React Native app. But I m unsure how to set. To function how I want it to, I would like the localStorage to be stored every ...

Video Calling in Expo React Native Application

I am building a React Native Application using Expo and I want to integrate a 1:1 video calling functionality in the app. From what I have researched so far on the topic is that I can use SDKs of ...

热门标签