I am working with the Affirm javascript API and I need to be able to update the values inside the checkout object but am having trouble doing so. I have tried what is mentioned here but it isnt working.
Basically the object looks something like this:
affirm.checkout({
"merchant":{
"user_confirmation_url":"https://example.com/checkout/",
"user_cancel_url":"https://example.com/exit"
},
"config":{
"financial_product_key":"XXXXXXXXX"
},
"shipping":{
"name":{
"full":"Blah Person"
},
"address":{
"line1":"123 example street",
"city":"Blah",
"state":"IL",
"zipcode":"12345",
"country":"US"
}
},
"billing":{
"name":{
"full":"Dirty Larry"
},
"address":{
"line1":"123 blah street",
"city":"foo",
"state":"IL",
"zipcode":"12345",
"country":"US"
}
},
"items":[
{
"display_name":"Example Product",
"sku":"123",
"unit_price":"1222",
"qty":"1",
"item_image_url":"https://example.com/kitty.jpg",
"item_url":"https://example.com/product/123"
}
],
"discounts":{
"discount_name":{
"discount_amount":0
}
},
"metadata":{
"shipping_type":"Ground"
},
"order_id":"XXXXXXXXXXXXXXXXXX",
"shipping_amount":0,
"tax_amount":0,
"total":67599
});
The above is all set on the first page load but the customer can still update items in their cart so I need to add these changes to the above object if they occur.
I have tried affirm_checkout["shipping_amount"] = 123
that doesn't update the shipping total. Neither does affirm_checkout.shipping_amount = 123
can someone tell me what I am doing wrong?