#RohitK

1 messages · Page 1 of 1 (latest)

gloomy valveBOT
haughty elbow
#

👋 happy to help

#

what kind of Charges are you using? Destination or Direct Charges?

woeful oar
#

destination charge

haughty elbow
#

in that case you need to initialize the stripe instance with your publishable key and pass in the stripeAccount property

woeful oar
#

var stripe = Stripe(
'pk_test_EcEoJOTFxxxxxxxxxxxxxxxxxx800DNtPFS'
);
// Redirects away from the client
stripe.confirmAffirmPayment(
response,
{
payment_method: {
// Billing information is optional but recommended to pass in.
billing_details: {
email: 'rohitkatarya7@gmail.com',
name: 'test admin',
address: {
line1: '2609 North Rome Avenue, Tampa, FL, USA',
city: 'Tampa',
state: 'FL',
country: 'US',
postal_code: '29715',
},
},
},

                // Shipping information is optional but recommended to pass in.
                shipping: {
                  name: 'test admin',
                  address: {
                    line1: '2609 North Rome Avenue, Tampa, FL, USA',
                    city: 'Tampa',
                    state: 'FL',
                    country: 'US',
                    postal_code: '29715',
                  },
                },
                // Return URL where the customer should be redirected after the authorization.
                return_url: '/checkout/success',
              }
            ).then(function(result) {
              if (result.error) {
                // Inform the customer that there was an error.
                console.log(result.error.message);
              }
            });
haughty elbow
#

var stripe = Stripe( 'pk_test_EcEoJOTFxxxxxxxxxxxxxxxxxx800DNtPFS', { stripeAccount: 'acct_xxx' // Connected Account } );

woeful oar
#

IT soesn't make the code insecure ?

haughty elbow
#

no

woeful oar
#

As we are showing the connected account id publically

haughty elbow
#

the account ID doesn't give you access to anything

#

it's just an ID

#

it's not a secret key or anything compromising your security

#

and it's the only way to deal with Destination Charges on the front end

woeful oar
#

still getting the same error

haughty elbow
woeful oar
#

error: {message: "Invalid API Key provided: pk_test_****************************tPFS",…}
message: "Invalid API Key provided: pk_test_****************************tPFS"
type: "invalid_request_error"

#

Do you mean payment intent client secret?

gloomy valveBOT
midnight plinth
#

Hi! I'm taking over my colleague. Please, give me a moment to catch up.

woeful oar
#

sure

midnight plinth
woeful oar
#

sure

#

req_rts2xc8IwtxPnX

midnight plinth
#

I see it's a successful request. Where do you see the error?

woeful oar
#

I am getting the payment intent id and secret client successfully but when request stripe.confirmAffirmPayment() is send then it returns invalid api keys error

#

and nothing is reflecting in the logs

midnight plinth
#

Are you using the public key of the Platform?

woeful oar
#

yes

midnight plinth
#

Could you please double check if it's correct? Sorry, I don't see any other reason for the error.

midnight plinth
#

Please, let me know if you have any other questions.

woeful oar
#

sure

#

is it helpful if I will share the payload of this api with you

midnight plinth
#

Yes

woeful oar
#

shipping[name]: test admin
shipping[address][line1]: 2609 North Rome Avenue, Tampa, FL, USA
shipping[address][city]: Tampa
shipping[address][state]: FL
shipping[address][country]: US
shipping[address][postal_code]: 29715
return_url: /checkout/success
payment_method_data[type]: affirm
payment_method_data[billing_details][email]: rohitkatarya7@gmail.com
payment_method_data[billing_details][name]: test admin
payment_method_data[billing_details][address][line1]: 2609 North Rome Avenue, Tampa, FL, USA
payment_method_data[billing_details][address][city]: Tampa
payment_method_data[billing_details][address][state]: FL
payment_method_data[billing_details][address][country]: US
payment_method_data[billing_details][address][postal_code]: 29715
payment_method_data[guid]: 91c5ef3d-7fc1-4167-8aaf-e1e6b51bfa4a15d5e8
payment_method_data[muid]: 030d2106-cb9a-43ff-a35b-4f9d30aa84048a5add
payment_method_data[sid]: f406540d-13ed-4613-8b9f-6b674668b284721272
payment_method_data[payment_user_agent]: stripe.js/89e87bca59; stripe-js-v3/89e87bca59; raw-stripe-js-api
payment_method_data[time_on_page]: 22668
expected_payment_method_type: affirm
key: pk_test_EcExxxxxxxxxxx5E0efnx800DNtPFS
_stripe_account: acct_1M2wNrRncNHbtVmb
client_secret: pi_3N4xxxxxxxxxxxxxeE0cZ3Njmj_secret_08bxxxxxxxxxxxjSmSglFuZGTAM

midnight plinth
#

For some reason I don't see the confirm request related to this PI. It might be that the error comes from the Stripe.js and not from our API.

#

Please delete the key

#

How are you sending this request?

woeful oar
#

var stripe = Stripe(
'pk_test_EcEoJOxxxxxxxefnx800DNtPFS',{
stripeAccount: 'acct_1M2wNrRncNHbtVmb' // Connected Account
}
);
// Redirects away from the client
stripe.confirmAffirmPayment(
response,
{
payment_method: {
// Billing information is optional but recommended to pass in.
billing_details: {
email: 'rohitkatarya7@gmail.com',
name: 'test admin',
address: {
line1: '2609 North Rome Avenue, Tampa, FL, USA',
city: 'Tampa',
state: 'FL',
country: 'US',
postal_code: '29715',
},
},
},

                // Shipping information is optional but recommended to pass in.
                shipping: {
                  name: 'test admin',
                  address: {
                    line1: '2609 North Rome Avenue, Tampa, FL, USA',
                    city: 'Tampa',
                    state: 'FL',
                    country: 'US',
                    postal_code: '29715',
                  },
                },
                // Return URL where the customer should be redirected after the authorization.
                return_url: '/checkout/success',
              }
            ).then(function(result) {
              if (result.error) {
                // Inform the customer that there was an error.
                console.log(result.error.message);
              }
            });
        }
#

using this code

midnight plinth
#

What's in the response variable?

stripe.confirmAffirmPayment(
                  response,
woeful oar
#

it will return the payment_intent_cient_secret

#

without stripeAccount header also it is not working

#

Giving same error

midnight plinth
#

I understand, but you still should not use it because it will make the issue harder to investigate.

#

Where do you take the publishable key from?

woeful oar
#

I have removed it now.

#

I am using the platform publishable key.

#

As my stripe connect without affirm is working fine.

#

I was integrating stripe affirm option in it now.

#

and facing the invalid API Key provided error. But simple stripe connect is working fine with the same key values

midnight plinth
#

Are you able to confirm other payment methods? Like card?

woeful oar
#

yes initially I was using the card payment only in stripe connect.

midnight plinth
gloomy valveBOT
woeful oar
#

ohh....
Thanks

#

Sorry as well.