20 lines
468 B
Ruby
20 lines
468 B
Ruby
|
require 'net/http'
|
||
|
|
||
|
module IfThenPay
|
||
|
def self.generate_gateway_link(id:, amount:, description:)
|
||
|
response = Net::HTTP.post(
|
||
|
URI("https://ifthenpay.com/api/gateway/paybylink/#{ENV['IFTHENPAY_KEY']}"),
|
||
|
JSON.generate({
|
||
|
id: id,
|
||
|
amount: amount.to_s,
|
||
|
description: description.to_s,
|
||
|
"lang": "pt",
|
||
|
"expiredate": "",
|
||
|
"accounts": ENV['IFTHENPAY_ACCOUNTS'],
|
||
|
})
|
||
|
)
|
||
|
|
||
|
JSON.parse(response.body)
|
||
|
end
|
||
|
end
|