#Voltone
1 messages ยท Page 1 of 1 (latest)
You're passing a string, that parameter expects a hash of key values
metadata: "{\"type\":\"upfront\"}",
ok thanks trying now, one moment
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Still seems to be saying invalid object
Is this how I should be handing it in?
It's still a string unfortunately. Can you share the code that makes this API request?
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
It looks like something like params.put(metadata[0][key]: "value") will work
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?
Hi ๐ apologies for the delay. Yes, you can place data on the associated Payment Intent for a Checkout Session via the payment_intent_data.metadata parameter:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.