Class: Peddler::APIs::Transfers20240601

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/transfers_2024_06_01.rb,
lib/peddler/apis/transfers_2024_06_01/error.rb,
lib/peddler/apis/transfers_2024_06_01/error_list.rb,
lib/peddler/apis/transfers_2024_06_01/expiry_date.rb,
lib/peddler/apis/transfers_2024_06_01/payment_method_list.rb,
lib/peddler/apis/transfers_2024_06_01/payment_method_details.rb,
lib/peddler/apis/transfers_2024_06_01/initiate_payout_request.rb,
lib/peddler/apis/transfers_2024_06_01/initiate_payout_response.rb,
lib/peddler/apis/transfers_2024_06_01/payment_method_type_list.rb,
lib/peddler/apis/transfers_2024_06_01/get_payment_methods_response.rb

Overview

The Selling Partner API for Transfers.

The Selling Partner API for Transfers enables selling partners to retrieve payment methods and initiate payouts for their seller accounts. This API supports the following marketplaces: DE, FR, IT, ES, SE, NL, PL, and BE.

Defined Under Namespace

Classes: PaymentMethodList, PaymentMethodTypeList

Constant Summary collapse

Error =

Error response returned when the request is unsuccessful.

Structure.new do
  # @return [String] An error code that identifies the type of error that occurred.
  attribute(:code, String)

  # @return [String] A message that describes the error condition.
  attribute(:message, String)

  # @return [String] Additional details that can help the caller understand or fix the issue.
  attribute?(:details, String)
end
ErrorList =

A list of error responses returned when a request is unsuccessful.

Structure.new do
  # @return [Array<Error>] array of errors
  attribute(:errors, [Error])
end
ExpiryDate =

The expiration date of the card used for payment. If the payment method is not card, the expiration date is null.

Structure.new do
  # @return [String] The month the card expires expressed as a number from `1` to `12`.
  attribute?(:month, String)

  # @return [String] Year
  attribute?(:year, String)
end
PaymentMethodDetails =

The details of a payment method.

Structure.new do
  # @return [String] The name of the account holder who is registered for the payment method.
  attribute?(:account_holder_name, String, from: "accountHolderName")

  # @return [String] The payment method assignment type, whether it is assigned as default to the given
  # marketplace or not.
  attribute?(:assignment_type, String, from: "assignmentType")

  # @return [String] The two-letter country code in ISO 3166-1 alpha-2 format. For payment methods in the `card`
  # category, the code is for the country where the card was issued. For payment methods in the `bank account`
  # category, the code is for the country where the account is located.
  attribute?(:country_code, String, from: "countryCode")

  # @return [ExpiryDate] The expiration date of the card used for payment.
  attribute?(:expiry_date, ExpiryDate, from: "expiryDate")

  # @return [String] The payment method identifier.
  attribute?(:payment_method_id, String, from: "paymentMethodId")

  # @return [String] The payment method type.
  attribute?(:payment_method_type, String, from: "paymentMethodType")

  # @return [String] The last three or four digits of the payment method.
  attribute?(:tail, String)
end
InitiatePayoutRequest =

The request schema for the initiatePayout operation.

Structure.new do
  # @return [String] The account type in the selected marketplace for which a payout must be initiated. For
  # supported EU marketplaces, the only account type is `Standard Orders`.
  attribute(:account_type, String, from: "accountType")

  # @return [String] The identifier of the Amazon marketplace. This API supports the following marketplaces: DE,
  # FR, IT, ES, SE, NL, PL, and BE. For a list of possible marketplace IDs, refer to [Marketplace
  # IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids).
  attribute(:marketplace_id, String, from: "marketplaceId")
end
InitiatePayoutResponse =

The response schema for the initiatePayout operation.

Structure.new do
  # @return [String] The financial event group ID for a successfully initiated payout. You can use this ID to
  # track payout information.
  attribute(:payout_reference_id, String, from: "payoutReferenceId")
end
GetPaymentMethodsResponse =

The response schema for the getPaymentMethods operation.

Structure.new do
  # @return [Array<PaymentMethodDetails>]
  attribute?(:payment_methods, [PaymentMethodDetails], from: "paymentMethods")
end

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#get_payment_methods(marketplace_id, payment_method_types: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the list of payment methods for the seller, which can be filtered by method type.

methods. For the list of possible marketplace identifiers, refer to Marketplace IDs. include in the response.

Parameters:

  • marketplace_id (String)

    The identifier of the marketplace from which you want to retrieve payment

  • payment_method_types (Array<String>) (defaults to: nil)

    A comma-separated list of the payment method types you want to

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



38
39
40
41
42
43
44
45
46
# File 'lib/peddler/apis/transfers_2024_06_01.rb', line 38

def get_payment_methods(marketplace_id, payment_method_types: nil, rate_limit: 0.5)
  path = "/finances/transfers/2024-06-01/paymentMethods"
  params = {
    "marketplaceId" => marketplace_id,
    "paymentMethodTypes" => stringify_array(payment_method_types),
  }.compact
  parser = -> { GetPaymentMethodsResponse }
  meter(rate_limit).get(path, params:, parser:)
end

#initiate_payout(body, rate_limit: 0.017) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Initiates an on-demand payout to the seller's default deposit method in Seller Central for the given marketplaceId and accountType, if eligible. You can only initiate one on-demand payout for each marketplace and account type within a 24-hour period.

Parameters:

  • body (Hash)

    The request body for the initiatePayout operation.

  • rate_limit (Float) (defaults to: 0.017)

    Requests per second

Returns:



22
23
24
25
26
# File 'lib/peddler/apis/transfers_2024_06_01.rb', line 22

def initiate_payout(body, rate_limit: 0.017)
  path = "/finances/transfers/2024-06-01/payouts"
  parser = -> { InitiatePayoutResponse }
  meter(rate_limit).post(path, body:, parser:)
end