#Voltone

1 messages ยท Page 1 of 1 (latest)

spiral hillBOT
digital ether
#

You're passing a string, that parameter expects a hash of key values

#

metadata: "{\"type\":\"upfront\"}",

hollow frigate
#

ok thanks trying now, one moment

#

Still seems to be saying invalid object

hollow frigate
digital ether
hollow frigate
#

Sure, its written in a proprietary language on the Zoho Platform however.

#

//
// prepare parameters for checkout session
params = Map();
//
// get customer email & id from response
if(stripe_customer.get("data").size() == 0)
{
params.put("customer_email",customer_email);
}
else if(stripe_customer.get("data").size() > 0)
{
cust_id = stripe_customer.get("data").get(0).get("id");
params.put("customer",cust_id);
}
// info "price code " + price_code;
//
// create checkout session if price code found
if(price_code != "No price found")
{
amount = price_code.get("unit_amount") / 100;
if(payment_code == "MY")
{
amount = product.get("metadata").get("monthly_cycle").toLong() * price_code.get("unit_amount").toLong() / 100;
}
else if(payment_code == "SR")
{
amount = product.get("metadata").get("semester_cycle").toLong() * price_code.get("unit_amount").toLong() / 100;
}
//
// update opportunity amount.
opportunity_amount = amount + deposit.toLong();
opportunity_update = zoho.crm.updateRecord("Deals",opp_id,{"Amount":opportunity_amount});
//
//
params.put("success_url","https://www.iheed.org");
params.put("cancel_url","https://www.iheed.org");
if(payment_code == "UF")
{
params.put("mode","payment");
params.put("metadata",{"type":"upfront"});
}
else
{
params.put("mode","subscription");
}
params.put("line_items[0][price]",price_code.get("id"));
params.put("line_items[0][quantity]",1);
checkout_session = invokeurl
[
url :"https://api.stripe.com/v1/checkout/sessions"
type :POST
parameters:params.toMap()
headers:{"Authorization":"Bearer " + standalone.get_stripe_api_key()}
];
info "checkout " + checkout_session;
//
// Opportunity naming convention
expected_start_date = opp.get("Expected_Course_Start_Date").toDate();
programme = opp.get("Programme");
new_deal_name = programme + " - " + expected_start_date.toString("MMM Y");
//
// update opportunity with checkout session URL
update_response = zoho.crm.updateRecord("Deals",opp_id,{"Checkout_URL":checkout_session.get("url"),"Deal_Name":new_deal_name});
}

#

my thought is that

params.put("metadata",{"type":"upfront"});

despite being a key-value pair is converting the 2nd parameter to a string in this language

digital ether
#

It looks like something like params.put(metadata[0][key]: "value") will work

hollow frigate
#

perfect that works, one extra question is it possible to specify the metadata for the payment intent?

#

at the moment it specifys it for the checkout session completed event

#

but ideally id like to specify the meta data on the payment_intent.succeded event

#

is that possible from the checkout session creation call?

tardy fractal