#Rahim Dobani
1 messages · Page 1 of 1 (latest)
Hello
Hi
Its not updating customer
{
"customerID": "cus_OiP3YL5RVYNpnU",
"email": "rahim@gmail.com",
"name": "rahimdobani"
}
this is req
{
"customer": {
"id": "cus_OiP3YL5RVYNpnU",
"object": "customer",
"address": null,
"balance": 0,
"created": 1695823060,
"currency": null,
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": "use12r@gmail.com",
"invoice_prefix": "BC33A651",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": "pm_1NuyNpAOo6YEPSo0FOWbvBAW",
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {},
"name": "Rafiyaaa12122",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
},
"success": true
}
this is response
its not updating email and name
Have you looked in your Dashboard for the actual request?
Have you hardcoded a Customer ID instead of using a variable?
const customer = await stripe.customers.update(
"cus_OiP3YL5RVYNpnU",
{
description: '(created by Stripe Shell)',
name: 'Jenny Rosen',
email: 'example@website.com',
}
);
yeh i have hardcoded customer ID
Is function i am calling right? or have some error?
The best thing is to look in your Dashboard for exactly what is happening.
For instance I can see your recent requests are: https://dashboard.stripe.com/test/logs/req_p4nUsWnR3HrN9v
Which is a Customer update for that customer but nothing is being passed in the body of the request
So there is some issue with your parameters. Either your code isn't saved or something else. But those parameters aren't coming through
Yess, am i passing email and name correctly in params of function?
Or is syntax of code wrong?
No the syntax looks fine above, otherwise it would error.
Can you elaborate?
const cards = await stripe.paymentMethods.list({
customer: customerID,
type: 'card',
});
i am using this method to retrieve card but not getting card ID
{
"cards": {
"object": "list",
"data": [
{
"id": "pm_1NuyinAOo6YEPSo0zM30iLsX",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": "PK",
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "pass"
},
"country": "US",
"exp_month": 12,
"exp_year": 2029,
"fingerprint": "hpxT9s6BC5uhUy15",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1695824893,
"customer": "cus_OiPXBGt5v6Iibs",
"livemode": false,
"metadata": {},
"type": "card"
}
],
"has_more": false,
"url": "/v1/payment_methods"
},
"success": true
}
getting this response but can't find card id
I want to use card id in delete method.
You don't need the Card ID. That is an underlying object that you should mostly ignore. You just use the PaymentMethod ID here.
const deleted = await stripe.customers.deleteSource(
customerID,
cardID
);
so in delete api in instead of card ID i will use pmID?
To delete a PaymentMethod you detach it using: https://stripe.com/docs/api/payment_methods/detach
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
First i will detach payment method then i will delete it?
Detaching does "delete" it.