Class: Plaid::PaymentInitiationApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/plaid/apis/payment_initiation_api.rb

Overview

PaymentInitiationApi

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 Plaid::BaseApi

Instance Method Details

#create_payment_token(body) ⇒ ApiResponse

The ‘/payment_initiation/payment/token/create` endpoint has been deprecated. New Plaid customers will be unable to use this endpoint, and existing customers are encouraged to migrate to the newer, `link_token`-based flow. The recommended flow is to provide the `payment_id` to `/link/token/create`, which returns a `link_token` used to initialize Link. The `/payment_initiation/payment/token/create` is used to create a `payment_token`, which can then be used in Link initialization to enter a payment initiation flow. You can only use a `payment_token` once. If this attempt fails, the end user aborts the flow, or the token expires, you will need to create a new payment token. Creating a new payment token does not require end user input. parameter: TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/plaid/apis/payment_initiation_api.rb', line 193

def create_payment_token(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment_initiation/payment/token/create',
                                 Server::DEFAULT)
               .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)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInitiationPaymentTokenCreateResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payment_initiation_payment_create(body) ⇒ ApiResponse

After creating a payment recipient, you can use the ‘/payment_initiation/payment/create` endpoint to create a payment to that recipient. Payments can be one-time or standing order (recurring) and can be denominated in either EUR or GBP. If making domestic GBP-denominated payments, your recipient must have been created with BACS numbers. In general, EUR-denominated payments will be sent via SEPA Credit Transfer and GBP-denominated payments will be sent via the Faster Payments network, but the payment network used will be determined by the institution. Payments sent via Faster Payments will typically arrive immediately, while payments sent via SEPA Credit Transfer will typically arrive in one business day. Standing orders (recurring payments) must be denominated in GBP and can only be sent to recipients in the UK. Once created, standing order payments cannot be modified or canceled via the API. An end user can cancel or modify a standing order directly on their banking application or website, or by contacting the bank. Standing orders will follow the payment rules of the underlying rails (Faster Payments in UK). Payments can be sent Monday to Friday, excluding bank holidays. If the pre-arranged date falls on a weekend or bank holiday, the payment is made on the next working day. It is not possible to guarantee the exact time the payment will reach the recipient’s account, although at least 90% of standing order payments are sent by 6am. In the Development environment, payments must be below 5 GBP / EUR. For details on any payment limits in Production, contact your Plaid Account Manager. TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/plaid/apis/payment_initiation_api.rb', line 133

def payment_initiation_payment_create(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment_initiation/payment/create',
                                 Server::DEFAULT)
               .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)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInitiationPaymentCreateResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payment_initiation_payment_get(body) ⇒ ApiResponse

The ‘/payment_initiation/payment/get` endpoint can be used to check the status of a payment, as well as to receive basic information such as recipient and payment amount. In the case of standing orders, the `/payment_initiation/payment/get` endpoint will provide information about the status of the overall standing order itself; the API cannot be used to retrieve payment status for individual payments within a standing order. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/plaid/apis/payment_initiation_api.rb', line 160

def payment_initiation_payment_get(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment_initiation/payment/get',
                                 Server::DEFAULT)
               .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)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInitiationPaymentGetResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payment_initiation_payment_list(body) ⇒ ApiResponse

The ‘/payment_initiation/payment/list` endpoint can be used to retrieve all created payments. By default, the 10 most recent payments are returned. You can request more payments and paginate through the results using the optional `count` and `cursor` parameters. TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/plaid/apis/payment_initiation_api.rb', line 218

def payment_initiation_payment_list(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment_initiation/payment/list',
                                 Server::DEFAULT)
               .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)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInitiationPaymentListResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payment_initiation_payment_reverse(body) ⇒ ApiResponse

Reverse a previously initiated payment. A payment can only be reversed once and will be refunded to the original sender’s account. TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/plaid/apis/payment_initiation_api.rb', line 15

def payment_initiation_payment_reverse(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment_initiation/payment/reverse',
                                 Server::DEFAULT)
               .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)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInitiationPaymentReverseResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payment_initiation_recipient_create(body) ⇒ ApiResponse

Create a payment recipient for payment initiation. The recipient must be in Europe, within a country that is a member of the Single Euro Payment Area (SEPA). For a standing order (recurring) payment, the recipient must be in the UK. The endpoint is idempotent: if a developer has already made a request with the same payment details, Plaid will return the same ‘recipient_id`. TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/plaid/apis/payment_initiation_api.rb', line 42

def payment_initiation_recipient_create(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment_initiation/recipient/create',
                                 Server::DEFAULT)
               .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)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInitiationRecipientCreateResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payment_initiation_recipient_get(body) ⇒ ApiResponse

Get details about a payment recipient you have previously created. TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/plaid/apis/payment_initiation_api.rb', line 87

def payment_initiation_recipient_get(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment_initiation/recipient/get',
                                 Server::DEFAULT)
               .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)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInitiationRecipientGetResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#payment_initiation_recipient_list(body) ⇒ ApiResponse

The ‘/payment_initiation/recipient/list` endpoint list the payment recipients that you have previously created. TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/plaid/apis/payment_initiation_api.rb', line 65

def payment_initiation_recipient_list(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment_initiation/recipient/list',
                                 Server::DEFAULT)
               .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)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentInitiationRecipientListResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end