#user1352 - issue

1 messages · Page 1 of 1 (latest)

undone prairie
#

Hi user1352. What seems to be the problem?

#

Hi I have issue by send vale

granite valve
#

The trying to send my total price to the server

#

That t issue

undone prairie
#

You'll have to be more specific. What technologies are you using?

granite valve
#

Node js

undone prairie
#

Also you should always set prices on the server, it's more secure

granite valve
#

How then my total be add to server if there amount

#

`

app.post('/create-payment-intent', async (req, res) => {
const {paymentMethodType, currency} = req.body;

// Each payment method type has support for different currencies. In order to
// support many payment method types and several currencies, this server
// endpoint accepts both the payment method type and the currency as
// parameters.
//
// Some example payment method types include card, ideal, and alipay.
const params = {
payment_method_types: [paymentMethodType],
amount: 1999,
currency: currency,
}

`

#

It in the parameters the amount

#

In a post function

#

How send Paramus or amount to server make test recharge

#

`
app.get('/config', (req, res) => {
res.send({
publishableKey: process.env.STRIPE_PUBLISHABLE_KEY,
});
});

`

#

Do I use get method in server ?

fading gale
#

Hello, stepping in and catching up

granite valve
#

To get the Paramus form the client

#

Hi

fading gale
#

You should always set your Price on server. What do you want to do exactly?

granite valve
#

I have prise in crad.js how I send to the server to make test payment

#

The server have only 1999

fading gale
#

That's not a good idea, because a tech-savy customer can intercept your request, and change the amount middle way

#

for example you were suppose to send 100$ to your server, they will intercept their network, change the request to 10$ to your server

#

they will pay you 10$, and use your 100$ service

granite valve
#

I know that

#

The price is must *100

#

The use double number 10.00

fading gale
#

I meant, you shouldn't send the price from client to server anyway

granite valve
#

You know the total it change from one to another

#

So I have to change the amount in the server because it have only one prise

#

var totalprice = 10.00 ,

#

In card.js

#

How I make test by send the totalprice to the server

#

Or how Make the server use the totalprice in the card.js as test payment

#

?

fading gale
#

I am not fully follow the reason, but to dynamically change price, you can always send it from client to server, correct?

#

Just send it as a parameter in POST request, then receive it in server

granite valve
#

`

app.post('/create-payment-intent', async (req, res) => {
const {paymentMethodType, currency} = req.body;

// Each payment method type has support for different

`

fading gale
#

You will need the amount inside req.body

#

so you can do something like

const {paymentMethodType, amount, currency} = req.body;