RestClient - Rails 6 - Bad Request whole time

Viewed 63

I try to implement przelewy24 - Polish payment system.

I connect like this:

resource = 
RestClient::Resource.new('https://sandbox.przelewy24.pl/api/v1/transaction/register', 
:user => 'aaaa', :password => 'bbbb')

No 401 error so i think this work ok.

Then I try to send data:

response = resource.post(:payload => {

      merchantId: 'aaaa',
      posId: 'aaaa',
      sessionId: session_,
      currency: 'PLN',
      amount: @account['amount'],
      description: 'payment',
      email: current_user.email,
      country: 'PL',
      language: 'pl',
      urlReturn: 'http://localhost:3000/payments/comeback_przelewy24',
      sign: sha3_
    
    })

Everything that API needs to ... but I get:

RestClient::BadRequest (400 Bad Request)

Soo I make bad request to API - do You see some "stupid bug" ? :)

Here is link to docs - https://developers.przelewy24.pl/index.php?en

I try all day and nothing ... maybe someone will see something that I do not ...

Earlier I do it by form_tag but I do not know how make basicAuth for:

<%= form_tag @my_url, :name => "payform" do %>

<% end %>

and I always get 401 error.

0 Answers
Related