Class: PaysecureApiDocumentationLive::PayoutApIsApi

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

Overview

PayoutApIsApi

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(brand_id, 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.full_name An Identifier for a user
client.country CA
payoutMethod PAYOUT-INTERAC-ETRANSFER
Currency CAD
Amount Payout Amount
Purpose Transfer Reversed

description here

Parameters:

  • brand_id (String)

    Required parameter: TODO: type description here

  • body (CreatePayOutRequest)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 32

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

#create_pay_out1(brand_id, 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 or client.phone An Identifier for a user
client.full_name Full Name of the user
client.country CA
payoutMethod PAYOUT-INTERAC-REQUEST-MONEY
Currency Note this is currency account for which you have balance
Amount amount in CAD
Purpose eg. "Transfer Reversed"

description here

Parameters:

  • brand_id (String)

    Required parameter: TODO: type description here

  • body (CreatePayOutRequest1)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def create_pay_out1(brand_id,
                    body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/payout',
                                 Server::SERVER_3)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter(brand_id, key: 'brandId')
                              .is_required(true))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Success5.method(:from_hash))
                .is_api_response(true))
    .execute
end

#create_pay_out11(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 or client.phone An Identifier for a user
client.full_name
client.country
payoutMethod
Currency Note this is currency account for which you have balance
Amount
Purpose

description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 319

def create_pay_out11(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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreatePayoutSuccess2.method(:from_hash))
                .is_api_response(true))
    .execute
end

#create_pay_out21(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.full_name Full name of the receiver. Minimum 2 words with
atleast 1 character in each word.
client.email An Identifier for a receiver, should be a valid email.
client.country ISO-3166 Country Code. It must be upper case.
client.stateCode State of the receiver. Must be in upper case.
client.street_address street address of the receiver.
client.zip_code zip code of the receiver.
client.phone Phone number of the receiver. Country code is mandatory.

Example: +234999999999
payoutMethod Payout-MOBILEMONEY
Amount Amount in currency upto 2 decimal points
Currency Note this is currency account for which you have balance.
success_redirect URL to send the user if the payout is successful
pending_redirect URL to send the user if the payout is in progress
failure_redirect URL to send the user if the payout is unsuccessful.
Purpose Purpose of Payout

Required parameters in the request body for this use case:

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.bankCountryCode | Optional Field.
The country code in which the account exist. Generally the same as the country field mentioned above. | description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 792

def create_pay_out21(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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Success23.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             FailureException))
    .execute
end

#create_pay_out3(body) ⇒ ApiResponse

To Initiate a payout, the very first call to make is /payout/ API with the required data in the request body. To generate a PayOut, you are required to provide the API key (in the header), which can be located in the Dashboard section of your merchant account login. 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-PIX | | 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
client.documentType Mandatory.
Document Type Supported : cpf,

cnpj, evp, email, phone

cpf is Brazil's tax_id
cnpj is Business tax_id
evp is random key generated by the bank
email is the email which supports pix
phone is the phone number which supports pix | | client.documentId | Mandatory.
Document value of the type above. | description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 248

def create_pay_out3(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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Success8.method(:from_hash))
                .is_api_response(true))
    .execute
end

#create_payout2(brand_id, 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 client.phone An Identifier for a user
client.full_name An Identifier for a user
client.country CA
payoutMethod PAYOUT-INTERAC-EXPRESS
Currency CAD
Amount Payout Amount
Purpose Transfer Reversed

description here

Parameters:

  • brand_id (String)

    Required parameter: TODO: type description here

  • body (CreatePayOutRequest1)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 182

def create_payout2(brand_id,
                   body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/payout',
                                 Server::SERVER_3)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter(brand_id, key: 'brandId')
                              .is_required(true))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreatePayoutSuccess1.method(:from_hash))
                .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.

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.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 68

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))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetSuccessStatus.method(:from_hash))
                .is_api_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.



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 143

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(GetSuccessStatus1.method(:from_hash))
                .is_api_response(true))
    .execute
end

#get_status2(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.



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 281

def get_status2(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(Success8.method(:from_hash))
                .is_api_response(true))
    .execute
end

#get_status3(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.



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 352

def get_status3(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(GetSuccessStatus2.method(:from_hash))
                .is_api_response(true))
    .execute
end

#get_status4(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.



828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 828

def get_status4(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(GetStatus.method(:from_hash))
                .is_api_response(true))
    .execute
end

#new_request(body) ⇒ ApiResponse

Payout Request API

This endpoint allows clients to initiate a payout transaction. It requires specific details about the client and the payout method to process the request successfully.

Request Format

The request must be sent as a JSON object in the raw body. The following parameters are expected:

  • client: An object containing client information.

    - **email** (string): The email address of the client.
    
    - **country** (string): The country of the client.
    
    - **phone** (string): The phone number of the client.
    
    - **full_name** (string): The full name of the client.
    
  • purpose (string): A brief description of the reason for the payout (e.g., "testing payout").

  • currency (string): The currency in which the payout is to be made (e.g., "AUD").

  • payoutMethod (string): The method used for the payout (e.g., "PAYOUT-PAYID").

  • amount (number): The amount to be paid out.

  • extraParam: An object containing additional payout parameters.

    - **payId** (string): The unique identifier for the payout.
    
    - **bankName** (string): The name of the bank associated with the
    

    payout.

    - **accountName** (string): The name on the account receiving the
    

    payout.

  • success_callback (string): A URL that will be called upon successful completion of the payout.

  • failure_callback (string): A URL that will be called if the payout fails.

Response Structure

The response from this endpoint will typically include details about the status of the payout request, which may include:

  • A success message or error details.

  • A transaction ID for tracking purposes.

  • Any additional information relevant to the payout process.

Ensure to handle both success and failure callbacks appropriately based on the response received from this endpoint. here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 723

def new_request(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/>',
                                 Server::SERVER_1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Success18.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payout(body) ⇒ ApiResponse

To Initiate a payout, the very first call to make is /payout/ API with the required data in the request body. To generate a PayOut, you are required to provide the API key (in the header), which 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 purchase request.

Mandatory parameters in the request body:

Parameter Notes
client.full_name Full name of the receiver. Minimum 2 words with
atleast 1 character in each word.
client.email An Identifier for a receiver, should be a valid email.
client.country ISO-3166 Country Code. It must be upper case.
client.stateCode ISO-3166-2 State Code. Must be in upper case.
client.street_address street address of the receiver.
client.zip_code zip code of the receiver.
client.phone Phone number of the receiver. Country code is mandatory.

Example: +234999999999
payoutMethod Payout-MOBILEMONEY
Amount Amount in currency upto 2 decimal points
Currency Note this is currency account for which you have balance.
success_redirect URL to send the user if the payout is successful
pending_redirect URL to send the user if the payout is in progress
failure_redirect URL to send the user if the payout is unsuccessful.
Purpose Purpose of Payout

here

Parameters:

  • body (PayoutRequest2)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 596

def payout(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
                .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

#payout_ap_is(body) ⇒ ApiResponse

Payout APIs Integration (SPEI)

1. Request Payload Structure

Submit a JSON payload containing:

  • client (beneficiary details)

  • purpose (should be "payout")

  • currency (always "MXN")

  • payoutMethod (must be "PAYOUT-SPEI")

  • amount (numeric, in major units)

  • Redirect & callback URLs

jsonCopy{
  "client": {
    "email": "ashishm.21190@gmail.com",
    "country": "MX",
    "phone": "+14377717874",
    "full_name": "MARCO ANTONIO FERNANDEZ RAMIREZ",
    "stateCode": "test",
    "spei_clabe": "012180027944986158"
  },
  "purpose": "payout",
  "currency": "MXN",
  "payoutMethod": "PAYOUT-SPEI",
  "amount": 20,
  "success_redirect": "https://test.com/getResponse.jsp?success=true",
  "failure_redirect": "https://test.com/getResponse.jsp?success=false",
  "success_callback": "https://test1.com",
  "failure_callback": "https://test2.com"
}
  • client.email, client.phone, client.full_name, client.country, client.stateCode: Required beneficiary/contact info.

  • client.spei_clabe: 18-digit CLABE of beneficiary’s bank account (validate format client-side to avoid runtime failures).

  • purpose: Always set to "payout".

  • currency: Must be "MXN".

  • payoutMethod: Must be "PAYOUT-SPEI".

  • amount: Numeric amount (e.g., 20 for MXN 20.00).

  • success_redirect / failure_redirect: URLs for end-user redirect after they click “Return to Merchant” (GET).

  • success_callback / failure_callback: Webhook endpoints for asynchronous payout status notifications.


2. Sample Response & Key Fields

jsonCopy{
  "payoutId": "683d778dc74d23074a56ea94",
  "client": {
    "customerId": "NA",
    "email": "ashishm.21190@gmail.com",
    "phone": "+14377717874",
    "full_name": "MARCO ANTONIO FERNANDEZ RAMIREZ",
    "country": "MX",
    "spei_clabe": "012180027944986155",
    "stateCode": "test"
  },
  "updated_on": 1748858765,
  "payoutMethod": "PAYOUT-SPEI",
  "amountUnit": "MAJOR",
  "amount": 20.0,
  "errorMsg": "This customer can not be processed !",
  "purpose": "test payout",
  "created_on": 1748858765,
  "merchantRef": "683d778dc74d23074a56ea94",
  "status": "ERROR",
  "status_history": [
    {
      "status": "created",
      "timestamp": 1748858765
    },
    {
      "status": "error",
      "timestamp": 1748858765
    }
  ],
  "currency": "MXN",
  "paymentOn": 0,
  "taxAmount": 0.0,
  "taxPercent": 0.0,
  "success_redirect": "https://test.com/getResponse.jsp?success=true",
  "failure_redirect": "https://test.com/getResponse.jsp?success=false",
  "redirectType": "GET",
  "success_callback": "https://test1.com",
  "failure_callback": "https://test2.com"
}
  • payoutId (string): Unique PaySecure identifier for this payout request.

  • client.customerId: "NA" for a new beneficiary or your internal customer ID if returning.

  • client.spei_clabe: Echoed beneficiary CLABE (note: if the CLABE in response differs by a digit, double-check formatting/validation).

  • updated_on / created_on: Unix timestamps (seconds since epoch).

  • payoutMethod: "PAYOUT-SPEI".

  • amountUnit: "MAJOR" indicates amount is in MXN major units (no subunit conversion required).

  • amount: 20.0 (MXN 20.00).

  • errorMsg: Describes any immediate rejection reason. If non-empty, status will be "ERROR".

  • purpose: Echo of the "payout" field or any custom string you passed.

  • merchantRef: Mirror of payoutId by default; can be overwritten if you pass a custom reference.

  • status: One of:

    - `"created"` → request accepted, preparing SPEI transfer
    
    - `"processing"` → SPEI transfer initiated, awaiting Banco de México
    

    settlement

    - `"success"` → funds successfully delivered
    
    - `"error"` → immediate failure (e.g., invalid CLABE, validation
    

    issue)

  • status_history: Array showing timestamped states from "created""processing" → ("success" or "error").

  • paymentOn: Unix timestamp when the transfer actually occurred (0 if not delivered).

  • redirectType: Always "GET", meaning customer is redirected via HTTP GET to your provided URL.

  • success_redirect / failure_redirect / success_callback / failure_callback: Echo of whatever you passed in request.

Note: If you see "status": "ERROR" and an errorMsg, do not retry automatically—inspect the message, correct client data, then reinitiate a new payout request.

3. Handling Payout Webhooks & Status Flow

  1. Configure Webhooks

    • In your PaySecure Dashboard, register your success_callback and failure_callback URLs (these will receive POSTs once SPEI settles or fails).
  2. Listen for Events

    • payout.success: Banco de México confirmed the credit to beneficiary’s CLABE.

    • payout.error: CLABE invalid, account closed, or transfer rejected.

  3. Update Your Records

    • On payout.success: Mark disbursement as complete; notify your finance/operations teams.

    • On payout.error: Log failure details, alert operations for manual review, and optionally retry after fixing the root cause. here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 548

def payout_ap_is(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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Success12.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payout_ap_is1(body) ⇒ ApiResponse

Create Payout

This endpoint allows you to initiate a payout transaction.

Request Body

  • client (object, required): Details of the client initiating the payout.

    - `email` (string): The email of the client.
    
    - `country` (string): The country of the client.
    
    - `phone` (string): The phone number of the client.
    
    - `full_name` (string): The full name of the client.
    
    - `stateCode` (string): The state code of the client.
    
  • purpose (string, required): The purpose of the payout.

  • currency (string, required): The currency of the payout.

  • payoutMethod (string, required): The method of payout.

  • amount (number, required): The amount of the payout.

  • success_callback (string, required): The URL to which the success callback will be sent.

  • failure_callback (string, required): The URL to which the failure callback will be sent.

Response Body

The response will contain the details of the initiated payout transaction. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
# File 'lib/paysecure_api_documentation_live/apis/payout_ap_is_api.rb', line 648

def payout_ap_is1(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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(NewRequest.method(:from_hash))
                .is_api_response(true))
    .execute
end