#anurag_api

1 messages ¡ Page 1 of 1 (latest)

gleaming lilyBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1391701199677558846

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

silver sphinx
#

Code:

async function run() {
  try {
    const paymentIntent = await stripe.paymentIntents.create({
      amount: 1000, // $10.00
      currency: 'usd',
      capture_method: 'manual',
      confirmation_method: 'manual',
      payment_method_types: ['card'],
      payment_method_options: {
        card: {
          request_incremental_authorization: 'if_available',
        },
      },
    });

    console.log('PaymentIntent created:', paymentIntent.id);

    const confirmedIntent = await stripe.paymentIntents.confirm(paymentIntent.id, {
      payment_method_data: {
        type: 'card',
        card: {
          number: '4111111111111111',
          exp_month: 12,
          exp_year: 2026,
          cvc: '123',
        },
      },
    });

    console.log('PaymentIntent confirmed, status:', confirmedIntent.status);
  } catch (err) {
    console.error('Error:', err);
  }
}

run();
static knot
silver sphinx
#

My account_id is: acct_1QWxwpE9cSvqiivY. I raised a query with support@stripe.com and they said that they have enabled incremental authorization flow for this sandbox account. Can you please check if it's enabled or not?

static knot
#

Well, req_w1lrhXfgdHouYp was made on a different account

#

But yes, looks like it should be enabled on acct_1QWxwpE9cSvqiivY

#

Make sure you're using the correct keys

silver sphinx
#

Yes @static knot , you are right. I was using wrong keys. However on using the right keys I stumbled upon this error: Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using, see https://stripe.com/docs/testing. To enable testing raw card data APIs, see https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis

gleaming lilyBOT
static knot
#

Yep, you can't and shouldn't send raw card data to the API

past pier
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

silver sphinx
#

Hi @past pier , I was checking any work around for sending raw card details and I saw that we can send raw card details in paymentMethods.create call to create pm_id which can then be used as a token in payment confirm call. But when I am calling paymentMethods.create using an API key it's giving pm_id, on the other hand when I am trying to call this function using another API Key, it gives this error: message: 'Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using, see https://stripe.com/docs/testing. To enable testing raw card data APIs, see https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis.',

past pier
#

I think this was already asked by my colleague previously, there is no workaround for sending raw cards

#

unless you are PCI DSS compliant and your account is onboarded for such integration.

silver sphinx
#

Can you please tell me the best optimal way to send card details? @past pier

past pier
#

However, the optimal way of handling card details, it's by using Stripe Elements and Payment/SetupIntents (without handling raw card details by your self)

silver sphinx
#

I want to test Server to Server, not through Stripe Elements.

past pier
#

Then you need to follow the guide I shared above.