Class: MWS::OffAmazonPayments

Inherits:
Peddler::Client show all
Defined in:
lib/mws/off_amazon_payments.rb

Overview

Note:

The Off-Amazon Payments API section is only applicable to payments made through the Login and Pay with Amazon service offered by Amazon Payments. You cannot use this API section to process payments for Amazon Marketplace, Amazon Webstore, or Checkout by Amazon.

The Off-Amazon Payments API helps you to process payments for purchases made by buyers on your website using the Login and Pay with Amazon service. This API enables you to programmatically retrieve shipping and payment information provided by the buyer from their Amazon account. It allows you to authorize, capture, and refund payments, enabling a variety of payments scenarios.

Constant Summary

Constants inherited from Peddler::Client

Peddler::Client::BadMarketplaceId, Peddler::Client::HOSTS

Instance Attribute Summary

Attributes inherited from Peddler::Client

#body, #marketplace_id, #merchant_id

Instance Method Summary collapse

Methods inherited from Peddler::Client

#aws_endpoint, #headers, inherited, #operation, path, #run

Instance Method Details

#authorize(amazon_order_reference_id, authorization_reference_id, authorization_amount, opts = {}) ⇒ Peddler::XMLParser

Reserves a specified amount against the payment method(s) stored in the order reference

Parameters:

  • amazon_order_reference_id (String)
  • authorization_reference_id (String)
  • authorization_amount (Struct, Hash)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :seller_authorization_note (String)
  • :transaction_timeout (Integer)
  • :capture_now (Boolean)
  • :soft_descriptor (String)

Returns:

See Also:



109
110
111
112
113
114
115
116
117
118
# File 'lib/mws/off_amazon_payments.rb', line 109

def authorize(amazon_order_reference_id, authorization_reference_id, authorization_amount, opts = {})
  operation('Authorize')
    .add(opts.merge(
      'AmazonOrderReferenceId' => amazon_order_reference_id,
      'AuthorizationReferenceId' => authorization_reference_id,
      'AuthorizationAmount' => authorization_amount
    ))

  run
end

#cancel_order_reference(amazon_order_reference_id, opts = {}) ⇒ Peddler::XMLParser

Cancels a previously confirmed order reference

Parameters:

  • amazon_order_reference_id (String)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • cancelation_reason (String)

Returns:

See Also:



73
74
75
76
77
78
# File 'lib/mws/off_amazon_payments.rb', line 73

def cancel_order_reference(amazon_order_reference_id, opts = {})
  operation('CancelOrderReference')
    .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))

  run
end

#capture(amazon_authorization_id, capture_reference_id, capture_amount, opts = {}) ⇒ Peddler::XMLParser

Captures funds from an authorized payment instrument

Parameters:

  • amazon_authorization_id (String)
  • capture_reference_id (String)
  • capture_amount (Struct, Hash)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :seller_capture_note (String)
  • :soft_descriptor (String)

Returns:

See Also:



143
144
145
146
147
148
149
150
151
152
# File 'lib/mws/off_amazon_payments.rb', line 143

def capture(amazon_authorization_id, capture_reference_id, capture_amount, opts = {})
  operation('Capture')
    .add(opts.merge(
      'AmazonAuthorizationId' => amazon_authorization_id,
      'CaptureReferenceId' => capture_reference_id,
      'CaptureAmount' => capture_amount
    ))

  run
end

#close_authorization(amazon_authorization_id, opts = {}) ⇒ Peddler::XMLParser

Closes an authorization

Parameters:

  • amazon_authorization_id (String)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • closure_reason (String)

Returns:

See Also:



174
175
176
177
178
179
# File 'lib/mws/off_amazon_payments.rb', line 174

def close_authorization(amazon_authorization_id, opts = {})
  operation('CloseAuthorization')
    .add(opts.merge('AmazonAuthorizationId' => amazon_authorization_id))

  run
end

#close_order_reference(amazon_order_reference_id, opts = {}) ⇒ Peddler::XMLParser

Confirms that an order reference has been fulfilled (fully or partially) and that you do not expect to create any new authorizations on this order reference

Parameters:

  • amazon_order_reference_id (String)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • closure_reason (String)

Returns:

See Also:



89
90
91
92
93
94
# File 'lib/mws/off_amazon_payments.rb', line 89

def close_order_reference(amazon_order_reference_id, opts = {})
  operation('CloseOrderReference')
    .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))

  run
end

#confirm_order_reference(amazon_order_reference_id) ⇒ Peddler::XMLParser

Confirms that the order reference is free of constraints and all required information has been set on the order reference



59
60
61
62
63
64
# File 'lib/mws/off_amazon_payments.rb', line 59

def confirm_order_reference(amazon_order_reference_id)
  operation('ConfirmOrderReference')
    .add('AmazonOrderReferenceId' => amazon_order_reference_id)

  run
end

#get_authorization_details(amazon_authorization_id) ⇒ Peddler::XMLParser

Returns the status of a particular authorization and the total amount captured on the authorization



126
127
128
129
130
131
# File 'lib/mws/off_amazon_payments.rb', line 126

def get_authorization_details(amazon_authorization_id)
  operation('GetAuthorizationDetails')
    .add('AmazonAuthorizationId' => amazon_authorization_id)

  run
end

#get_capture_details(amazon_capture_id) ⇒ Peddler::XMLParser

Returns the status of a particular capture and the total amount refunded on the capture



160
161
162
163
164
165
# File 'lib/mws/off_amazon_payments.rb', line 160

def get_capture_details(amazon_capture_id)
  operation('GetAuthorizationDetails')
    .add('AmazonCaptureId' => amazon_capture_id)

  run
end

#get_order_reference_details(amazon_order_reference_id, opts = {}) ⇒ Peddler::XMLParser

Returns details about the Order Reference object and its current state

Parameters:

  • amazon_order_reference_id (String)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • address_consent_token (String)

Returns:

See Also:



46
47
48
49
50
51
# File 'lib/mws/off_amazon_payments.rb', line 46

def get_order_reference_details(amazon_order_reference_id, opts = {})
  operation('GetOrderReferenceDetails')
    .add(opts.merge('AmazonOrderReferenceId' => amazon_order_reference_id))

  run
end

#get_refund_details(amazon_refund_id) ⇒ Peddler::XMLParser

Returns the status of a particular refund



207
208
209
210
211
212
# File 'lib/mws/off_amazon_payments.rb', line 207

def get_refund_details(amazon_refund_id)
  operation('GetRefundDetails')
    .add('AmazonRefundId' => 'amazon_refund_id')

  run
end

#get_service_statusPeddler::XMLParser

Gets the operational status of the API



218
219
220
221
# File 'lib/mws/off_amazon_payments.rb', line 218

def get_service_status
  operation('GetServiceStatus')
  run
end

#refund(amazon_capture_id, refund_reference_id, refund_amount, opts = {}) ⇒ Peddler::XMLParser

Refunds a previously captured amount

Parameters:

  • amazon_capture_id (String)
  • refund_reference_id (String)
  • refund_amount (Struct, Hash)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :seller_refund_note (String)
  • :soft_descriptor (String)

Returns:

See Also:



191
192
193
194
195
196
197
198
199
200
# File 'lib/mws/off_amazon_payments.rb', line 191

def refund(amazon_capture_id, refund_reference_id, refund_amount, opts ={})
  operation('Refund')
    .add(opts.merge(
      'AmazonCaptureId' => amazon_capture_id,
      'RefundReferenceId' => refund_reference_id,
      'RefundAmount' => refund_amount
    ))

  run
end

#set_order_reference_details(amazon_order_reference_id, order_total, opts = {}) ⇒ Peddler::XMLParser

Sets order reference details such as the order total and a description for the order

Parameters:

  • amazon_order_reference_id (String)
  • order_total (Struct, Hash)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :platform_id (String)
  • :seller_note (String)
  • :seller_order_attributes (Struct, Hash)

Returns:

See Also:



29
30
31
32
33
34
35
36
37
# File 'lib/mws/off_amazon_payments.rb', line 29

def set_order_reference_details(amazon_order_reference_id, order_total, opts = {})
  operation('SetOrderReferenceDetails')
    .add(
      'AmazonOrderReferenceId' => amazon_order_reference_id,
      'OrderReferenceAttributes' => opts.merge('OrderTotal' => order_total)
    )

  run
end