#javeed

1 messages · Page 1 of 1 (latest)

cobalt pollenBOT
prisma rain
#

Which fetch API are you referring to?

#

Customer Creation API should be made from your server

loud bluff
#

yes i use node js for creating API

#

call

#

here is the code -->

console.log(cFormBody);
let cPostToStripe = {
method: "POST",
headers: {
Authorization:
"Basic " + btoa(payment.secret),
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
redirect: "follow",
body: cFormBody,
};

const cusResponseStripe = await fetch(
  "https://api.stripe.com/v1/customers",
  cPostToStripe
);
console.log(cusResponseStripe);
const cusStripe = await cusResponseStripe.json();
console.log(cusStripe);
#

i am trying to pass the address field but i am keep getting error

#

@prisma rain ^

#

this is the error log

{
"description": "mukesh digital",
"address": "{"line1":"966 ff","line2":"966 ff","city":"chennai","state":"tamilnadu","country":"IN","postal_code":"undefined"}",
"email": "javi.rahman@gmail.com",
"name": "javeed"
}

prisma rain
#

We strongly recommend to use Stripe Node library for integration

loud bluff
#

okay due to weight ah the library we use direct api

stiff crown
#

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

loud bluff
#

Hi @stiff crown

#

can you please explain it

#

right after the the payment_intent api

we need to call customer creation api?

stiff crown
#

You are in what use case ? International payments for services or International payments for goods?

loud bluff
#

from my India INR account i am trying to collect payment of USD

stiff crown
#

Are you offering services or goods?

loud bluff
#

International payments for services

stiff crown
#

Create the customer:

curl https://api.stripe.com/v1/customers \
  -u sk_test_234: \
  -d name="Jenny Rosen" \
  -d "address[line1]"="510 Townsend St" \
  -d "address[postal_code]"=98140 \
  -d "address[city]"="San Francisco" \
  -d "address[state]"=CA \
  -d "address[country]"=US

Make sure to set their billing address.
Then create a PaymentIntent:

curl https://api.stripe.com/v1/payment_intents \
  -u sk_test_234: \
  -d amount=1099 \
  -d customer={CUSTOMER_ID} \
  -d currency=usd \
  -d description="Software development services"

Make sure to set the description.

loud bluff
#

okay i have not set billing address let me try

#

shipping address is the billing address ?

loud bluff
stiff crown
loud bluff
#

pi_3MeyMfSJivv63X8O1l1ZzROA

#

customer are getting created

#

{
'payment_method_types[0]': 'card',
amount: '100',
currency: 'USD',
description: 'mukesh digital',
customer: 'cus_NPnyfOOuAz6tFZ'
}

#

payload of payment_intent

little grotto
#

The PaymentIntent status is requires_action. This means you need to handle card authentication here - 3DSecure. It will be very hard to do without using Stripe.js.

loud bluff
#

we are using it card payement i have given otp as well as

little grotto
#

I am not sure what you mean by this.

loud bluff
#

i have done all the things which is in documents ,

#

let me try adding shipping address

little grotto
#

I am not sure what is the exact problem that you are facing and what is the situation your integration is in. If you share more details, I could provide a better help.

loud bluff
#

I am trying to collect USD payment from INR account (india)

#

as per @stiff crown suggestion i have added customer first and then called payment intent

#

Kindly check the above discussion

little grotto
#

I understand. As per the error message, you need a billing address in another country (not India) to collect USD payments.

loud bluff
#

in the customer API right?

#

const cDetails = {
address: {
line1: orderDetails.address,
line2: orderDetails.address,
city: orderDetails.city,
state: orderDetails.state,
country: "India",
postal_code: orderDetails.postal_code,
},
description: productValues.product_title,
email: orderDetails.email,
name: name,
shipping: {
address: {
line1: orderDetails.address,
line2: orderDetails.address,
city: orderDetails.city,
state: orderDetails.state,
country: "India",
postal_code: orderDetails.postal_code,
},
name:name,
},
};

const stripe = require('stripe')(payment.secret);

const customer = await stripe.customers.create(cDetails);
#

i have given everything as per the docs, shipping/billing address

little grotto
#

This won't work:

          country: "India",
loud bluff
#

IN ?

little grotto
#

As per the error message, you need a billing address in another country (not India) to collect USD payments.

loud bluff
#

Okay let us try

#

cus_NPosZXezNOaUKW

#

i have tried sing US address still no luck, but the customer was created properly

little grotto
#

What is the error you are seeing?

loud bluff
#

@little grotto same error

#

this is proper US address with postal code or zip

#

customer id ---> cus_NPpNAsKmNZscAZ

#

payment id ---> pi_3Mezj3SJivv63X8O1hdaD5VK

hoary edge
#

the error message is not about the address, it's about where the card is from.

loud bluff
#

great @hoary edge thanks for the accurate answer 😄