#thenakidninja_api

1 messages ยท Page 1 of 1 (latest)

cedar wyvernBOT
#

๐Ÿ‘‹ 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/1281206069602812041

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

slim current
pseudo shard
#

await stripe.confirmPayment({ elements, clientSecret, payment_method_data: { billing_details: { name : ${shippingDetails.first_name} ${shippingDetails.last_name}, email : customerDetails.email, phone : shippingDetails.phone, address: { city : shippingDetails.city, country : shippingDetails.country_code, line1 : shippingDetails.address_1, line2 : shippingDetails.address_2, postal_code : shippingDetails.postal_code, }, } }, confirmParams: { receipt_email: customerDetails.email }, // Uncomment below if you only want redirect for redirect-based payments redirect: "if_required" }).then(({error,paymentIntent})=>{ if(error){ console.log(error) } if(paymentIntent){ console.log(paymentIntent) } }); }

#

I think I can see where I am going wrong, I think payment_method_data has a required 'type' field?

slim current
#

your code is fine

#

it just doesn't pass the address to shipping

#
await stripe.confirmPayment({
          elements,
          clientSecret,
          shipping : {... } // TODO  https://docs.stripe.com/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-shipping
          payment_method_data: {
            billing_details: {
              name : ${shippingDetails.first_name} ${shippingDetails.last_name},
              email : customerDetails.email,
              phone : shippingDetails.phone,
              address: {
                city : shippingDetails.city,
                country : shippingDetails.country_code,
                line1 : shippingDetails.address_1,
                line2 : shippingDetails.address_2,
                postal_code : shippingDetails.postal_code,
              },
            }
          },
          confirmParams: {
            receipt_email: customerDetails.email
          },
          // Uncomment below if you only want redirect for redirect-based payments
          redirect: "if_required"
        }).then(({error,paymentIntent})=>{
          if(error){
            console.log(error)
          }
          if(paymentIntent){
            console.log(paymentIntent)
          }
        });
      }
cedar wyvernBOT
slim current
#

if you want to pass a shipping address, pass it there ^^

pseudo shard
#

await stripe.confirmPayment({ elements, clientSecret, shipping: { name : ${shippingDetails.first_name} ${shippingDetails.last_name}, email : customerDetails.email, phone : shippingDetails.phone, address: { city : shippingDetails.city, country : shippingDetails.country_code, line1 : shippingDetails.address_1, line2 : shippingDetails.address_2, postal_code : shippingDetails.postal_code, }, }, // payment_method_data: { // billing_details: { // name : ${shippingDetails.first_name} ${shippingDetails.last_name}, // email : customerDetails.email, // phone : shippingDetails.phone, // address: { // city : shippingDetails.city, // country : shippingDetails.country_code, // line1 : shippingDetails.address_1, // line2 : shippingDetails.address_2, // postal_code : shippingDetails.postal_code, // }, // } // }, confirmParams: { receipt_email: customerDetails.email }, // Uncomment below if you only want redirect for redirect-based payments redirect: "if_required" }).then(({error,paymentIntent})=>{ if(error){ console.log(error) } if(paymentIntent){ console.log(paymentIntent) } }); }

slim current
#

you can pass both(billing_details and shipping) if you want, and that gives all the information to the Stripe Dashboard

#

you didn't need to comment out billing_details

pseudo shard
#

ah so you need both?

slim current
#

you don't need both, but you can pass both if you want.

pseudo shard
#

So It should work right?

#

Like I should see the address of the customer here?

#

I was using <Card/> Element before and I was getting this

storm yoke
#

The billing details is set on the Payment Method, not the Customer directly when confirming an intent like that

#

But yes it's surfaced in the Dashboard UI like your screenshot

pseudo shard
#

Sorry king i'm confused. How would I achieve the last screen shot I sent using the code I sent?

#

I thought passing billing_details into payment_method_data updated that

storm yoke
pseudo shard
#

Yeah I have:

await stripe.confirmPayment({
elements,
clientSecret,
shipping: {
name : ${shippingDetails.first_name} ${shippingDetails.last_name},
email : customerDetails.email,
phone : shippingDetails.phone,
address: {
city : shippingDetails.city,
country : shippingDetails.country_code,
line1 : shippingDetails.address_1,
line2 : shippingDetails.address_2,
postal_code : shippingDetails.postal_code,
},
},
payment_method_data: {
billing_details: {
name : ${shippingDetails.first_name} ${shippingDetails.last_name},
email : customerDetails.email,
phone : shippingDetails.phone,
address: {
city : shippingDetails.city,
country : shippingDetails.country_code,
line1 : shippingDetails.address_1,
line2 : shippingDetails.address_2,
postal_code : shippingDetails.postal_code,
},
}
},
confirmParams: {
receipt_email: customerDetails.email
},
// Uncomment below if you only want redirect for redirect-based payments
redirect: "if_required"
}).then(({error,paymentIntent})=>{
if(error){
console.log(error)
}
if(paymentIntent){
fetcher.submit(null, {method: "POST"})
}
});
}

storm yoke
#

OK, then I'm not sure what the issue is?

pseudo shard
#

Doing this shows up in the dashboard like

#

Without the customer shipping details

#

Sorry man forgive me aha

storm yoke
#

Because that's the payment method details. There's no concept of shipping details on those objects, there's just set on the payment itself. What's the pi_xxx ID?

pseudo shard
#

pi_3PvdhgBCmvfPHMB30klm2DeT

storm yoke
pseudo shard
#

aaaaaaaaah

storm yoke
#

Sorry, overlooked that myself

pseudo shard
#

YUUPP

#

๐Ÿ‘‘ ๐Ÿ‘‘ You dropped these my kings

#

๐Ÿค

#

Thanks heaps mate!

storm yoke
#

No problem, glad I could help!

pseudo shard
#

Is there anywhere I can like leave feedback? Tell ya boss to give you a raise?

storm yoke