Skip to content

Commit

Permalink
feat(customers): Add checkout_url endpoint (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdenquin authored Nov 20, 2023
1 parent a9527c0 commit 6e5e87f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/lago/api/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ def portal_url(external_customer_id)
JSON.parse(response.to_json, object_class: OpenStruct).portal_url
end

def checkout_url(external_customer_id)
uri = URI(
"#{client.base_api_url}#{api_resource}/#{external_customer_id}/checkout_url",
)

response = connection.post(uri, identifier: nil)[root_name]

JSON.parse(response.to_json, object_class: OpenStruct).checkout_url
end

def whitelist_params(params)
result_hash = {
external_id: params[:external_id],
Expand Down

0 comments on commit 6e5e87f

Please sign in to comment.