Module: PaymentServiceProviderClient

Included in:
AmazonPayClient
Defined in:
lib/amazon-pay-api-sdk-ruby/payment_service_provider_client.rb

Instance Method Summary collapse

Instance Method Details

#contest_dispute(dispute_id, payload, headers: {}) ⇒ HTTPResponse

API to contest dispute. The contestDispute operation is used by the partner, on behalf of the merchant, to formally contest a dispute managed by Amazon, requiring the submission of necessary evidence files within the specified Dispute Window (11 days for Chargeback, 7 days for A-Z Claims).

Parameters:

  • dispute_id (String)
    • The unique ID of the dispute to retrieve.

  • payload (Object)
    • The payload containing statusDetails.

  • headers (Object) (defaults to: {})
    • Optional headers for the request, such as x-amz-pay-idempotency-key, authorization tokens or custom headers.

Returns:

  • (HTTPResponse)

    The response from the API call, which includes details of the dispute.



40
41
42
# File 'lib/amazon-pay-api-sdk-ruby/payment_service_provider_client.rb', line 40

def contest_dispute(dispute_id, payload, headers: {});    
    api_call("#{Constants::DISPUTE_URLS}/#{dispute_id}/contest", Constants::POST, payload: payload, headers: headers)
end

#create_dispute(payload, headers: {}) ⇒ HTTPResponse

API to create dispute. The createDispute operation is used to notify Amazon of a newly created chargeback dispute by a buyer on a transaction processed only by the PSP (Payment Service Provider), ensuring the dispute is properly accounted for in the Amazon Pay systems. NOTE: This API is intended to be called only by PSPs (Payment Service Providers).

Parameters:

  • payload (Object)
    • The payload containing statusDetails.

  • headers (Object) (defaults to: {})
    • Requires : x-amz-pay-idempotency-key, Optional headers for the request, such as authorization tokens or custom headers.

Returns:

  • (HTTPResponse)

    The response from the API call, which includes details of the dispute.



9
10
11
# File 'lib/amazon-pay-api-sdk-ruby/payment_service_provider_client.rb', line 9

def create_dispute(payload, headers: {});    
    api_call(Constants::DISPUTE_URLS, Constants::POST, payload: payload, headers: headers)
end

#create_store(merchant_account_id, payload, headers: {}) ⇒ HTTPResponse

API to create store. The createStore operation is used to create a new store for a merchant account. This allows merchants to configure store-specific settings like allowed domains, redirect URLs, store name, privacy policy URL, merchant logo URL, and store status.

Parameters:

  • merchant_account_id (String)
    • The unique ID of the merchant account to create the store for.

  • payload (Object)
    • The payload containing store configuration details.

  • headers (Object) (defaults to: {})
    • Optional headers for the request, such as authorization tokens or custom headers.

Returns:

  • (HTTPResponse)

    The response from the API call, which includes details of the created store.



62
63
64
# File 'lib/amazon-pay-api-sdk-ruby/payment_service_provider_client.rb', line 62

def create_store(, payload, headers: {})
    api_call("#{Constants::MERCHANT_ACCOUNTS_BASE_URL}/#{}/#{Constants::STORES_URL}", Constants::POST, payload: payload, headers: headers)
end

#get_dispute(dispute_id, headers: {}) ⇒ HTTPResponse

API to get dispute. The getDispute operation is used to retrieve details of a chargeback dispute associated with a specific order

Parameters:

  • headers (Object) (defaults to: {})
    • Optional headers for the request, such as x-amz-pay-idempotency-key, authorization tokens or custom headers.

Returns:

  • (HTTPResponse)

    The response from the API call, which includes details of the dispute.



17
18
19
# File 'lib/amazon-pay-api-sdk-ruby/payment_service_provider_client.rb', line 17

def get_dispute(dispute_id, headers: {});    
    api_call("#{Constants::DISPUTE_URLS}/#{dispute_id}", Constants::GET, headers: headers)
end

#update_dispute(dispute_id, payload, headers: {}) ⇒ HTTPResponse

API to update dispute. The updateDispute operation is used to notify Amazon of the closure status of a chargeback dispute initiated by a buyer for orders, ensuring proper accounting within the Amazon systems.

Parameters:

  • dispute_id (String)
    • The unique ID of the dispute to retrieve.

  • payload (Object)
    • The payload containing statusDetails.

  • headers (Object) (defaults to: {})
    • Optional headers for the request, such as x-amz-pay-idempotency-key, authorization tokens or custom headers.

Returns:

  • (HTTPResponse)

    The response from the API call, which includes details of the dispute.



28
29
30
# File 'lib/amazon-pay-api-sdk-ruby/payment_service_provider_client.rb', line 28

def update_dispute(dispute_id, payload, headers: {});    
    api_call("#{Constants::DISPUTE_URLS}/#{dispute_id}", Constants::PATCH, payload: payload, headers: headers)
end

#update_store(merchant_account_id, store_id, payload, headers: {}) ⇒ HTTPResponse

API to update store. The updateStore operation is used to update an existing store’s configuration. This allows merchants to modify store-specific settings like allowed domains, redirect URLs, store name, privacy policy URL, merchant logo URL, and store status.

Parameters:

  • merchant_account_id (String)
    • The unique ID of the merchant account that owns the store.

  • store_id (String)
    • The unique ID of the store to update.

  • payload (Object)
    • The payload containing updated store configuration details.

  • headers (Object) (defaults to: {})
    • Optional headers for the request, such as authorization tokens or custom headers.

Returns:

  • (HTTPResponse)

    The response from the API call, which includes details of the updated store.



75
76
77
# File 'lib/amazon-pay-api-sdk-ruby/payment_service_provider_client.rb', line 75

def update_store(, store_id, payload, headers: {})
    api_call("#{Constants::MERCHANT_ACCOUNTS_BASE_URL}/#{}/#{Constants::STORES_URL}/#{store_id}", Constants::PATCH, payload: payload, headers: headers)
end

#upload_file(payload, headers: {}) ⇒ HTTPResponse

API to upload file. The uploadFile operation is utilised to upload file-based evidence when a merchant contests a dispute, providing the necessary reference ID to the evidence file as part of the Update Dispute API process.

Parameters:

  • headers (Object) (defaults to: {})
    • Requires : x-amz-pay-idempotency-key, Optional headers for the request, such as authorization tokens or custom headers.

Returns:

  • (HTTPResponse)

    The response from the API call, which includes details of the file.



50
51
52
# File 'lib/amazon-pay-api-sdk-ruby/payment_service_provider_client.rb', line 50

def upload_file(payload, headers: {});    
    api_call(Constants::FILES_URLS, Constants::POST, payload: payload, headers: headers)
end