Web App Payment
Web App Payment
By opening a Secure Altalix URL your user can use the Altalix Web App in order to make a payment. Below are the details to generate this URL
tip
Usually you'd want to show the Rate before the user creates a payment
Creating a Signed Altalix URL
You will need both your Partner ID
, Signing Key
& API Key
for this process so please re-visit Authentication if you don't have these.
There are 3 components to forming the URL:
- Base URL - this is fixed e.g.
https://app.altalix.com/partners/transaction-create
- Payload - this is encoded JSON including details for the payment
- Signature - this is the signed payload
Below is a simplified example in Ruby of how to create these URL's - if you're having issues with this step - drop us a message with the language and framework you're using and we are be happy to help.
@signing_key = OpenSSL::PKey::RSA.new File.read 'rsa.pem'
@signing_key_id = "<uuid-found-in-partner-portal>"
@partner_id = "<uuid-provided-at-registration>"
def generate_signed_url()
# JSON Payload Data - here it's fixed but this needs to be data
# provided from the user.
json = {
sell_currency: "EUR",
buy_currency: "ETH",
sell_amount: 10,
address: "<user-ether-address>",
partner_id: @partner_id,
key_id: @signing_key_id,
created_at: DateTime.now,
}.to_json
# Signature of payload
signature = @signing_key.sign(
OpenSSL::Digest::SHA256.new,
json.encode("UTF-8")
)
# Base64 encode and CGI escape for use in URL
encoded_signature = CGI.escape(Base64.encode64("#{signature}"))
payload = CGI.escape(Base64.encode64("#{json}"))
"#{@app_url}/partners/transaction-create?payload=#{payload}&signature=#{encoded_signature}"
end
Opening a Secure Altalix URL
This is down to the implementation but here's a few common scenarios:
- Web app - creating a link using
<a href="<SIGNED-URL-HERE>" target="_blank">Continue</a>
- React Native: In App Browser