Receiving the Payment Method Nonce

Learn how a server receives and handles the payment method nonce from the client.

We'll cover the following

As discussed earlier, the server is responsible for receiving the payment method nonce from the client and using it to make a transaction.

POST request handler

The client sends the payment method nonce to our server using a POST request. The implementation of the POST request handler for receiving the payment method nonce from the client is shown in the code below (lines 13–16). Since we do not have any client set up in our current implementation, we have commented out this code as we won’t receive any request from the client.

Fake valid nonce

However, to proceed with our implementation, we have used fake-valid-nonce in line 19, which is a valid payment method nonce provided by Braintree that can be used to create transactions.

Get hands-on with 1200+ tech skills courses.