Created
March 3, 2023 09:40
-
-
Save chege-kimaru/9011d4dbd77223f9562f53a307d88ba4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ACCESS_KEY = "3bfb07e6733e3b3f8a5bfcaec62438db"; | |
const PROFILE_ID = "838CBBDE-0461-4FCD-99AA-09D37E031010"; | |
const form = document.querySelector("#payment-form"); | |
const params = { | |
access_key: ACCESS_KEY, | |
profile_id: PROFILE_ID, | |
// transaction_uuid: uuidv4(), | |
transaction_uuid: "6401be2b09c0e", | |
signed_field_names: | |
"access_key,profile_id,transaction_uuid,signed_field_names,unsigned_field_names,signed_date_time,locale,transaction_type,reference_number,amount,currency", | |
unsigned_field_names: "", | |
signed_date_time: "2023-03-03T09:30:19Z", | |
locale: "en", | |
transaction_type: "authorization", | |
//reference_number: new Date().getTime(), // Use UUIDV4 | |
reference_number: "1677835820396", | |
amount: 100.0, | |
currency: "USD", | |
signature: "alKsMuVGYUpfRNl7JT4kAMPseOhKNkAXUKz8785yj7s=" | |
}; | |
Object.keys(params).forEach((key) => { | |
const field = document.createElement("input"); | |
field.setAttribute("name", key); | |
field.setAttribute("value", params[key]); | |
field.setAttribute("type", "hidden"); | |
form.append(field); | |
}); | |
const submit = document.createElement("input"); | |
submit.setAttribute("type", "submit"); | |
submit.setAttribute("value", "Submit"); | |
form.append(submit); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment