#bird-payment-redirecturl

1 messages · Page 1 of 1 (latest)

swift lily
#

Hi there

#

Are you trying to test Apple Pay / Google Pay?

molten tiger
#

no, was trying out a card payment with 424242...

#

Morning!

swift lily
#

So you are on localhost and in test mode?

#

Is there a request ID associated with that error?

molten tiger
#

yes, I'm on local host. Not sure about test mode. Does that mean the stripe dashboar?

#

https://bidbird.test/auctions/jobs/create

swift lily
#

Are you using your test mode secret and publishable keys for your integration?

molten tiger
#

yes, that is correct

#

this is how the error pops up

swift lily
#

Okay so that error message isn't coming from us

#

That is from your own integration

#

That is not our hosted UI

molten tiger
#

pi_3MlECpKT8fxib8XB1BFRuHcW looks like this is happening on the confirm

swift lily
#

Ah okay so yeah the issue is your return_url

#

You passed undefined/jobs/create/job-credits

#

That must be an actual HTTPS url

molten tiger
#

that's strange. looking into this console.log(process.env.APP_URL) must not be accessing the .env.

swift lily
#

Yeah I'd hard code that first

#

Make sure it works

#

Then troubleshoot from there

molten tiger
#

great idea

#

pi_3MlESIKT8fxib8XB0RJO7q2r succeeded! Alright. So now I'm trying to hook this up: On the updated method how do you generally submit the updated quantity?

#
form.addEventListener('submit', async (event) => {    
event.preventDefault();    console.log(process.env.APP_URL)    

Here?
updateStripeIntent()

1)
await (async () => {        
const response = await fetch(process.env.APP_URL + '/jobs/create/job-credits/update');        
if (response.status === 'requires_payment_method') {            
const {error} = await elements.fetchUpdates();        }    })();    

2)

const {error} = await stripe.confirmPayment({        
//`Elements` instance that was used to create the Payment Element process.env.APP_URL +        elements,        confirmParams: {            return_url: 'https://bidbird.test/jobs/create/job-credits',        },    });
swift lily
#

Gotcha so yeah troubleshooting your .env.APP_URL seems like next step

molten tiger
#

Definitely will. May I have a little more help on this update()?

swift lily
#

Happy to help if you have specific questions

#

I can't really help troubleshoot your APP_URL issue as that needs to be properly pulled from your backend

molten tiger
#

o for sure on the url. That'll be relatively easy.

I'm now concerned with where to update the PI after a user hits submit.

const options = {    clientSecret: '{{ $stripeIntent->client_secret }}',

....

function updateStripeIntent () {    
axios.post('/jobs/create/job-credits/update', {        
params: {  
          
options: this.options        
request: this.request

}    
}).then(function (response) {        
this.options = response.data    }.bind(this))        
.catch(err => {            
console.log(err)        })}

Does that seem right?

I'm not sure if you can submit variables on the stripe fetch() or if I should call this custom method?

swift lily
#

What update are you performing?

molten tiger
#

so, what it'll be is $request->quantity * $request->price = $amount

#

basically, I created the PI on the page creation, then a customer can select the number of job credits that they need.

swift lily
#

Oh okay then yeah you want to fetch your backend just before calling confirmPayment and update the PI

molten tiger
#

nice, alright so above I've posted that submit. Is this updateStripeIntent() function necessary?

swift lily
#

I thought that was the update request you are sending to your backend?

molten tiger
#

where I put step 1) is that where you'd call updateStripeIntent()?

swift lily
#

Oh I see

#

Yep that looks right to me

molten tiger
#

ahh nice. ok. let me try and wire that up. I'll be back in a few!

swift lily
#

Sounds good!

odd hemlockBOT