Class: Payabli::PaymentLink::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/payabli/payment_link/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void

Parameters:



9
10
11
# File 'lib/payabli/payment_link/client.rb', line 9

def initialize(client:)
  @client = client
end

Instance Method Details

Generates a payment link for a bill from the bill ID. The vendor receives a secure page where they can select their preferred payment method (ACH, virtual card, or check) and complete the payment.

Examples:

client.payment_link.add_pay_link_from_bill(
  bill_id: 54323,
  mail_2: "jo@example.com; ceo@example.com",
  contact_us: {
    email_label: "Email",
    enabled: true,
    header: "Contact Us",
    order: 0,
    payment_icons: true,
    phone_label: "Phone"
  },
  logo: {
    enabled: true,
    order: 0
  },
  message_before_paying: {
    enabled: true,
    label: "Please review your payment details",
    order: 0
  },
  notes: {
    enabled: true,
    header: "Additional Notes",
    order: 0,
    placeholder: "Enter any additional notes here",
    value: ""
  },
  page: {
    description: "Get paid securely",
    enabled: true,
    header: "Payment Page",
    order: 0
  },
  payment_button: {
    enabled: true,
    label: "Pay Now",
    order: 0
  },
  payment_methods: {
    all_methods_checked: true,
    allow_multiple_methods: true,
    default_method: "vcard",
    enabled: true,
    header: "Payment Methods",
    methods: {
      ach: true,
      check: true,
      vcard: true
    },
    order: 0,
    show_preview_virtual_card: true
  },
  review: {
    enabled: true,
    header: "Review Payment",
    order: 0
  },
  settings: {
    color: "#000000",
    language: "en"
  }
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :bill_id (Integer)
  • :amount_fixed (Boolean, nil)
  • :mail_2 (String, nil)
  • :idempotency_key (String, nil)

Returns:



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/payabli/payment_link/client.rb', line 263

def add_pay_link_from_bill(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  path_param_names = %i[bill_id]
  body_params = params.except(*path_param_names)

  query_param_names = %i[amount_fixed mail_2]
  query_params = {}
  query_params["amountFixed"] = params[:amount_fixed] if params.key?(:amount_fixed)
  query_params["mail2"] = params[:mail_2] if params.key?(:mail_2)
  params = params.except(*query_param_names)

  headers = {}
  headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers)
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "PaymentLink/bill/#{URI.encode_uri_component(params[:bill_id].to_s)}",
    headers: headers,
    query: query_params,
    body: Payabli::Types::PaymentPageRequestBodyOut.new(body_params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Generates a vendor payment link for a specific bill lot number. This allows you to pay all bills with the same lot number for a vendor with a single payment link.

Examples:

client.payment_link.add_pay_link_from_bill_lot_number(
  lot_number: "LOT-2024-001",
  entry_point: "8cfec329267",
  vendor_number: "VEN-123",
  mail_2: "customer@example.com; billing@example.com",
  amount_fixed: "true",
  contact_us: {
    email_label: "Email",
    enabled: true,
    header: "Contact Us",
    order: 0,
    payment_icons: true,
    phone_label: "Phone"
  },
  logo: {
    enabled: true,
    order: 0
  },
  message_before_paying: {
    enabled: true,
    label: "Please review your payment details",
    order: 0
  },
  notes: {
    enabled: true,
    header: "Additional Notes",
    order: 0,
    placeholder: "Enter any additional notes here",
    value: ""
  },
  page: {
    description: "Get paid securely",
    enabled: true,
    header: "Payment Page",
    order: 0
  },
  payment_button: {
    enabled: true,
    label: "Pay Now",
    order: 0
  },
  payment_methods: {
    all_methods_checked: true,
    allow_multiple_methods: true,
    default_method: "vcard",
    enabled: true,
    header: "Payment Methods",
    methods: {
      ach: true,
      check: true,
      vcard: true
    },
    order: 0,
    show_preview_virtual_card: true
  },
  review: {
    enabled: true,
    header: "Review Payment",
    order: 0
  },
  settings: {
    color: "#000000",
    language: "en"
  }
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :lot_number (String)
  • :entry_point (Payabli::Types::Entry)
  • :vendor_number (String)
  • :mail_2 (String, nil)
  • :amount_fixed (String, nil)

Returns:



654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
# File 'lib/payabli/payment_link/client.rb', line 654

def add_pay_link_from_bill_lot_number(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  path_param_names = %i[lot_number]
  body_params = params.except(*path_param_names)

  query_param_names = %i[entry_point vendor_number mail_2 amount_fixed]
  query_params = {}
  query_params["entryPoint"] = params[:entry_point] if params.key?(:entry_point)
  query_params["vendorNumber"] = params[:vendor_number] if params.key?(:vendor_number)
  query_params["mail2"] = params[:mail_2] if params.key?(:mail_2)
  query_params["amountFixed"] = params[:amount_fixed] if params.key?(:amount_fixed)
  params = params.except(*query_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "PaymentLink/bill/lotNumber/#{URI.encode_uri_component(params[:lot_number].to_s)}",
    headers: headers,
    query: query_params,
    body: Payabli::Types::PaymentPageRequestBodyOut.new(body_params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Generates a payment link for an invoice from the invoice ID.

The payment page configuration blocks (logo, page, paymentMethods, review, messageBeforePaying, paymentButton, notes, contactUs, and settings) are optional. When you omit a block, Payabli applies a default rather than hiding it. The block is enabled at a fixed display order, so the generated page stays complete and branded. To hide a section, send the block explicitly with enabled set to false. An explicit value is always honored and is never replaced by a default. For each block's default, see its description in the request body.

Examples:

client.payment_link.add_pay_link_from_invoice(
  id_invoice: 23548884,
  mail_2: "jo@example.com; ceo@example.com",
  contact_us: {
    email_label: "Email",
    enabled: true,
    header: "Contact Us",
    order: 0,
    payment_icons: true,
    phone_label: "Phone"
  },
  invoices: {
    enabled: true,
    invoice_link: {
      enabled: true,
      label: "View Invoice",
      order: 0
    },
    order: 0,
    view_invoice_details: {
      enabled: true,
      label: "Invoice Details",
      order: 0
    }
  },
  logo: {
    enabled: true,
    order: 0
  },
  message_before_paying: {
    enabled: true,
    label: "Please review your payment details",
    order: 0
  },
  notes: {
    enabled: true,
    header: "Additional Notes",
    order: 0,
    placeholder: "Enter any additional notes here",
    value: ""
  },
  page: {
    description: "Complete your payment securely",
    enabled: true,
    header: "Payment Page",
    order: 0
  },
  payment_button: {
    enabled: true,
    label: "Pay Now",
    order: 0
  },
  payment_methods: {
    all_methods_checked: true,
    enabled: true,
    header: "Payment Methods",
    methods: {
      amex: true,
      apple_pay: true,
      discover: true,
      e_check: true,
      mastercard: true,
      visa: true
    },
    order: 0,
    settings: {
      apple_pay: {
        button_style: "black",
        button_type: "pay",
        language: "en-US"
      }
    }
  },
  payor: {
    enabled: true,
    fields: [{
      display: true,
      fixed: true,
      identifier: true,
      label: "Full Name",
      name: "fullName",
      order: 0,
      required: true,
      validation: "alpha",
      value: "",
      width: 0
    }],
    header: "Payor Information",
    order: 0
  },
  review: {
    enabled: true,
    header: "Review Payment",
    order: 0
  },
  settings: {
    color: "#000000",
    custom_css_url: "https://example.com/custom.css",
    language: "en",
    page_logo: {
      f_content: "PHN2ZyB2aWV3Qm94PSIwIDAgODAwIDEwMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPCEtLSBCYWNrZ3JvdW5kIC0tPgogIDxyZWN0IHdpZHRoPSI4MDAiIGhlaWdodD0iMTAwMCIgZmlsbD0id2hpdGUiLz4KICAKICA8IS0tIENvbXBhbnkgSGVhZGVyIC0tPgogIDx0ZXh0IHg9IjQwIiB5PSI2MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjI0IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+R3J1enlhIEFkdmVudHVyZSBPdXRmaXR0ZXJzPC90ZXh0PgogIDxsaW5lIHgxPSI0MCIgeTE9IjgwIiB4Mj0iNzYwIiB5Mj0iODAiIHN0cm9rZT0iIzJjM2U1MCIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgCiAgPCEtLSBDb21wYW55IERldGFpbHMgLS0+CiAgPHRleHQgeD0iNDAiIHk9IjExMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4xMjMgTW91bnRhaW4gVmlldyBSb2FkPC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSIxMzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+VGJpbGlzaSwgR2VvcmdpYSAwMTA1PC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSIxNTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+VGVsOiArOTk1IDMyIDEyMyA0NTY3PC90ZXh0PgogIDx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SIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMyYzNlNTAiPkJhbmsgRGV0YWlsczwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iNzYwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPkJhbms6IEJhbmsgb2YgR2VvcmdpYTwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iNzgwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPklCQU46IEdFMTIzNDU2Nzg5MDEyMzQ1Njc4PC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSI4MDAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+U1dJRlQ6IEJBR0FHRTIyPC90ZXh0PgoKICA8IS0tIEZvb3RlciAtLT4KICA8bGluZSB4MT0iNDAiIHkxPSI5MDAiIHgyPSI3NjAiIHkyPSI5MDAiIHN0cm9rZT0iIzJjM2U1MCIgc3Ryb2tlLXdpZHRoPSIxIi8+CiAgPHRleHQgeD0iNDAiIHk9IjkzMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjEyIiBmaWxsPSIjN2Y4YzhkIj5UaGFuayB5b3UgZm9yIGNob29zaW5nIEdydXp5YSBBZHZlbnR1cmUgT3V0Zml0dGVyczwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iOTUwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTIiIGZpbGw9IiM3ZjhjOGQiPnd3dy5ncnV6eWFhZHZlbnR1cmVzLmNvbTwvdGV4dD4KPC9zdmc+Cg==",
      filename: "logo.jpg",
      ftype: "jpg",
      furl: ""
    },
    redirect_after_approve: true,
    redirect_after_approve_url: "https://example.com/success"
  }
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :id_invoice (Integer)
  • :amount_fixed (Boolean, nil)
  • :mail_2 (String, nil)
  • :idempotency_key (String, nil)

Returns:



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/payabli/payment_link/client.rb', line 146

def add_pay_link_from_invoice(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::PaymentLink::Types::PayLinkDataInvoice.new(params).to_h
  non_body_param_names = %w[idInvoice amountFixed mail2 idempotencyKey]
  body = request_data.except(*non_body_param_names)

  query_params = {}
  query_params["amountFixed"] = params[:amount_fixed] if params.key?(:amount_fixed)
  query_params["mail2"] = params[:mail_2] if params.key?(:mail_2)

  headers = {}
  headers["idempotencyKey"] = params[:idempotency_key] if params[:idempotency_key]

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]).merge(headers)
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "PaymentLink/#{URI.encode_uri_component(params[:id_invoice].to_s)}",
    headers: headers,
    query: query_params,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Deletes a payment link by ID.

Examples:

client.payment_link.delete_pay_link_from_id(pay_link_id: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :pay_link_id (String)

Returns:



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/payabli/payment_link/client.rb', line 316

def delete_pay_link_from_id(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "DELETE",
    path: "PaymentLink/#{URI.encode_uri_component(params[:pay_link_id].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Retrieves a payment link by ID.

Examples:

client.payment_link.get_pay_link_from_id(paylink_id: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :paylink_id (String)

Returns:



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/payabli/payment_link/client.rb', line 355

def get_pay_link_from_id(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "PaymentLink/load/#{URI.encode_uri_component(params[:paylink_id].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::GetPayLinkFromIdResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Partially updates a Pay Out payment link's content, expiration date, and/or status. Use this to modify the payment page configuration, extend or change the expiration, or cancel a link. Updating the expiration date of an expired link reactivates it to Active status.

Examples:

client.payment_link.patch_out_payment_link(
  paylink_id: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234",
  expiration_date: "2026-06-01T00:00:00Z",
  status: "Active"
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :paylink_id (String)

Returns:



712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
# File 'lib/payabli/payment_link/client.rb', line 712

def patch_out_payment_link(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::PaymentLink::Types::PatchOutPaymentLinkRequest.new(params).to_h
  non_body_param_names = %w[paylinkId]
  body = request_data.except(*non_body_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PATCH",
    path: "PaymentLink/out/#{URI.encode_uri_component(params[:paylink_id].to_s)}",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Send a payment link to the specified email addresses or phone numbers.

Examples:

client.payment_link.push_pay_link_from_id(pay_link_id: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234")

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :pay_link_id (String)

Returns:



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/payabli/payment_link/client.rb', line 394

def push_pay_link_from_id(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "PaymentLink/push/#{URI.encode_uri_component(params[:pay_link_id].to_s)}",
    headers: headers,
    body: Payabli::Types::PushPayLinkRequest.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Refresh a payment link's content after an update.

Examples:

client.payment_link.refresh_pay_link_from_id(pay_link_id: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :pay_link_id (String)
  • :amount_fixed (Boolean, nil)

Returns:



435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/payabli/payment_link/client.rb', line 435

def refresh_pay_link_from_id(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["amountFixed"] = params[:amount_fixed] if params.key?(:amount_fixed)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "PaymentLink/refresh/#{URI.encode_uri_component(params[:pay_link_id].to_s)}",
    headers: headers,
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Sends a payment link to the specified email addresses.

Examples:

client.payment_link.send_pay_link_from_id(
  pay_link_id: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234",
  mail_2: "jo@example.com; ceo@example.com"
)

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :pay_link_id (String)
  • :attachfile (Boolean, nil)
  • :mail_2 (String, nil)

Returns:



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/payabli/payment_link/client.rb', line 483

def send_pay_link_from_id(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["attachfile"] = params[:attachfile] if params.key?(:attachfile)
  query_params["mail2"] = params[:mail_2] if params.key?(:mail_2)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "PaymentLink/send/#{URI.encode_uri_component(params[:pay_link_id].to_s)}",
    headers: headers,
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Updates a payment link's details.

Examples:

client.payment_link.update_pay_link_from_id(
  pay_link_id: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234",
  notes: {
    enabled: true,
    header: "Additional Notes",
    order: 0,
    placeholder: "Enter any additional notes here",
    value: ""
  },
  payment_button: {
    enabled: true,
    label: "Pay Now",
    order: 0
  }
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :pay_link_id (String)

Returns:



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
# File 'lib/payabli/payment_link/client.rb', line 541

def update_pay_link_from_id(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::PaymentLink::Types::PayLinkUpdateData.new(params).to_h
  non_body_param_names = %w[payLinkId]
  body = request_data.except(*non_body_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "PaymentLink/update/#{URI.encode_uri_component(params[:pay_link_id].to_s)}",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

Updates the payment page content for a Pay Out payment link. Use this to change the branding, messaging, payment methods offered, or other page configuration.

Examples:

client.payment_link.update_pay_link_out_from_id(
  paylink_id: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234",
  contact_us: {
    email_label: "Email",
    enabled: true,
    header: "Contact Us",
    order: 0,
    payment_icons: true,
    phone_label: "Phone"
  },
  logo: {
    enabled: true,
    order: 0
  },
  message_before_paying: {
    enabled: true,
    label: "Please review your payment details",
    order: 0
  },
  notes: {
    enabled: true,
    header: "Additional Notes",
    order: 0,
    placeholder: "Enter any additional notes here",
    value: ""
  },
  page: {
    description: "Get paid securely",
    enabled: true,
    header: "Payment Page",
    order: 0
  },
  payment_button: {
    enabled: true,
    label: "Pay Now",
    order: 0
  },
  payment_methods: {
    all_methods_checked: true,
    allow_multiple_methods: true,
    default_method: "vcard",
    enabled: true,
    header: "Payment Methods",
    methods: {
      ach: true,
      check: true,
      vcard: true
    },
    order: 0,
    show_preview_virtual_card: true
  },
  review: {
    enabled: true,
    header: "Review Payment",
    order: 0
  },
  settings: {
    color: "#000000",
    language: "en"
  }
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :paylink_id (String)

Returns:



817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
# File 'lib/payabli/payment_link/client.rb', line 817

def update_pay_link_out_from_id(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PATCH",
    path: "PaymentLink/updateOut/#{URI.encode_uri_component(params[:paylink_id].to_s)}",
    headers: headers,
    body: Payabli::Types::PaymentPageRequestBodyOut.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PayabliApiResponsePaymentLinks.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end