Select Page
Methods Documentation
Edit on
Codepen.io

fastspring.builder.push(s)

Takes a Session Object payload as input and applies data to the session.


x
57
 
1
<!--
2
    DEMO INFO:
3
    push() is generally used to push session information to FastSpring. This could
4
    be anything from user info to language and country to cart info. So in this
5
    example first we will build a simple session object then push that session
6
    object to FastSpring using fastspring.builder.push()
7
-->
8
9
<button onclick="pushToFastSpring();">Update Session</button>
10
11
<script type="text/javascript">
12
    function pushToFastSpring() {
13
        // Define a session
14
        var mySession = {
15
            "reset": true,
16
            "products" : [
17
                {
18
                "path":"phot-io-main-app",
19
                "quantity": 3
20
                }
21
            ],
22
            "paymentContact": {
23
                "email":"myName@email.com",
24
                "firstName":"John",
25
                "lastName":"Doe"
26
            },
27
            "language":"en"
28
};
29
        // Push session to fastspring
30
        fastspring.builder.push(mySession)
31
    }
32
</script>
33
34
<!--
35
    Effects: 
36
-->
37
<br /><br />
38
<div>
39
    Order Total: <span data-fsc-order-total></span>
40
</div>
41
42
<div>
43
    Quantity: <span data-fsc-item-path="phot-io-main-app" data-fsc-item-quantity></span>
44
</div>
45
<br /><br />
46
47
<button onclick="fastspring.builder.checkout();">Checkout to see </button>
48
<!--
49
    DEMO SETUP
50
        - Initialize the Store Builder Library
51
-->
52
<script
53
    id="fsc-api"
54
    src="https://sbl.onfastspring.com/sbl/1.0.2/fastspring-builder.min.js"
55
    type="text/javascript"
56
    data-storefront="fastspringexamples.test.onfastspring.com/popup-fastspringexamples">
57
</script>
1
 
1
1
 
1

Related Topics