-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FK-1277] Add recurly integration example for sofort #100
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Bank Redirect Example</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<!-- <script src="https://js.recurly.com/v4/recurly.js"></script> --> | ||
<script src="https://js.lvh.me:8020/build/recurly.js"></script> | ||
<script>window.recurlyConfig = { | ||
publicKey: 'qa2-p14FypnEc7sShkm9ESVPia' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was having trouble getting this to work previously, I'll have to play with it again! |
||
}</script> | ||
</head> | ||
|
||
<body> | ||
<h1>Bank Redirect</h1> | ||
<form onsubmit="return false;"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why isn't the form actually submitting to the backend? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually took this as a base from @cyberxander90 and his ideal example. My guess is we don't actually want to be submitting a call to the backend directly, we want to call the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... but onsubmit could do that too? hmmm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it could be both ways, we can call the |
||
<div> | ||
Payment Method Type: | ||
<select id="payment_method_type" name="payment_method_type"> | ||
<option value="sofort">sofort</option> | ||
</select> | ||
</div> | ||
|
||
<div> | ||
Invoice UUID: | ||
<input id="invoice_uuid" name="invoice_uuid"> | ||
</div> | ||
|
||
<div> | ||
Country: | ||
<select id="country" name="country"></select> | ||
</div> | ||
|
||
<button onclick="start()">Start</button> | ||
</form> | ||
|
||
<script> | ||
// Configure recurly.js -- set this to your own public key | ||
recurly.configure(window.recurlyConfig.publicKey); | ||
|
||
// Create BankRedirect instance | ||
var bankRedirect = recurly.BankRedirect(); | ||
|
||
// If an error occurs, log it | ||
bankRedirect.on('error', function (error) { | ||
console.error('ERROR: ', error); | ||
}); | ||
|
||
// Listen for successful banks response | ||
bankRedirect.on('countries', function (countries) { | ||
console.log('COUNTRIES: ', countries); | ||
}); | ||
|
||
// load countries on the #country selector | ||
bankRedirect.loadCountries('#country') | ||
|
||
// Start | ||
function start() { | ||
const iframe = bankRedirect.start({ | ||
payment_method_type: document.querySelector('#payment_method_type').value, | ||
invoice_uuid: document.querySelector('#invoice_uuid').value, | ||
country_code: document.querySelector('#country').value | ||
}); | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll want to restore this to using the production recurly.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely! Wanted to just get it up for now in case others wanted to use it to test out RJS changes as we make 'em