Skip to content

does the react-square-web-payments-sdk perform the payment transaction ? #24

Answered by sfrunza
ebizcoAU asked this question in Help
Discussion options

You must be logged in to vote

I had to do more setup in Rails backend with gem 'square.rb' and create a post method like so

  def create_payment(nonce, price)
     client = Square::Client.new(
         access_token: ENV['SQUARE_ACCESS_TOKEN'],
         environment: "sandbox"
     )
     location_id = ENV['LOCATION_ID']
     result = client.payments.create_payment(
            body: {
                source_id: nonce,
                idempotency_key: SecureRandom.uuid(),
                amount_money: {
                     amount: price,
                     currency: "USD"
                },
                location_id: location_id
            }
      )
      return result
   end

and from React

cardTokenizeResponseR…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by danestves
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants