Class: Klarna::CustomerToken

Inherits:
Client
  • Object
show all
Defined in:
lib/klarna/customer_token.rb

Instance Method Summary collapse

Methods inherited from Client

#initialize

Constructor Details

This class inherits a constructor from Klarna::Client

Instance Method Details

#cancel(customer_token) ⇒ Object



15
16
17
18
19
# File 'lib/klarna/customer_token.rb', line 15

def cancel(customer_token)
  do_request(:patch, "/customer-token/v1/tokens/#{customer_token}/status") do |request|
    request.body = { status: 'CANCELLED' }.to_json
  end
end

#get(customer_token) ⇒ Object



11
12
13
# File 'lib/klarna/customer_token.rb', line 11

def get(customer_token)
  do_request(:get, "/customer-token/v1/tokens/#{customer_token}")
end

#place_order(customer_token, data) ⇒ Object



5
6
7
8
9
# File 'lib/klarna/customer_token.rb', line 5

def place_order(customer_token, data)
  do_request(:post, "/customer-token/v1/tokens/#{customer_token}/order") do |request|
    request.body = data.to_json
  end
end