#javeed
1 messages · Page 1 of 1 (latest)
Which fetch API are you referring to?
Customer Creation API should be made from your server
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"
}
{
"error": {
"message": "Invalid object",
"param": "address",
"request_log_url": "https://dashboard.stripe.com/logs/req_nrJx9C2o4P2VCz?t=1677226717",
"type": "invalid_request_error"
}
}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Why don't you use Stripe Node library to create a customer? https://github.com/stripe/stripe-node
You can follow the API guide to for Node library: https://stripe.com/docs/api/customers/create?lang=node
We strongly recommend to use Stripe Node library for integration
okay due to weight ah the library we use direct api
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
Hi @stiff crown
can you please explain it
right after the the payment_intent api
we need to call customer creation api?
You are in what use case ? International payments for services or International payments for goods?
from my India INR account i am trying to collect payment of USD
Are you offering services or goods?
International payments for services
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.
okay i have not set billing address let me try
shipping address is the billing address ?
No billing address is: https://stripe.com/docs/api/customers/create#create_customer-address
and shipping address is: https://stripe.com/docs/api/customers/create#create_customer-shipping-address
Non-INR transactions in India should have shipping/billing address outside India. More info here: https://stripe.com/docs/india-exports
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
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
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.
we are using it card payement i have given otp as well as
I am not sure what you mean by this.
i have done all the things which is in documents ,
let me try adding shipping address
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.
I am trying to collect USD payment from INR account (india)
i am getting following error when i make the payment
Non-INR transactions in India should have shipping/billing address outside India. More info here: https://stripe.com/docs/india-exports
as per @stiff crown suggestion i have added customer first and then called payment intent
Kindly check the above discussion
I understand. As per the error message, you need a billing address in another country (not India) to collect USD payments.
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
This won't work:
country: "India",
IN ?
As per the error message, you need a billing address in another country (not India) to collect USD payments.
Okay let us try
cus_NPosZXezNOaUKW
i have tried sing US address still no luck, but the customer was created properly
What is the error you are seeing?
@little grotto same error
this is proper US address with postal code or zip
customer id ---> cus_NPpNAsKmNZscAZ
payment id ---> pi_3Mezj3SJivv63X8O1hdaD5VK
the error message is not about the address, it's about where the card is from.
you need to use a test card not from India, as the error implies. https://stripe.com/docs/testing#international-cards has a list of cards
great @hoary edge thanks for the accurate answer 😄