Callbacks Documentation
Edit on
Codepen.io
Codepen.io
data-popup-webhook-received
A JavaScript function you may provide, which will be invoked when the webhook event is received from the Popup store. This function must accept 1 parameter, an object. To setup webhooks, login to Dashboard and navigate to Integrations > Webhooks. At least one event will always fire on successful order containing basic order information.
x
48
1
<h2>To Complete A Purchase</h2>
2
<p>You can use any date in the future for the card expiration date, and you can use any values for other purchase data such as your name, so long as you used the test card numbers shown below.</p>
3
<ul>
4
<li>Card Number: 4242 4242 4242 4242</li>
5
<li>CVV Code: *E4FP</li>
6
</ul>
7
8
<!--
9
Configure an add button to add an item to the cart.
10
-->
11
<button onclick="fastspring.builder.checkout();">Checkout</button>
12
13
<!--
14
DEMO EFFECTS
15
- The below div will be updated to include the returned data from the data-popup-webhook-received
16
-->
17
<br /><br />Data returned: <div id="log"></div>
18
19
<!--
20
DEMO SETUP
21
- Initialize the Store Builder Library
22
-->
23
<script
24
id="fsc-api"
25
src="https://sbl.onfastspring.com/sbl/1.0.2/fastspring-builder.min.js"
26
type="text/javascript"
27
data-storefront="fastspringexamples.test.onfastspring.com/popup-fastspringexamples"
28
data-popup-webhook-received="dataPopupWebhookReceived"
29
data-continuous="true">
30
</script>
31
32
<!--
33
Initialize the cart for demo purposes
34
-->
35
<script>
36
fastspring.builder.reset();
37
fastspring.builder.add("phot-io-main-app");
38
</script>
39
40
<!--
41
dataPopupWebhookReceived
42
- In this example, it will write div with the id log with the returned data.
43
-->
44
<script>
45
function dataPopupWebhookReceived(data) {
46
document.getElementById("log").innerHTML = "<pre>"+JSON.stringify(data, null, 4)+"</pre>";
47
}
48
</script>
1
1
1
1