#chozboots
1 messages · Page 1 of 1 (latest)
Can you share the ID (req_xxx) of the failing API request? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Hmm, are you sure that's correct?
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#submitButton").onClick((event) => {
const payload = {
name: {
firstName: $w("#firstName").value,
middleInitial: $w("#middleInitial").value,
lastName: $w("#lastName").value,
},
address: {
'line1': $w("#streetAddress").value,
'city': $w("#city").value,
'state': $w("#stateDropdown").value,
'postal_code': $w("#zip").value,
},
email: $w("#email").value,
phone: $w("#phone").value,
instructionalDropdown: $w("#instructionalDropdown").value // Changed from 'instructionalDropdownr' to 'instructionalDropdown'
};
fetch('http://<mylink>/checkout-session', {
method: 'post',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
})
.then((httpResponse) => {
if (httpResponse.ok) {
return httpResponse.json();
} else {
return Promise.reject("Fetch did not succeed");
}
})
.then((json) => {
wixLocation.to(`https://checkout.stripe.com/pay/${json.id}`);
})
.catch((err) => {
console.error(err);
$w("#errorMessage").text = "An error occurred. Please try again.";
$w("#errorMessage").show(); // Show the error message when an error occurs
setTimeout(() => {
$w("#errorMessage").hide(); // Hide the error message after 5 seconds
}, 5000);
});
});
});
By the way, this is the code I'm using to send form data that the customer object is using, if it helps.
Let me double check
req_wnHcpQK0cbyh5z
That should be the correct one, the last character got cut off lol
Also, here is my error stream, if it helps.
File "app.py", line 23, in create_checkout_session
customer = stripe.Customer.create(
File "<path>\site-packages\stripe\api_resources\abstract\createable_api_resource.py", line 16, in create
return cls._static_request(
File "<path>\site-packages\stripe\api_resources\abstract\api_resource.py", line 139, in _static_request
response, api_key = requestor.request(method_, url_, params, headers)
File "<path>\site-packages\stripe\api_requestor.py", line 122, in request
resp = self.interpret_response(rbody, rcode, rheaders)
File "<path>\site-packages\stripe\api_requestor.py", line 399, in interpret_response
self.handle_error_response(rbody, rcode, resp.data, rheaders)
File "<path>\site-packages\stripe\api_requestor.py", line 159, in handle_error_response
raise err
stripe.error.InvalidRequestError: Request req_<request_id>: Invalid value type: {:line1=>"123 Example Street", :state=>"Alaska", :postal_code=>"55555", :city=>"Exampleville"} must be a string
Btw I'm using a Flask application for the backend
👋 taking over for my colleague. Let me catch up.
Okee doke
the problem is not in the address field on the customer but rather when you add it to the metadata field
Ohhhhh. I see.
the metadata dictionnary can only support key/value pairs which are both strings