Class: PaysecureApiDocumentationLive::PayoutApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/paysecure_api_documentation_live/apis/payout_api.rb

Overview

PayoutApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from PaysecureApiDocumentationLive::BaseApi

Instance Method Details

#create_pay_out(body) ⇒ ApiResponse

To Initiate a payment, the very first call to make is /payout/ with the required data in the request body. To generate a Payout, you are required to provide the API key (in the header) can be located in the Dashboard section of your merchant account login. The request body structure is shown on the request body of the example request shown here. The following (see table below) are the mandatory parameters that are required to create a Payout request.

Mandatory parameters in the request body:

Parameter Notes
client.email An Identifier for a user
client.phone An Identifier for a user
client.full_name An Identifier for a user
client.country
payoutMethod PAYOUT-THIRDPARTY-UPI
beneficiaryDetail.upi VPA (UPI ID)
Currency Note this is currency account for which you have balance
Amount Amount in Currency
Purpose Purpose of the payment

description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/paysecure_api_documentation_live/apis/payout_api.rb', line 149

def create_pay_out(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/payout',
                                 Server::SERVER_3)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end

#get_status(payout_id) ⇒ ApiResponse

This API tells you about all the details of a Payout, including its history.

Mandatory

you need to pass the payoutId in the API URL

Possible Value of Status

Status Notes
paid Transaction Successful
payout_in_process payout is under Processing.
error Transaction has Failed.

here

Parameters:

  • payout_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/paysecure_api_documentation_live/apis/payout_api.rb', line 109

def get_status(payout_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/getpayout/{payoutId}',
                                 Server::SERVER_3)
               .template_param(new_parameter(payout_id, key: 'payoutId')
                                .is_required(true)
                                .should_encode(true)))
    .response(new_response_handler
                .deserializer(APIHelper.method(:deserialize_primitive_types))
                .deserialize_into(proc do |response| response&.to_s end)
                .is_api_response(true)
                .is_primitive_response(true))
    .execute
end

#get_status1(payout_id) ⇒ ApiResponse

This API tells you about all the details of a Payout, including its history

Mandatory

you need to pass the payoutId in the API URL

Possible Value of Status

Status Notes
paid Transaction Successful
payout_in_process payout is under Processing.
error Transaction has Failed.

The webhook will only be triggered for paid transactions or errors. Paid: "success_callback": "https://success.com", Error: "failure_callback": “https://failure.com” here

Parameters:

  • payout_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/paysecure_api_documentation_live/apis/payout_api.rb', line 180

def get_status1(payout_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/getpayout/{payoutId}',
                                 Server::SERVER_3)
               .template_param(new_parameter(payout_id, key: 'payoutId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetSuccessStatus3.method(:from_hash))
                .is_api_response(true))
    .execute
end

#pay_out(accept, body) ⇒ ApiResponse

To Initiate a payment, the very first API call to make is /payout/ with the required data in the request body. To generate a Payout, you are required to provide the API key (in the header) can be located in the Dashboard section of your merchant account login. The request body structure is shown on the request body of the example request shown here. The following (see table below) are the mandatory parameters that are required to create a Payout request.

Mandatory parameters in the request body:

Parameter Notes
client.email The customer's email.
client.phone The customer's phone number along with the country code.

Example: +91 9634088651
client.city The customer's city.
client.country ISO-3166 Country Code. Must be upper case. Example “SG”
(Alpha2)
client.stateCode Example “AL”, “XZ”. Must be in upper case.
Client.street_address The customer's address.
client.zip_code The customer's ZIP or postal code. If country=US, zip
format must be NNNNN or NNNNN-NNNN.
currency ISO 4217 code for currency you want to send the transaction

in.

Please note, the currency has to be enabled by the account manager for your account. | | amount | amount in decimal format.
example 1:
EUR 5 , should be sent as 5.00

example 2:
USD 10 and 37 cents , should be sent as 10.37 | | payoutMethod | example: PAYOUT-BANKTRANSFER | | success_redirect | URL to send the user if the transactions is successful. | | pending_redirect | URL to send the user if the transactions is in pending. | | failure_redirect | URL to send the user if the transactions is unsuccessful. | | Purpose | The purpose of doing a payout. |

Additional parameters for this usecase:

Parameter Notes
beneficiaryDetail.bankName The Bank Name in which the customer want's

to credit the money.

Optional Field.
If passed, only use the mentioned bank names below. Anything else might lead to payout failures.
If you don't want to pass, then you might need to open our checkout_url in the response and user can select the Bank from the dropdown. | | beneficiaryDetail.bankAccountName | Mandatory Field.
Account Holder's Full Name.
It is advised to have atleast 2 words in the name. | | beneficiaryDetail.bankAccountCurrency | Optional Field.
The Currency in which the money will be credited. Generally the same as the currency field mentioned above. | | beneficiaryDetail.bankAccountNumber | Mandatory Field.
Account Holder's Account Number.
This is the account in which the money will be credited. | | beneficiaryDetail.ifscCode | Mandatory Field.
IFSC code of the account in which the money will be credited. | | beneficiaryDetail.bankCountryCode | Optional Field.
The country code in which the account exist. Generally the same as the country field mentioned above. | Bank Names: here

Parameters:

  • accept (String)

    Required parameter: TODO: type description here

  • body (PayOutRequest1)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/paysecure_api_documentation_live/apis/payout_api.rb', line 76

def pay_out(accept,
            body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/payout',
                                 Server::SERVER_3)
               .header_param(new_parameter(accept, key: 'Accept')
                              .is_required(true))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:deserialize_primitive_types))
                .deserialize_into(proc do |response| response&.to_s end)
                .is_api_response(true)
                .is_primitive_response(true))
    .execute
end