Class: MastercardCoreSdk::Api::AccessTokenApi
- Inherits:
-
Object
- Object
- MastercardCoreSdk::Api::AccessTokenApi
- Includes:
- Client, Core, Exceptions, Tracker
- Defined in:
- lib/mastercard_core_sdk/api/access_token_api.rb
Overview
Invokes AccessTokenApi.
Class Method Summary collapse
-
.create(oauth_token, oauth_verifier, api_config = nil) ⇒ AccessTokenResponse
This API call is used to exchange a request token for a long access token from the Masterpass service.
Class Method Details
.create(oauth_token, oauth_verifier, api_config = nil) ⇒ AccessTokenResponse
Note:
Since version 1.2.0, the method signature for create has changed.
This API call is used to exchange a request token for a long access token from the Masterpass service. For Pairing during checkout, this service will need to be called twice:
-
To request the checkout access token, which is used to retrieve checkout data.
-
To request the long access token, which is used to retrieve precheckout data.
You will need the Request Token (oauth_token) and Verifier (oauth_verifier) from the merchant callback to get an access token.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mastercard_core_sdk/api/access_token_api.rb', line 23 def self.create(oauth_token, oauth_verifier, api_config = nil) path = "/oauth/consumer/v1/access_token" service_request = ServiceRequest.new service_request.headers = {"oauth_verifier" => oauth_verifier, "oauth_token" => oauth_token} service_request.content_type = "application/xml" api_client = ApiClient.new(api_config) api_client.api_tracker = TokenApiTracker.new api_client.error_handler = ErrorHandler.new return api_client.call(path, service_request, "POST", AccessTokenResponse) end |